@clarify-labs/renderer 0.7.0 → 0.7.2
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/{OpenApiOperation-ZXToVSFC.cjs → OpenApiOperation-BcyW_ULy.cjs} +186 -140
- package/output/OpenApiOperation-BcyW_ULy.cjs.map +1 -0
- package/output/{OpenApiOperation-CWSOhUVa.js → OpenApiOperation-tUKf7lZ4.js} +166 -120
- package/output/OpenApiOperation-tUKf7lZ4.js.map +1 -0
- package/output/{shell-xxhV0p7k.cjs → PageActions-1RDCHcUY.cjs} +280 -308
- package/output/PageActions-1RDCHcUY.cjs.map +1 -0
- package/output/{shell-CumiARRe.js → PageActions-yoDRjkq8.js} +235 -263
- package/output/PageActions-yoDRjkq8.js.map +1 -0
- package/output/{ThemeRoot-C_ZdzSMu.js → ThemeRoot-QULrwQf6.js} +407 -53
- package/output/ThemeRoot-QULrwQf6.js.map +1 -0
- package/output/{ThemeRoot-CEvwrGp5.cjs → ThemeRoot-UWj0iK1X.cjs} +458 -80
- package/output/ThemeRoot-UWj0iK1X.cjs.map +1 -0
- package/output/app/AppShell.d.ts +3 -2
- package/output/app/PageActions.d.ts +12 -0
- package/output/app/PageBanner.d.ts +7 -0
- package/output/app/SectionProvider.d.ts +1 -0
- package/output/client.cjs +14 -7
- package/output/client.d.ts +4 -2
- package/output/client.js +4 -4
- package/output/context.d.ts +1 -1
- package/output/core/context.d.ts +5 -5
- package/output/core/index.d.ts +1 -1
- package/output/core/types.d.ts +70 -61
- package/output/index.cjs +56 -28
- package/output/index.cjs.map +1 -1
- package/output/index.d.ts +7 -5
- package/output/index.js +37 -12
- package/output/index.js.map +1 -1
- package/output/mdx/components.d.ts +2 -0
- package/output/mdx/primitives.d.ts +2 -0
- package/output/openapi/components/EndpointSections.d.ts +30 -0
- package/output/preview.cjs +7 -7
- package/output/preview.cjs.map +1 -1
- package/output/preview.js +4 -4
- package/output/preview.js.map +1 -1
- package/output/{render-zHU25Nm9.cjs → render-ByWbJbrA.cjs} +8 -7
- package/output/render-ByWbJbrA.cjs.map +1 -0
- package/output/{render-CnUd0XwZ.js → render-psutGbsg.js} +6 -5
- package/output/render-psutGbsg.js.map +1 -0
- package/output/renderer.css +371 -269
- package/output/server.cjs +8 -7
- package/output/server.cjs.map +1 -1
- package/output/server.js +5 -4
- package/output/server.js.map +1 -1
- package/output/shell/ContentActions.d.ts +0 -1
- package/output/shell/Header.d.ts +3 -2
- package/output/shell/SiteLogo.d.ts +2 -2
- package/output/shell/mobile.d.ts +2 -2
- package/output/theme/ThemeEditor.d.ts +53 -17
- package/output/theme/ThemeProvider.d.ts +2 -1
- package/output/theme/ThemeRoot.d.ts +2 -2
- package/output/theme/cookies.d.ts +11 -0
- package/output/theme/randomTheme.d.ts +2 -2
- package/output/theme/variables.d.ts +58 -20
- package/output/utils/href.d.ts +3 -3
- package/package.json +1 -1
- package/output/OpenApiOperation-CWSOhUVa.js.map +0 -1
- package/output/OpenApiOperation-ZXToVSFC.cjs.map +0 -1
- package/output/ThemeRoot-CEvwrGp5.cjs.map +0 -1
- package/output/ThemeRoot-C_ZdzSMu.js.map +0 -1
- package/output/render-CnUd0XwZ.js.map +0 -1
- package/output/render-zHU25Nm9.cjs.map +0 -1
- package/output/shell-CumiARRe.js.map +0 -1
- package/output/shell-xxhV0p7k.cjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-DakpK96I.cjs");
|
|
2
|
-
const
|
|
2
|
+
const require_PageActions = require("./PageActions-1RDCHcUY.cjs");
|
|
3
3
|
const require_remark = require("./remark-Dv3owbSH.cjs");
|
|
4
4
|
let clsx = require("clsx");
|
|
5
5
|
clsx = require_chunk.__toESM(clsx, 1);
|
|
@@ -16,12 +16,12 @@ let github_slugger = require("github-slugger");
|
|
|
16
16
|
let _scalar_snippetz = require("@scalar/snippetz");
|
|
17
17
|
//#region source/components/LocalizedLink.tsx
|
|
18
18
|
function useLocalizedHref(href) {
|
|
19
|
-
return
|
|
19
|
+
return require_PageActions.localizeHref(href, require_PageActions.useConfig(), require_PageActions.useLocale());
|
|
20
20
|
}
|
|
21
21
|
function LocalizedLink(arg0) {
|
|
22
22
|
const { href, ...props } = arg0;
|
|
23
23
|
const localizedHref = useLocalizedHref(href);
|
|
24
|
-
if (!
|
|
24
|
+
if (!require_PageActions.isExternalHref(localizedHref) && !localizedHref.startsWith("#")) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_router_dom.Link, {
|
|
25
25
|
to: localizedHref,
|
|
26
26
|
...props
|
|
27
27
|
});
|
|
@@ -115,7 +115,7 @@ var defaultTitleKeys = {
|
|
|
115
115
|
};
|
|
116
116
|
function Callout(arg0) {
|
|
117
117
|
const { children, type = "info", title, icon = true, className, ...props } = arg0;
|
|
118
|
-
const t =
|
|
118
|
+
const t = require_PageActions.useBuiltInText();
|
|
119
119
|
const style = calloutStyles[type];
|
|
120
120
|
const Icon = style.Icon;
|
|
121
121
|
const resolvedTitle = title === void 0 ? t(defaultTitleKeys[type]) : title;
|
|
@@ -142,9 +142,9 @@ function Callout(arg0) {
|
|
|
142
142
|
function CardIcon(arg0) {
|
|
143
143
|
const { name } = arg0;
|
|
144
144
|
if (!name) return null;
|
|
145
|
-
const iconName =
|
|
145
|
+
const iconName = require_PageActions.resolveLucideIconName(name);
|
|
146
146
|
if (!iconName) return null;
|
|
147
|
-
const Icon =
|
|
147
|
+
const Icon = require_PageActions.lucideIconRegistry[iconName];
|
|
148
148
|
if (!Icon) return null;
|
|
149
149
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
150
150
|
className: "flex size-9 flex-none items-center justify-center rounded-(--clarify-theme-tokens-radius-lg) bg-(--clarify-ui-accent-background) text-(--clarify-ui-accent-text) ring-1 ring-(--clarify-ui-accent-border)",
|
|
@@ -229,7 +229,7 @@ function getNodeText(node) {
|
|
|
229
229
|
}
|
|
230
230
|
function CopyButton(arg0) {
|
|
231
231
|
const { code } = arg0;
|
|
232
|
-
const t =
|
|
232
|
+
const t = require_PageActions.useBuiltInText();
|
|
233
233
|
const [copyCount, setCopyCount] = (0, react.useState)(0);
|
|
234
234
|
const copied = copyCount > 0;
|
|
235
235
|
(0, react.useEffect)(() => {
|
|
@@ -238,38 +238,30 @@ function CopyButton(arg0) {
|
|
|
238
238
|
return () => window.clearTimeout(timeout);
|
|
239
239
|
}, [copyCount]);
|
|
240
240
|
if (!code) return null;
|
|
241
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.
|
|
241
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
242
242
|
type: "button",
|
|
243
|
-
className: (0, clsx.default)("clarify-code-copy group/button absolute top-3.5 right-4 overflow-hidden rounded-full py-1 pr-3 pl-2 text-2xs font-medium opacity-
|
|
243
|
+
className: (0, clsx.default)("clarify-code-copy group/button absolute top-3.5 right-4 inline-flex items-center gap-1 overflow-hidden rounded-full border border-(--clarify-code-border) py-1 pr-3 pl-2 text-2xs font-medium whitespace-nowrap opacity-100 shadow-sm backdrop-blur-sm transition sm:opacity-0 sm:group-hover:opacity-100 focus:opacity-100", copied ? "clarify-code-copy-copied text-(--clarify-code-text)" : "bg-(--clarify-code-control-background) text-(--clarify-code-text) hover:bg-(--clarify-code-control-background-hover)"),
|
|
244
244
|
onClick: () => {
|
|
245
|
-
|
|
245
|
+
require_PageActions.copyTextToClipboard(code).then((ok) => {
|
|
246
246
|
if (ok) setCopyCount((count) => count + 1);
|
|
247
247
|
});
|
|
248
248
|
},
|
|
249
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("
|
|
250
|
-
"aria-hidden": copied,
|
|
251
|
-
className: (0, clsx.default)("pointer-events-none flex items-center gap-0.5 text-zinc-400 transition duration-300", copied && "-translate-y-1.5 opacity-0"),
|
|
252
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Clipboard, { className: "h-5 w-5 stroke-zinc-500 transition-colors group-hover/button:stroke-zinc-400" }), t("actions.copy")]
|
|
253
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
254
|
-
"aria-hidden": !copied,
|
|
255
|
-
className: (0, clsx.default)("pointer-events-none absolute inset-0 flex items-center justify-center text-(--clarify-theme-tokens-colors-primary) transition duration-300", !copied && "translate-y-1.5 opacity-0"),
|
|
256
|
-
children: t("actions.copied")
|
|
257
|
-
})]
|
|
249
|
+
children: copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, { className: "h-3.5 w-3.5 stroke-(--clarify-theme-tokens-colors-primary)" }), t("actions.copied")] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Clipboard, { className: "h-3.5 w-3.5 stroke-(--clarify-code-muted) transition-colors group-hover/button:stroke-(--clarify-code-text)" }), t("actions.copy")] })
|
|
258
250
|
});
|
|
259
251
|
}
|
|
260
252
|
function CodePanelHeader(arg0) {
|
|
261
253
|
const { tag, label } = arg0;
|
|
262
254
|
if (!tag && !label) return null;
|
|
263
255
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
264
|
-
className: "clarify-code-panel-header flex h-9 items-center gap-2 border-y border-
|
|
256
|
+
className: "clarify-code-panel-header flex h-9 items-center gap-2 border-y border-(--clarify-code-border) border-t-transparent bg-(--clarify-code-background) px-4",
|
|
265
257
|
children: [
|
|
266
258
|
tag ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
267
259
|
className: "clarify-code-panel-tag font-semibold text-(--clarify-theme-tokens-colors-primary)",
|
|
268
260
|
children: tag
|
|
269
261
|
}) : null,
|
|
270
|
-
tag && label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "h-0.5 w-0.5 rounded-full bg-
|
|
262
|
+
tag && label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "h-0.5 w-0.5 rounded-full bg-(--clarify-code-faint)" }) : null,
|
|
271
263
|
label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
272
|
-
className: "text-xs text-
|
|
264
|
+
className: "truncate text-xs text-(--clarify-code-muted)",
|
|
273
265
|
children: label
|
|
274
266
|
}) : null
|
|
275
267
|
]
|
|
@@ -287,14 +279,14 @@ function CodePanel(arg0) {
|
|
|
287
279
|
}
|
|
288
280
|
const copyText = code ?? getNodeText(children);
|
|
289
281
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
290
|
-
className: "clarify-code-panel group
|
|
282
|
+
className: "clarify-code-panel group bg-(--clarify-code-background)",
|
|
291
283
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodePanelHeader, {
|
|
292
284
|
tag,
|
|
293
285
|
label
|
|
294
286
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
295
287
|
className: "relative",
|
|
296
288
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
|
|
297
|
-
className: "clarify-code-pre overflow-x-auto p-4 text-xs text-
|
|
289
|
+
className: "clarify-code-pre overflow-x-auto p-4 text-xs text-(--clarify-code-text)",
|
|
298
290
|
children
|
|
299
291
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopyButton, { code: copyText })]
|
|
300
292
|
})]
|
|
@@ -302,18 +294,18 @@ function CodePanel(arg0) {
|
|
|
302
294
|
}
|
|
303
295
|
function CodeGroupHeader(arg0) {
|
|
304
296
|
const { title, children, selectedIndex } = arg0;
|
|
305
|
-
const t =
|
|
297
|
+
const t = require_PageActions.useBuiltInText();
|
|
306
298
|
const hasTabs = react.Children.count(children) > 1;
|
|
307
299
|
if (!title && !hasTabs) return null;
|
|
308
300
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
309
|
-
className: "clarify-code-group-header flex min-h-(--clarify-code-header-min-height) flex-wrap items-start gap-x-4 border-b border-
|
|
301
|
+
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",
|
|
310
302
|
children: [title ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
311
|
-
className: "mr-auto pt-3 text-xs font-semibold text-
|
|
303
|
+
className: "mr-auto pt-3 text-xs font-semibold text-(--clarify-code-text)",
|
|
312
304
|
children: title
|
|
313
305
|
}) : null, hasTabs ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.TabList, {
|
|
314
306
|
className: "clarify-code-tabs -mb-px flex gap-4 text-xs font-medium",
|
|
315
307
|
children: react.Children.map(children, (child, childIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.Tab, {
|
|
316
|
-
className: (0, clsx.default)("clarify-code-tab border-b py-3 transition data-selected:not-data-focus:outline-hidden", childIndex === selectedIndex ? "border-(--clarify-theme-tokens-colors-primary) text-(--clarify-theme-tokens-colors-primary)" : "border-transparent text-
|
|
308
|
+
className: (0, clsx.default)("clarify-code-tab border-b py-3 transition data-selected:not-data-focus:outline-hidden", childIndex === selectedIndex ? "border-(--clarify-theme-tokens-colors-primary) text-(--clarify-theme-tokens-colors-primary)" : "border-transparent text-(--clarify-code-muted) hover:text-(--clarify-code-text)"),
|
|
317
309
|
children: getPanelTitle({
|
|
318
310
|
...(0, react.isValidElement)(child) ? child.props : {},
|
|
319
311
|
fallbackTitle: t("actions.code")
|
|
@@ -381,13 +373,13 @@ function useTabGroupProps(availableLanguages) {
|
|
|
381
373
|
var CodeGroupContext = (0, react.createContext)(false);
|
|
382
374
|
function CodeGroup(arg0) {
|
|
383
375
|
const { children, title, ...props } = arg0;
|
|
384
|
-
const t =
|
|
376
|
+
const t = require_PageActions.useBuiltInText();
|
|
385
377
|
const tabGroupProps = useTabGroupProps(react.Children.map(children, (child) => getPanelTitle({
|
|
386
378
|
...(0, react.isValidElement)(child) ? child.props : {},
|
|
387
379
|
fallbackTitle: t("actions.code")
|
|
388
380
|
})) ?? []);
|
|
389
381
|
const hasTabs = react.Children.count(children) > 1;
|
|
390
|
-
const containerClassName = "clarify-code-group my-6 overflow-hidden rounded-2xl bg-
|
|
382
|
+
const containerClassName = "clarify-code-group my-6 overflow-hidden rounded-2xl bg-(--clarify-code-background) shadow-md ring-1 ring-(--clarify-code-border)";
|
|
391
383
|
const header = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodeGroupHeader, {
|
|
392
384
|
title,
|
|
393
385
|
selectedIndex: tabGroupProps.selectedIndex,
|
|
@@ -448,7 +440,7 @@ function Collapse(arg0) {
|
|
|
448
440
|
setMaxHeight(open ? `${contentRef.current.scrollHeight}px` : "0px");
|
|
449
441
|
}, [open, children]);
|
|
450
442
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
451
|
-
className: (0, clsx.default)("clarify-collapse my-6 overflow-hidden rounded-(--clarify-theme-tokens-radius-xl) border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface)
|
|
443
|
+
className: (0, clsx.default)("clarify-collapse my-6 overflow-hidden rounded-(--clarify-theme-tokens-radius-xl) border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface)", className),
|
|
452
444
|
...props,
|
|
453
445
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
454
446
|
type: "button",
|
|
@@ -486,7 +478,7 @@ function FeedbackButton(props) {
|
|
|
486
478
|
}
|
|
487
479
|
var FeedbackForm = (0, react.forwardRef)(function FeedbackForm(arg0, ref) {
|
|
488
480
|
const { onSubmit, className, ...props } = arg0;
|
|
489
|
-
const t =
|
|
481
|
+
const t = require_PageActions.useBuiltInText();
|
|
490
482
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
|
|
491
483
|
...props,
|
|
492
484
|
ref,
|
|
@@ -513,7 +505,7 @@ var FeedbackForm = (0, react.forwardRef)(function FeedbackForm(arg0, ref) {
|
|
|
513
505
|
});
|
|
514
506
|
var FeedbackThanks = (0, react.forwardRef)(function FeedbackThanks(arg0, ref) {
|
|
515
507
|
const { className, ...props } = arg0;
|
|
516
|
-
const t =
|
|
508
|
+
const t = require_PageActions.useBuiltInText();
|
|
517
509
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
518
510
|
...props,
|
|
519
511
|
ref,
|
|
@@ -621,9 +613,9 @@ function Heading(arg0) {
|
|
|
621
613
|
const resolvedLevel = level ?? 2;
|
|
622
614
|
const Component = `h${resolvedLevel}`;
|
|
623
615
|
const ref = (0, react.useRef)(null);
|
|
624
|
-
const registerHeading =
|
|
616
|
+
const registerHeading = require_PageActions.useSectionStore((state) => state.registerHeading);
|
|
625
617
|
const inView = (0, framer_motion.useInView)(ref, {
|
|
626
|
-
margin: `${
|
|
618
|
+
margin: `${require_PageActions.remToPx(-3.5)}px 0px 0px 0px`,
|
|
627
619
|
amount: "all"
|
|
628
620
|
});
|
|
629
621
|
(0, react.useEffect)(() => {
|
|
@@ -817,6 +809,7 @@ var primitives_exports = /* @__PURE__ */ require_chunk.__exportAll({
|
|
|
817
809
|
WebFrame: () => WebFrame,
|
|
818
810
|
a: () => a,
|
|
819
811
|
code: () => code,
|
|
812
|
+
h1: () => h1,
|
|
820
813
|
h2: () => h2,
|
|
821
814
|
h3: () => h3,
|
|
822
815
|
pre: () => pre,
|
|
@@ -825,7 +818,7 @@ var primitives_exports = /* @__PURE__ */ require_chunk.__exportAll({
|
|
|
825
818
|
function wrapper(arg0) {
|
|
826
819
|
const { children } = arg0;
|
|
827
820
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("article", {
|
|
828
|
-
className: "clarify-mdx-page flex h-full flex-col pt-
|
|
821
|
+
className: "clarify-mdx-page flex h-full flex-col pt-14 pb-10",
|
|
829
822
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Prose, {
|
|
830
823
|
className: "flex-auto",
|
|
831
824
|
children
|
|
@@ -839,6 +832,17 @@ function a(arg0) {
|
|
|
839
832
|
...props
|
|
840
833
|
});
|
|
841
834
|
}
|
|
835
|
+
function h1(arg0) {
|
|
836
|
+
const { children, className, ...props } = arg0;
|
|
837
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
838
|
+
className: "clarify-page-title-row flex flex-col gap-4 pb-4 sm:flex-row sm:items-start sm:justify-between",
|
|
839
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
|
|
840
|
+
className: (0, clsx.default)("clarify-page-title min-w-0 flex-1", className),
|
|
841
|
+
...props,
|
|
842
|
+
children
|
|
843
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PageActions.PageTitleActions, {})]
|
|
844
|
+
});
|
|
845
|
+
}
|
|
842
846
|
var code = Code;
|
|
843
847
|
var pre = Pre;
|
|
844
848
|
function h2(props) {
|
|
@@ -864,16 +868,16 @@ function Note(arg0) {
|
|
|
864
868
|
});
|
|
865
869
|
}
|
|
866
870
|
function Row(arg0) {
|
|
867
|
-
const { children } = arg0;
|
|
871
|
+
const { children, className } = arg0;
|
|
868
872
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
869
|
-
className: "clarify-row grid grid-cols-1 items-start gap-x-8 gap-y-10 xl:max-w-none xl:grid-cols-2",
|
|
873
|
+
className: (0, clsx.default)("clarify-row grid grid-cols-1 items-start gap-x-8 gap-y-10 xl:max-w-none xl:grid-cols-2", className),
|
|
870
874
|
children
|
|
871
875
|
});
|
|
872
876
|
}
|
|
873
877
|
function Col(arg0) {
|
|
874
878
|
const { children, sticky = false } = arg0;
|
|
875
879
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
876
|
-
className: (0, clsx.default)("clarify-col *:first:mt-0 *:last:mb-0", sticky && "xl:sticky xl:top-
|
|
880
|
+
className: (0, clsx.default)("clarify-col *:first:mt-0 *:last:mb-0", sticky && "xl:sticky xl:top-[calc(var(--clarify-header-offset,3.5rem)+1.5rem)] xl:self-start"),
|
|
877
881
|
children
|
|
878
882
|
});
|
|
879
883
|
}
|
|
@@ -1543,26 +1547,26 @@ function SelectControl(arg0) {
|
|
|
1543
1547
|
className: wrapperClassName,
|
|
1544
1548
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.ListboxButton, {
|
|
1545
1549
|
"aria-label": label,
|
|
1546
|
-
className: `clarify-api-select-button flex ${buttonSizeClassName} items-center justify-between gap-2 rounded-lg bg-
|
|
1550
|
+
className: `clarify-api-select-button flex ${buttonSizeClassName} items-center justify-between gap-2 rounded-lg bg-(--clarify-code-control-background) px-2 py-1 text-xs font-medium whitespace-nowrap text-(--clarify-code-text) outline-hidden transition hover:bg-(--clarify-code-control-background-hover) focus:ring-2 focus:ring-(--clarify-ui-accent-border) data-open:bg-(--clarify-code-control-background-hover) data-open:ring-2 data-open:ring-(--clarify-ui-accent-border)`,
|
|
1547
1551
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1548
1552
|
className: "flex min-w-0 items-center gap-1.5 overflow-hidden",
|
|
1549
1553
|
children: [icon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1550
|
-
className: "shrink-0 text-
|
|
1554
|
+
className: "shrink-0 text-(--clarify-code-faint)",
|
|
1551
1555
|
children: icon
|
|
1552
1556
|
}) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1553
1557
|
className: "truncate",
|
|
1554
1558
|
children: selectedOption?.label ?? value
|
|
1555
1559
|
})]
|
|
1556
1560
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronsUpDownIcon, {
|
|
1557
|
-
className: "h-3.5 w-3.5 shrink-0 text-
|
|
1561
|
+
className: "h-3.5 w-3.5 shrink-0 text-(--clarify-code-faint)",
|
|
1558
1562
|
"aria-hidden": "true"
|
|
1559
1563
|
})]
|
|
1560
1564
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.ListboxOptions, {
|
|
1561
1565
|
anchor: "bottom end",
|
|
1562
|
-
className: "clarify-api-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-
|
|
1566
|
+
className: "clarify-api-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",
|
|
1563
1567
|
children: normalizedOptions.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.ListboxOption, {
|
|
1564
1568
|
value: option.value,
|
|
1565
|
-
className: "clarify-api-select-option group flex cursor-default items-center justify-between gap-3 rounded-lg px-2.5 py-2 text-xs whitespace-nowrap text-
|
|
1569
|
+
className: "clarify-api-select-option group flex cursor-default items-center justify-between gap-3 rounded-lg px-2.5 py-2 text-xs whitespace-nowrap text-(--clarify-code-muted) select-none data-focus:bg-(--clarify-code-control-background-hover) data-focus:text-(--clarify-code-text) data-selected:text-(--clarify-theme-tokens-colors-primary)",
|
|
1566
1570
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: option.label }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CheckIcon, {
|
|
1567
1571
|
className: "h-3.5 w-3.5 shrink-0 opacity-0 group-data-selected:opacity-100",
|
|
1568
1572
|
"aria-hidden": "true"
|
|
@@ -1637,23 +1641,23 @@ function authLabel(name, scheme) {
|
|
|
1637
1641
|
}
|
|
1638
1642
|
function CopyCodeButton(arg0) {
|
|
1639
1643
|
const { code } = arg0;
|
|
1640
|
-
const t =
|
|
1644
|
+
const t = require_PageActions.useBuiltInText();
|
|
1641
1645
|
const [copied, setCopied] = (0, react.useState)(false);
|
|
1642
1646
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1643
1647
|
type: "button",
|
|
1644
1648
|
onClick: () => {
|
|
1645
|
-
|
|
1649
|
+
require_PageActions.copyTextToClipboard(code).then((ok) => {
|
|
1646
1650
|
if (!ok) return;
|
|
1647
1651
|
setCopied(true);
|
|
1648
1652
|
window.setTimeout(() => setCopied(false), 1e3);
|
|
1649
1653
|
});
|
|
1650
1654
|
},
|
|
1651
|
-
className: "flex items-center gap-1.5 rounded-full bg-
|
|
1655
|
+
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)",
|
|
1652
1656
|
children: [copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CheckIcon, {
|
|
1653
|
-
className: "h-3.5 w-3.5 text-
|
|
1657
|
+
className: "h-3.5 w-3.5 text-(--clarify-theme-tokens-colors-primary)",
|
|
1654
1658
|
"aria-hidden": "true"
|
|
1655
1659
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ClipboardIcon, {
|
|
1656
|
-
className: "h-3.5 w-3.5 text-
|
|
1660
|
+
className: "h-3.5 w-3.5 text-(--clarify-code-faint)",
|
|
1657
1661
|
"aria-hidden": "true"
|
|
1658
1662
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: copied ? t("actions.copied") : t("actions.copy") })]
|
|
1659
1663
|
});
|
|
@@ -1673,7 +1677,7 @@ function ExampleMetaValue(arg0) {
|
|
|
1673
1677
|
}
|
|
1674
1678
|
function CodeToolbar(arg0) {
|
|
1675
1679
|
const { code, languageOptions, selectedLanguageKey, onSelectLanguage, clientOptions, selectedClientKey, onSelectClient } = arg0;
|
|
1676
|
-
const t =
|
|
1680
|
+
const t = require_PageActions.useBuiltInText();
|
|
1677
1681
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1678
1682
|
className: "absolute top-3.5 right-4 left-4 z-10 flex items-center justify-between gap-3",
|
|
1679
1683
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -1702,17 +1706,17 @@ function CodeToolbar(arg0) {
|
|
|
1702
1706
|
}
|
|
1703
1707
|
function ApiExampleCodeGroup(arg0) {
|
|
1704
1708
|
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;
|
|
1705
|
-
const t =
|
|
1706
|
-
const metaClassName = comfortableMeta ? "flex min-h-11 min-w-0 items-center gap-2 border-y border-
|
|
1709
|
+
const t = require_PageActions.useBuiltInText();
|
|
1710
|
+
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";
|
|
1707
1711
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1708
|
-
className: "clarify-api-example my-6 overflow-hidden rounded-2xl bg-
|
|
1712
|
+
className: "clarify-api-example my-6 overflow-hidden rounded-2xl bg-(--clarify-code-background) shadow-md ring-1 ring-(--clarify-code-border)",
|
|
1709
1713
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1710
1714
|
className: "not-prose",
|
|
1711
1715
|
children: [
|
|
1712
1716
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1713
|
-
className: "clarify-api-example-header flex min-h-(--clarify-code-header-min-height) items-center gap-3 border-b border-
|
|
1717
|
+
className: "clarify-api-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",
|
|
1714
1718
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
1715
|
-
className: "mr-auto min-w-16 truncate py-1 text-xs font-semibold text-
|
|
1719
|
+
className: "mr-auto min-w-16 truncate py-1 text-xs font-semibold text-(--clarify-code-text)",
|
|
1716
1720
|
children: title
|
|
1717
1721
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1718
1722
|
className: "ml-auto flex min-w-0 items-center gap-2 whitespace-nowrap",
|
|
@@ -1744,18 +1748,18 @@ function ApiExampleCodeGroup(arg0) {
|
|
|
1744
1748
|
onChange: onSelectTag,
|
|
1745
1749
|
className: "clarify-api-example-status font-semibold text-emerald-400"
|
|
1746
1750
|
}) : null,
|
|
1747
|
-
tag && label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "h-0.5 w-0.5 shrink-0 rounded-full bg-
|
|
1751
|
+
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,
|
|
1748
1752
|
label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ExampleMetaValue, {
|
|
1749
1753
|
label: t("openapi.mediaType"),
|
|
1750
1754
|
value: label,
|
|
1751
1755
|
options: labelOptions,
|
|
1752
1756
|
onChange: onSelectLabel,
|
|
1753
|
-
className: "min-w-0 truncate text-xs text-
|
|
1757
|
+
className: "min-w-0 truncate text-xs text-(--clarify-code-muted)"
|
|
1754
1758
|
}) : null
|
|
1755
1759
|
]
|
|
1756
1760
|
}) : null,
|
|
1757
1761
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1758
|
-
className: "clarify-api-example-code group relative",
|
|
1762
|
+
className: "clarify-api-example-code group relative bg-(--clarify-code-background)",
|
|
1759
1763
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodeToolbar, {
|
|
1760
1764
|
code,
|
|
1761
1765
|
languageOptions,
|
|
@@ -1765,7 +1769,7 @@ function ApiExampleCodeGroup(arg0) {
|
|
|
1765
1769
|
selectedClientKey,
|
|
1766
1770
|
onSelectClient
|
|
1767
1771
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
|
|
1768
|
-
className: `max-h-128 overflow-auto overscroll-contain p-4 text-xs text-
|
|
1772
|
+
className: `max-h-128 overflow-auto overscroll-contain p-4 text-xs text-(--clarify-code-text) ${languageOptions && languageOptions.length > 1 ? "pt-14" : ""}`,
|
|
1769
1773
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
|
|
1770
1774
|
className: `language-${language}`,
|
|
1771
1775
|
children: code
|
|
@@ -1778,7 +1782,7 @@ function ApiExampleCodeGroup(arg0) {
|
|
|
1778
1782
|
}
|
|
1779
1783
|
function RequestExamplesPanel(arg0) {
|
|
1780
1784
|
const { spec, path, method, parameters, requestContents, selectedMediaType, onSelectMediaType, selectedServer, serverVariables, auth } = arg0;
|
|
1781
|
-
const t =
|
|
1785
|
+
const t = require_PageActions.useBuiltInText();
|
|
1782
1786
|
const selectedContent = requestContents.find((content) => content.mediaType === selectedMediaType) ?? requestContents[0];
|
|
1783
1787
|
const examples = getExampleEntries(selectedContent?.value);
|
|
1784
1788
|
const [selectedExampleKey, setSelectedExampleKey] = (0, react.useState)(examples[0]?.key ?? "");
|
|
@@ -1835,7 +1839,7 @@ function RequestExamplesPanel(arg0) {
|
|
|
1835
1839
|
}
|
|
1836
1840
|
function ResponseExamplesPanel(arg0) {
|
|
1837
1841
|
const { operation, spec } = arg0;
|
|
1838
|
-
const t =
|
|
1842
|
+
const t = require_PageActions.useBuiltInText();
|
|
1839
1843
|
const responses = getResponseEntries(operation, spec).filter(({ response }) => getMediaTypeEntries(response.content, spec).length > 0);
|
|
1840
1844
|
const [selectedStatus, setSelectedStatus] = (0, react.useState)(responses.find(({ status }) => status.startsWith("2"))?.status ?? responses[0]?.status ?? "");
|
|
1841
1845
|
const selectedResponse = responses.find(({ status }) => status === selectedStatus) ?? responses[0];
|
|
@@ -2028,7 +2032,7 @@ function getRootSchemaNode(spec, schema) {
|
|
|
2028
2032
|
}
|
|
2029
2033
|
function SchemaNode(arg0) {
|
|
2030
2034
|
const { node, depth = 0 } = arg0;
|
|
2031
|
-
const t =
|
|
2035
|
+
const t = require_PageActions.useBuiltInText();
|
|
2032
2036
|
const [expanded, setExpanded] = (0, react.useState)(depth < 1);
|
|
2033
2037
|
const hasChildren = node.children.length > 0;
|
|
2034
2038
|
const type = [node.type, node.required ? t("openapi.requiredBadge") : void 0].filter(Boolean).join(", ") || void 0;
|
|
@@ -2047,7 +2051,10 @@ function SchemaNode(arg0) {
|
|
|
2047
2051
|
}) : null]
|
|
2048
2052
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2049
2053
|
className: "mt-0.5 text-sm/5 text-(--clarify-ui-text-soft) *:first:mt-0 *:last:mb-0",
|
|
2050
|
-
children: [node.description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, {
|
|
2054
|
+
children: [node.description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, {
|
|
2055
|
+
className: "*:first:mt-0 *:last:mb-0",
|
|
2056
|
+
children: node.description
|
|
2057
|
+
}) : fallbackDescription, node.details ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
2051
2058
|
className: "text-xs text-(--clarify-ui-text-faint)",
|
|
2052
2059
|
children: node.details
|
|
2053
2060
|
}) : null]
|
|
@@ -2098,50 +2105,98 @@ function SchemaProperties(arg0) {
|
|
|
2098
2105
|
}
|
|
2099
2106
|
function ParameterList(arg0) {
|
|
2100
2107
|
const { title, parameters } = arg0;
|
|
2101
|
-
const t =
|
|
2108
|
+
const t = require_PageActions.useBuiltInText();
|
|
2102
2109
|
if (parameters.length === 0) return null;
|
|
2103
2110
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: title }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Properties, { children: parameters.map((parameter) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Property, {
|
|
2104
2111
|
name: parameter.name ?? t("openapi.parameter"),
|
|
2105
2112
|
type: [schemaToType(parameter.schema), parameter.required ? t("openapi.requiredBadge") : void 0].filter(Boolean).join(", ") || void 0,
|
|
2106
|
-
children: parameter.description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, {
|
|
2113
|
+
children: parameter.description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, {
|
|
2114
|
+
className: "*:first:mt-0 *:last:mb-0",
|
|
2115
|
+
children: parameter.description
|
|
2116
|
+
}) : t("openapi.operationParameter")
|
|
2107
2117
|
}, `${parameter.in}-${parameter.name}`)) })] });
|
|
2108
2118
|
}
|
|
2109
2119
|
function ResponseList(arg0) {
|
|
2110
2120
|
const { operation, spec } = arg0;
|
|
2111
|
-
const t =
|
|
2121
|
+
const t = require_PageActions.useBuiltInText();
|
|
2112
2122
|
const responses = getResponseEntries(operation, spec);
|
|
2113
2123
|
if (responses.length === 0) return null;
|
|
2114
2124
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: t("openapi.responses") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Properties, { children: responses.map(({ status, response }) => {
|
|
2115
2125
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Property, {
|
|
2116
2126
|
name: status,
|
|
2117
2127
|
type: schemaToType(getJsonLikeContent(response.content, spec)?.value.schema),
|
|
2118
|
-
children: response.description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, {
|
|
2128
|
+
children: response.description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, {
|
|
2129
|
+
className: "*:first:mt-0 *:last:mb-0",
|
|
2130
|
+
children: response.description
|
|
2131
|
+
}) : `${t("openapi.response")}.`
|
|
2119
2132
|
}, status);
|
|
2120
2133
|
}) })] });
|
|
2121
2134
|
}
|
|
2122
2135
|
//#endregion
|
|
2123
|
-
//#region source/openapi/components/
|
|
2124
|
-
function
|
|
2125
|
-
const { spec, path, method,
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2136
|
+
//#region source/openapi/components/EndpointSections.tsx
|
|
2137
|
+
function EndpointRequest(arg0) {
|
|
2138
|
+
const { spec, path, method, description, groupedParameters, parameters, requestBody, requestContents, requestSchema, selectedRequestMediaType, onSelectRequestMediaType, selectedServer, serverVariables, auth } = arg0;
|
|
2139
|
+
const t = require_PageActions.useBuiltInText();
|
|
2140
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Row, {
|
|
2141
|
+
className: "relative mt-6",
|
|
2142
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Col, { children: [
|
|
2143
|
+
description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, { children: description }) : null,
|
|
2144
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ParameterList, {
|
|
2145
|
+
title: t("openapi.pathParameters"),
|
|
2146
|
+
parameters: groupedParameters.path
|
|
2147
|
+
}),
|
|
2148
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ParameterList, {
|
|
2149
|
+
title: t("openapi.queryParameters"),
|
|
2150
|
+
parameters: groupedParameters.query
|
|
2151
|
+
}),
|
|
2152
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ParameterList, {
|
|
2153
|
+
title: t("openapi.headers"),
|
|
2154
|
+
parameters: groupedParameters.header
|
|
2155
|
+
}),
|
|
2156
|
+
requestBody && requestContents.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
2157
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: t("openapi.requestBody") }),
|
|
2158
|
+
typeof requestBody.description === "string" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, { children: requestBody.description }) : null,
|
|
2159
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SchemaProperties, {
|
|
2160
|
+
title: t("openapi.bodyProperties"),
|
|
2161
|
+
schema: requestSchema,
|
|
2162
|
+
spec
|
|
2163
|
+
})
|
|
2164
|
+
] }) : null
|
|
2165
|
+
] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Col, {
|
|
2166
|
+
sticky: true,
|
|
2167
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RequestExamplesPanel, {
|
|
2168
|
+
spec,
|
|
2169
|
+
path,
|
|
2170
|
+
method,
|
|
2171
|
+
parameters,
|
|
2172
|
+
requestContents,
|
|
2173
|
+
selectedMediaType: selectedRequestMediaType,
|
|
2174
|
+
onSelectMediaType: onSelectRequestMediaType,
|
|
2175
|
+
selectedServer,
|
|
2176
|
+
serverVariables,
|
|
2177
|
+
auth
|
|
2178
|
+
})
|
|
2179
|
+
})]
|
|
2180
|
+
});
|
|
2181
|
+
}
|
|
2182
|
+
function EndpointResponse(arg0) {
|
|
2183
|
+
const { spec, operation } = arg0;
|
|
2184
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Row, {
|
|
2185
|
+
className: "relative mt-6",
|
|
2186
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Col, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResponseList, {
|
|
2140
2187
|
operation,
|
|
2141
2188
|
spec
|
|
2189
|
+
}) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Col, {
|
|
2190
|
+
sticky: true,
|
|
2191
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResponseExamplesPanel, {
|
|
2192
|
+
operation,
|
|
2193
|
+
spec
|
|
2194
|
+
})
|
|
2142
2195
|
})]
|
|
2143
2196
|
});
|
|
2144
2197
|
}
|
|
2198
|
+
//#endregion
|
|
2199
|
+
//#region source/openapi/components/OpenApiOperation.tsx
|
|
2145
2200
|
var endpointMethodStyles = {
|
|
2146
2201
|
GET: "bg-emerald-400/15 text-emerald-600 dark:bg-emerald-400/20 dark:text-emerald-300",
|
|
2147
2202
|
POST: "bg-sky-400/15 text-sky-600 dark:bg-sky-400/20 dark:text-sky-300",
|
|
@@ -2202,14 +2257,31 @@ function getServerPreviewUrl(server, variables) {
|
|
|
2202
2257
|
return (server.url ?? "").replace(/\{([^}]+)\}/g, (_, name) => variables[name] ?? server.variables?.[name]?.default ?? `{${name}}`);
|
|
2203
2258
|
}
|
|
2204
2259
|
function ServerUrlValue(arg0) {
|
|
2205
|
-
const { server, variables, open, onToggle } = arg0;
|
|
2260
|
+
const { server, variables, open, interactive, onToggle } = arg0;
|
|
2206
2261
|
const url = getServerPreviewUrl(server, variables);
|
|
2262
|
+
if (!interactive) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
2263
|
+
"aria-label": "Server",
|
|
2264
|
+
className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-(--clarify-ui-subtle-background) text-(--clarify-ui-text-foreground) sm:w-auto sm:min-w-16 sm:max-w-(--clarify-server-url-max-width) sm:px-1.5",
|
|
2265
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2266
|
+
className: "sm:hidden",
|
|
2267
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ServerIcon, {
|
|
2268
|
+
className: "h-4 w-4",
|
|
2269
|
+
"aria-hidden": "true"
|
|
2270
|
+
})
|
|
2271
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2272
|
+
className: "hidden min-w-0 items-center overflow-hidden sm:flex",
|
|
2273
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2274
|
+
className: "truncate font-semibold text-xs",
|
|
2275
|
+
children: url
|
|
2276
|
+
})
|
|
2277
|
+
})]
|
|
2278
|
+
});
|
|
2207
2279
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
2208
2280
|
type: "button",
|
|
2209
2281
|
"aria-expanded": open,
|
|
2210
2282
|
"aria-label": "Server",
|
|
2211
2283
|
onClick: onToggle,
|
|
2212
|
-
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-
|
|
2284
|
+
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-foreground) transition hover:bg-(--clarify-ui-hover-background) hover:text-(--clarify-theme-tokens-colors-foreground) 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),
|
|
2213
2285
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2214
2286
|
className: "sm:hidden",
|
|
2215
2287
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ServerIcon, {
|
|
@@ -2219,7 +2291,7 @@ function ServerUrlValue(arg0) {
|
|
|
2219
2291
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
2220
2292
|
className: "hidden min-w-0 items-center gap-1 overflow-hidden sm:flex",
|
|
2221
2293
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2222
|
-
className: "truncate text-xs",
|
|
2294
|
+
className: "truncate font-semibold text-xs",
|
|
2223
2295
|
children: url
|
|
2224
2296
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDownIcon, {
|
|
2225
2297
|
className: "h-3.5 w-3.5 shrink-0 text-zinc-400",
|
|
@@ -2330,6 +2402,7 @@ function AuthPanel(arg0) {
|
|
|
2330
2402
|
function EndpointIdentity(arg0) {
|
|
2331
2403
|
const { method, path, servers, selectedServerKey, selectedServer, serverVariables, serverOpen, authOptions, selectedAuthName, selectedAuth, authValues, authOpen, onSelectServer, onChangeServerVariable, onToggleServer, onToggleAuth, onSelectAuth, onChangeAuthValue } = arg0;
|
|
2332
2404
|
const segments = path.split("/").filter(Boolean);
|
|
2405
|
+
const serverInteractive = servers.length > 1 || Object.keys(selectedServer.variables ?? {}).length > 0;
|
|
2333
2406
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2334
2407
|
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",
|
|
2335
2408
|
children: [
|
|
@@ -2341,6 +2414,7 @@ function EndpointIdentity(arg0) {
|
|
|
2341
2414
|
server: selectedServer,
|
|
2342
2415
|
variables: serverVariables,
|
|
2343
2416
|
open: serverOpen,
|
|
2417
|
+
interactive: serverInteractive,
|
|
2344
2418
|
onToggle: onToggleServer
|
|
2345
2419
|
}),
|
|
2346
2420
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -2378,7 +2452,7 @@ function EndpointIdentity(arg0) {
|
|
|
2378
2452
|
}) : null
|
|
2379
2453
|
]
|
|
2380
2454
|
}),
|
|
2381
|
-
serverOpen ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ServerPanel, {
|
|
2455
|
+
serverInteractive && serverOpen ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ServerPanel, {
|
|
2382
2456
|
servers,
|
|
2383
2457
|
selectedKey: selectedServerKey,
|
|
2384
2458
|
selectedServer,
|
|
@@ -2399,7 +2473,6 @@ function EndpointIdentity(arg0) {
|
|
|
2399
2473
|
}
|
|
2400
2474
|
function OpenApiOperation(arg0) {
|
|
2401
2475
|
const { spec, path, method, operation } = arg0;
|
|
2402
|
-
const t = require_shell.useBuiltInText();
|
|
2403
2476
|
const id = (0, github_slugger.slug)(`${method.toLowerCase()} ${path}`);
|
|
2404
2477
|
const summary = operation.summary ?? `${method} ${path}`;
|
|
2405
2478
|
const description = operation.description;
|
|
@@ -2433,6 +2506,10 @@ function OpenApiOperation(arg0) {
|
|
|
2433
2506
|
className: "clarify-api-endpoint scroll-mt-24 py-16 first:pt-0 last:pb-0",
|
|
2434
2507
|
"aria-labelledby": id,
|
|
2435
2508
|
children: [
|
|
2509
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Heading, {
|
|
2510
|
+
id,
|
|
2511
|
+
children: summary
|
|
2512
|
+
}),
|
|
2436
2513
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(EndpointIdentity, {
|
|
2437
2514
|
method,
|
|
2438
2515
|
path,
|
|
@@ -2469,57 +2546,26 @@ function OpenApiOperation(arg0) {
|
|
|
2469
2546
|
[name]: value
|
|
2470
2547
|
}))
|
|
2471
2548
|
}),
|
|
2472
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2549
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(EndpointRequest, {
|
|
2550
|
+
spec,
|
|
2551
|
+
path,
|
|
2552
|
+
method,
|
|
2553
|
+
description,
|
|
2554
|
+
groupedParameters,
|
|
2555
|
+
parameters,
|
|
2556
|
+
requestBody,
|
|
2557
|
+
requestContents,
|
|
2558
|
+
requestSchema,
|
|
2559
|
+
selectedRequestMediaType: selectedRequestContent?.mediaType ?? "",
|
|
2560
|
+
onSelectRequestMediaType: setSelectedRequestMediaType,
|
|
2561
|
+
selectedServer,
|
|
2562
|
+
serverVariables,
|
|
2563
|
+
auth: authInput
|
|
2476
2564
|
}),
|
|
2477
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
}) : null,
|
|
2482
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ParameterList, {
|
|
2483
|
-
title: t("openapi.pathParameters"),
|
|
2484
|
-
parameters: groupedParameters.path
|
|
2485
|
-
}),
|
|
2486
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ParameterList, {
|
|
2487
|
-
title: t("openapi.queryParameters"),
|
|
2488
|
-
parameters: groupedParameters.query
|
|
2489
|
-
}),
|
|
2490
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ParameterList, {
|
|
2491
|
-
title: t("openapi.headers"),
|
|
2492
|
-
parameters: groupedParameters.header
|
|
2493
|
-
}),
|
|
2494
|
-
requestBody && requestContents.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
2495
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: t("openapi.requestBody") }),
|
|
2496
|
-
typeof requestBody.description === "string" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, { children: requestBody.description }) : null,
|
|
2497
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SchemaProperties, {
|
|
2498
|
-
title: t("openapi.bodyProperties"),
|
|
2499
|
-
schema: requestSchema,
|
|
2500
|
-
spec
|
|
2501
|
-
})
|
|
2502
|
-
] }) : null,
|
|
2503
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResponseList, {
|
|
2504
|
-
operation,
|
|
2505
|
-
spec
|
|
2506
|
-
})
|
|
2507
|
-
] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Col, {
|
|
2508
|
-
sticky: true,
|
|
2509
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EndpointExamples, {
|
|
2510
|
-
spec,
|
|
2511
|
-
path,
|
|
2512
|
-
method,
|
|
2513
|
-
operation,
|
|
2514
|
-
parameters,
|
|
2515
|
-
requestContents,
|
|
2516
|
-
selectedRequestMediaType: selectedRequestContent?.mediaType ?? "",
|
|
2517
|
-
onSelectRequestMediaType: setSelectedRequestMediaType,
|
|
2518
|
-
selectedServer,
|
|
2519
|
-
serverVariables,
|
|
2520
|
-
auth: authInput
|
|
2521
|
-
})
|
|
2522
|
-
})] })
|
|
2565
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(EndpointResponse, {
|
|
2566
|
+
spec,
|
|
2567
|
+
operation
|
|
2568
|
+
})
|
|
2523
2569
|
]
|
|
2524
2570
|
});
|
|
2525
2571
|
}
|
|
@@ -2699,4 +2745,4 @@ Object.defineProperty(exports, "primitives_exports", {
|
|
|
2699
2745
|
}
|
|
2700
2746
|
});
|
|
2701
2747
|
|
|
2702
|
-
//# sourceMappingURL=OpenApiOperation-
|
|
2748
|
+
//# sourceMappingURL=OpenApiOperation-BcyW_ULy.cjs.map
|