@clarify-labs/renderer 0.7.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/output/{ThemeRoot-CLa0yvRQ.js → ClarifyShell-BxB_6Uhd.js} +292 -141
  2. package/output/ClarifyShell-BxB_6Uhd.js.map +1 -0
  3. package/output/{ThemeRoot-DYS-lcK-.cjs → ClarifyShell-DNN5erFD.cjs} +320 -145
  4. package/output/ClarifyShell-DNN5erFD.cjs.map +1 -0
  5. package/output/{OpenApiOperation-C4xZu4i0.cjs → OpenApiOperation-9SvCA_B4.cjs} +327 -83
  6. package/output/OpenApiOperation-9SvCA_B4.cjs.map +1 -0
  7. package/output/{OpenApiOperation-LIL7bqxW.js → OpenApiOperation-J41rHO2l.js} +323 -85
  8. package/output/OpenApiOperation-J41rHO2l.js.map +1 -0
  9. package/output/{PageActions-yoDRjkq8.js → PageActions-DR0asnKH.js} +30 -69
  10. package/output/PageActions-DR0asnKH.js.map +1 -0
  11. package/output/{PageActions-1RDCHcUY.cjs → PageActions-yycPlNyL.cjs} +35 -68
  12. package/output/PageActions-yycPlNyL.cjs.map +1 -0
  13. package/output/app/AppShell.d.ts +2 -3
  14. package/output/app/PageBanner.d.ts +0 -2
  15. package/output/app/PageFooter.d.ts +1 -5
  16. package/output/client.cjs +8 -8
  17. package/output/client.js +3 -3
  18. package/output/components/Code.d.ts +5 -1
  19. package/output/components/Mermaid.d.ts +7 -0
  20. package/output/components/index.d.ts +1 -0
  21. package/output/context.d.ts +1 -1
  22. package/output/core/i18n.d.ts +1 -1
  23. package/output/core/types.d.ts +7 -14
  24. package/output/index.cjs +27 -24
  25. package/output/index.cjs.map +1 -1
  26. package/output/index.d.ts +7 -4
  27. package/output/index.js +14 -14
  28. package/output/index.js.map +1 -1
  29. package/output/mdx/components.d.ts +4 -0
  30. package/output/mdx/primitives.d.ts +2 -0
  31. package/output/openapi/components/EndpointSections.d.ts +30 -0
  32. package/output/preview.cjs +2 -2
  33. package/output/preview.cjs.map +1 -1
  34. package/output/preview.js +2 -2
  35. package/output/preview.js.map +1 -1
  36. package/output/{render-CRTqZzyY.cjs → render-CWvm77UW.cjs} +10 -20
  37. package/output/render-CWvm77UW.cjs.map +1 -0
  38. package/output/{render-D0ls3d2j.js → render-mGozubG5.js} +10 -20
  39. package/output/render-mGozubG5.js.map +1 -0
  40. package/output/renderer.css +83 -24
  41. package/output/runtime/ClarifyShell.d.ts +22 -0
  42. package/output/server.cjs +10 -19
  43. package/output/server.cjs.map +1 -1
  44. package/output/server.js +10 -19
  45. package/output/server.js.map +1 -1
  46. package/output/shell/search/pagefind.d.ts +0 -1
  47. package/output/slots/RuntimeSlot.d.ts +58 -0
  48. package/output/slots/context.d.ts +20 -0
  49. package/output/slots/index.d.ts +5 -0
  50. package/output/slots/types.d.ts +50 -0
  51. package/output/utils/localized-text.d.ts +7 -0
  52. package/package.json +8 -3
  53. package/output/OpenApiOperation-C4xZu4i0.cjs.map +0 -1
  54. package/output/OpenApiOperation-LIL7bqxW.js.map +0 -1
  55. package/output/PageActions-1RDCHcUY.cjs.map +0 -1
  56. package/output/PageActions-yoDRjkq8.js.map +0 -1
  57. package/output/ThemeRoot-CLa0yvRQ.js.map +0 -1
  58. package/output/ThemeRoot-DYS-lcK-.cjs.map +0 -1
  59. package/output/render-CRTqZzyY.cjs.map +0 -1
  60. package/output/render-D0ls3d2j.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-DakpK96I.cjs");
2
- const require_PageActions = require("./PageActions-1RDCHcUY.cjs");
2
+ const require_PageActions = require("./PageActions-yycPlNyL.cjs");
3
3
  const require_remark = require("./remark-Dv3owbSH.cjs");
4
4
  let clsx = require("clsx");
5
5
  clsx = require_chunk.__toESM(clsx, 1);
@@ -10,6 +10,7 @@ let lucide_react = require("lucide-react");
10
10
  let react_jsx_runtime = require("react/jsx-runtime");
11
11
  let framer_motion = require("framer-motion");
12
12
  let zustand = require("zustand");
13
+ let react_zoom_pan_pinch = require("react-zoom-pan-pinch");
13
14
  let react_markdown = require("react-markdown");
14
15
  react_markdown = require_chunk.__toESM(react_markdown, 1);
15
16
  let github_slugger = require("github-slugger");
@@ -198,6 +199,166 @@ function Card(arg0) {
198
199
  });
199
200
  }
200
201
  //#endregion
202
+ //#region source/components/Mermaid.tsx
203
+ var mermaidModulePromise;
204
+ async function loadMermaid() {
205
+ mermaidModulePromise = mermaidModulePromise ?? import("mermaid").then((module) => module.default);
206
+ return mermaidModulePromise;
207
+ }
208
+ function ZoomControls() {
209
+ const { zoomIn, zoomOut, resetTransform } = (0, react_zoom_pan_pinch.useControls)();
210
+ const t = require_PageActions.useBuiltInText();
211
+ const buttonClassName = "flex h-7 w-7 items-center justify-center rounded-md bg-(--clarify-theme-tokens-colors-surface) text-(--clarify-ui-text-soft) shadow-xs ring-1 ring-(--clarify-theme-tokens-colors-border) transition hover:bg-(--clarify-ui-hover-background) hover:text-(--clarify-theme-tokens-colors-foreground)";
212
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
213
+ className: "clarify-mermaid-controls absolute top-2 right-2 z-10 flex gap-1 opacity-0 transition group-hover:opacity-100 focus-within:opacity-100",
214
+ children: [
215
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
216
+ type: "button",
217
+ "aria-label": t("mermaid.zoomIn"),
218
+ title: t("mermaid.zoomIn"),
219
+ onClick: () => zoomIn(),
220
+ className: buttonClassName,
221
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ZoomIn, {
222
+ className: "h-4 w-4",
223
+ "aria-hidden": "true"
224
+ })
225
+ }),
226
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
227
+ type: "button",
228
+ "aria-label": t("mermaid.zoomOut"),
229
+ title: t("mermaid.zoomOut"),
230
+ onClick: () => zoomOut(),
231
+ className: buttonClassName,
232
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ZoomOut, {
233
+ className: "h-4 w-4",
234
+ "aria-hidden": "true"
235
+ })
236
+ }),
237
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
238
+ type: "button",
239
+ "aria-label": t("mermaid.resetZoom"),
240
+ title: t("mermaid.resetZoom"),
241
+ onClick: () => resetTransform(),
242
+ className: buttonClassName,
243
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Maximize2, {
244
+ className: "h-4 w-4",
245
+ "aria-hidden": "true"
246
+ })
247
+ })
248
+ ]
249
+ });
250
+ }
251
+ function Mermaid(arg0) {
252
+ const { chart, className } = arg0;
253
+ const t = require_PageActions.useBuiltInText();
254
+ const { resolvedTheme } = require_PageActions.useTheme();
255
+ const renderId = `clarify-mermaid-${(0, react.useId)().replace(/[^a-zA-Z0-9]/g, "")}`;
256
+ const containerRef = (0, react.useRef)(null);
257
+ const [svg, setSvg] = (0, react.useState)("");
258
+ const [error, setError] = (0, react.useState)(void 0);
259
+ const [focused, setFocused] = (0, react.useState)(false);
260
+ (0, react.useEffect)(() => {
261
+ let cancelled = false;
262
+ async function renderChart() {
263
+ const source = chart.trim();
264
+ if (!source) {
265
+ setSvg("");
266
+ setError(void 0);
267
+ return;
268
+ }
269
+ try {
270
+ const mermaid = await loadMermaid();
271
+ mermaid.initialize({
272
+ startOnLoad: false,
273
+ securityLevel: "strict",
274
+ theme: resolvedTheme === "dark" ? "dark" : "default",
275
+ fontFamily: "inherit"
276
+ });
277
+ const { svg: renderedSvg } = await mermaid.render(renderId, source);
278
+ if (!cancelled) {
279
+ setSvg(renderedSvg);
280
+ setError(void 0);
281
+ }
282
+ } catch (renderError) {
283
+ if (!cancelled) {
284
+ setSvg("");
285
+ setError(renderError instanceof Error ? renderError.message : String(renderError));
286
+ }
287
+ }
288
+ }
289
+ renderChart();
290
+ return () => {
291
+ cancelled = true;
292
+ };
293
+ }, [
294
+ chart,
295
+ renderId,
296
+ resolvedTheme
297
+ ]);
298
+ if (error) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
299
+ className: (0, clsx.default)("clarify-mermaid clarify-mermaid-error my-6 overflow-x-auto rounded-2xl border border-(--clarify-ui-accent-border) bg-(--clarify-ui-accent-background) p-4", className),
300
+ children: [
301
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
302
+ className: "text-sm font-semibold text-(--clarify-error-accent-text)",
303
+ children: t("mermaid.renderError")
304
+ }),
305
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
306
+ className: "mt-2 text-xs whitespace-pre-wrap text-(--clarify-ui-text-soft)",
307
+ children: error
308
+ }),
309
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
310
+ className: "mt-2 text-xs whitespace-pre-wrap text-(--clarify-ui-text-faint)",
311
+ children: chart.trim()
312
+ })
313
+ ]
314
+ });
315
+ if (!svg) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
316
+ className: (0, clsx.default)("clarify-mermaid clarify-mermaid-loading not-prose my-6 overflow-x-auto rounded-2xl border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) p-4", className),
317
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
318
+ className: "text-xs text-(--clarify-ui-text-soft)",
319
+ children: chart.trim()
320
+ })
321
+ });
322
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
323
+ ref: containerRef,
324
+ tabIndex: 0,
325
+ role: "group",
326
+ onPointerDown: () => containerRef.current?.focus(),
327
+ onFocus: () => setFocused(true),
328
+ onBlur: () => setFocused(false),
329
+ className: (0, clsx.default)("clarify-mermaid group not-prose relative my-6 overflow-hidden rounded-2xl border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary)", className),
330
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_zoom_pan_pinch.TransformWrapper, {
331
+ minScale: .5,
332
+ maxScale: 8,
333
+ initialScale: 1,
334
+ centerOnInit: true,
335
+ smooth: true,
336
+ wheel: {
337
+ step: .05,
338
+ wheelDisabled: !focused,
339
+ touchPadDisabled: !focused
340
+ },
341
+ doubleClick: { mode: "reset" },
342
+ children: [
343
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ZoomControls, {}),
344
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_zoom_pan_pinch.TransformComponent, {
345
+ wrapperClass: "!w-full !cursor-grab active:!cursor-grabbing",
346
+ contentClass: "!w-full justify-center [&_svg]:h-auto [&_svg]:max-w-full",
347
+ wrapperStyle: { height: "min(70vh, 32rem)" },
348
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
349
+ className: "flex h-full w-full items-center justify-center p-4",
350
+ dangerouslySetInnerHTML: { __html: svg }
351
+ })
352
+ }),
353
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
354
+ className: (0, clsx.default)("clarify-mermaid-hint pointer-events-none absolute bottom-2 left-1/2 z-10 -translate-x-1/2 rounded-full bg-(--clarify-theme-tokens-colors-surface)/90 px-2.5 py-1 text-2xs text-(--clarify-ui-text-soft) shadow-xs ring-1 ring-(--clarify-theme-tokens-colors-border) backdrop-blur-sm transition", focused ? "opacity-0" : "opacity-0 group-hover:opacity-100"),
355
+ children: t("mermaid.scrollHint")
356
+ })
357
+ ]
358
+ })
359
+ });
360
+ }
361
+ //#endregion
201
362
  //#region source/components/Code.tsx
202
363
  var languageNames = {
203
364
  js: "JavaScript",
@@ -419,8 +580,10 @@ function Code(arg0) {
419
580
  });
420
581
  }
421
582
  function Pre(arg0) {
422
- const { children, ...props } = arg0;
423
- if ((0, react.useContext)(CodeGroupContext)) return children;
583
+ const { children, language, code, ...props } = arg0;
584
+ const isGrouped = (0, react.useContext)(CodeGroupContext);
585
+ if (language === "mermaid") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Mermaid, { chart: code ?? getNodeText(children) });
586
+ if (isGrouped) return children;
424
587
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodeGroup, {
425
588
  ...props,
426
589
  children
@@ -738,7 +901,7 @@ function HeroPattern() {
738
901
  function Prose(arg0) {
739
902
  const { as, className, ...props } = arg0;
740
903
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(as ?? "div", {
741
- className: (0, clsx.default)(className, "clarify-prose prose max-w-none dark:prose-invert", "[html_:where(&>*)]:w-full [html_:where(&>*)]:min-w-0 [html_:where(&>*)]:max-w-full"),
904
+ className: (0, clsx.default)(className, "clarify-prose prose max-w-none min-w-0 dark:prose-invert wrap-break-word", "[html_:where(&>*)]:w-full [html_:where(&>*)]:min-w-0 [html_:where(&>*)]:max-w-full"),
742
905
  ...props
743
906
  });
744
907
  }
@@ -813,18 +976,29 @@ var primitives_exports = /* @__PURE__ */ require_chunk.__exportAll({
813
976
  h2: () => h2,
814
977
  h3: () => h3,
815
978
  pre: () => pre,
979
+ table: () => table,
816
980
  wrapper: () => wrapper
817
981
  });
818
982
  function wrapper(arg0) {
819
983
  const { children } = arg0;
820
984
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("article", {
821
- className: "clarify-mdx-page flex h-full flex-col pt-14 pb-10",
985
+ className: "clarify-mdx-page flex h-full min-w-0 flex-col pt-14 pb-10",
822
986
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Prose, {
823
987
  className: "flex-auto",
824
988
  children
825
989
  })
826
990
  });
827
991
  }
992
+ function table(arg0) {
993
+ const { className, ...props } = arg0;
994
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
995
+ className: "overflow-x-auto",
996
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("table", {
997
+ className,
998
+ ...props
999
+ })
1000
+ });
1001
+ }
828
1002
  function a(arg0) {
829
1003
  const { href = "", ...props } = arg0;
830
1004
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LocalizedLink, {
@@ -868,16 +1042,16 @@ function Note(arg0) {
868
1042
  });
869
1043
  }
870
1044
  function Row(arg0) {
871
- const { children } = arg0;
1045
+ const { children, className } = arg0;
872
1046
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
873
- className: "clarify-row grid grid-cols-1 items-start gap-x-8 gap-y-10 xl:max-w-none xl:grid-cols-2",
1047
+ 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),
874
1048
  children
875
1049
  });
876
1050
  }
877
1051
  function Col(arg0) {
878
1052
  const { children, sticky = false } = arg0;
879
1053
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
880
- className: (0, clsx.default)("clarify-col *:first:mt-0 *:last:mb-0", sticky && "xl:sticky xl:top-24"),
1054
+ 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"),
881
1055
  children
882
1056
  });
883
1057
  }
@@ -928,6 +1102,23 @@ function Property(arg0) {
928
1102
  }
929
1103
  //#endregion
930
1104
  //#region source/mdx/Markdown.tsx
1105
+ function getMermaidChart(children) {
1106
+ if (!(0, react.isValidElement)(children)) return void 0;
1107
+ const props = children.props;
1108
+ const className = typeof props.className === "string" ? props.className : "";
1109
+ if (!/\blanguage-mermaid\b/.test(className)) return void 0;
1110
+ return typeof props.children === "string" ? props.children : void 0;
1111
+ }
1112
+ function MarkdownTable(arg0) {
1113
+ const { className, ...props } = arg0;
1114
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1115
+ className: "overflow-x-auto",
1116
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("table", {
1117
+ className,
1118
+ ...props
1119
+ })
1120
+ });
1121
+ }
931
1122
  var markdownComponents = {
932
1123
  a(props) {
933
1124
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(a, { ...props });
@@ -937,10 +1128,15 @@ var markdownComponents = {
937
1128
  },
938
1129
  pre(arg0) {
939
1130
  const { children, ...props } = arg0;
1131
+ const chart = getMermaidChart(children);
1132
+ if (chart !== void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Mermaid, { chart });
940
1133
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(pre, {
941
1134
  ...props,
942
1135
  children
943
1136
  });
1137
+ },
1138
+ table(props) {
1139
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkdownTable, { ...props });
944
1140
  }
945
1141
  };
946
1142
  function Markdown(arg0) {
@@ -2051,7 +2247,10 @@ function SchemaNode(arg0) {
2051
2247
  }) : null]
2052
2248
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2053
2249
  className: "mt-0.5 text-sm/5 text-(--clarify-ui-text-soft) *:first:mt-0 *:last:mb-0",
2054
- children: [node.description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, { children: node.description }) : fallbackDescription, node.details ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2250
+ children: [node.description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, {
2251
+ className: "*:first:mt-0 *:last:mb-0",
2252
+ children: node.description
2253
+ }) : fallbackDescription, node.details ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2055
2254
  className: "text-xs text-(--clarify-ui-text-faint)",
2056
2255
  children: node.details
2057
2256
  }) : null]
@@ -2107,7 +2306,10 @@ function ParameterList(arg0) {
2107
2306
  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, {
2108
2307
  name: parameter.name ?? t("openapi.parameter"),
2109
2308
  type: [schemaToType(parameter.schema), parameter.required ? t("openapi.requiredBadge") : void 0].filter(Boolean).join(", ") || void 0,
2110
- children: parameter.description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, { children: parameter.description }) : t("openapi.operationParameter")
2309
+ children: parameter.description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, {
2310
+ className: "*:first:mt-0 *:last:mb-0",
2311
+ children: parameter.description
2312
+ }) : t("openapi.operationParameter")
2111
2313
  }, `${parameter.in}-${parameter.name}`)) })] });
2112
2314
  }
2113
2315
  function ResponseList(arg0) {
@@ -2119,33 +2321,78 @@ function ResponseList(arg0) {
2119
2321
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Property, {
2120
2322
  name: status,
2121
2323
  type: schemaToType(getJsonLikeContent(response.content, spec)?.value.schema),
2122
- children: response.description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, { children: response.description }) : `${t("openapi.response")}.`
2324
+ children: response.description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, {
2325
+ className: "*:first:mt-0 *:last:mb-0",
2326
+ children: response.description
2327
+ }) : `${t("openapi.response")}.`
2123
2328
  }, status);
2124
2329
  }) })] });
2125
2330
  }
2126
2331
  //#endregion
2127
- //#region source/openapi/components/OpenApiOperation.tsx
2128
- function EndpointExamples(arg0) {
2129
- const { spec, path, method, operation, parameters, requestContents, selectedRequestMediaType, onSelectRequestMediaType, selectedServer, serverVariables, auth } = arg0;
2130
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2131
- className: "space-y-6",
2132
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(RequestExamplesPanel, {
2133
- spec,
2134
- path,
2135
- method,
2136
- parameters,
2137
- requestContents,
2138
- selectedMediaType: selectedRequestMediaType,
2139
- onSelectMediaType: onSelectRequestMediaType,
2140
- selectedServer,
2141
- serverVariables,
2142
- auth
2143
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResponseExamplesPanel, {
2332
+ //#region source/openapi/components/EndpointSections.tsx
2333
+ function EndpointRequest(arg0) {
2334
+ const { spec, path, method, description, groupedParameters, parameters, requestBody, requestContents, requestSchema, selectedRequestMediaType, onSelectRequestMediaType, selectedServer, serverVariables, auth } = arg0;
2335
+ const t = require_PageActions.useBuiltInText();
2336
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Row, {
2337
+ className: "relative mt-6",
2338
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Col, { children: [
2339
+ description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, { children: description }) : null,
2340
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ParameterList, {
2341
+ title: t("openapi.pathParameters"),
2342
+ parameters: groupedParameters.path
2343
+ }),
2344
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ParameterList, {
2345
+ title: t("openapi.queryParameters"),
2346
+ parameters: groupedParameters.query
2347
+ }),
2348
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ParameterList, {
2349
+ title: t("openapi.headers"),
2350
+ parameters: groupedParameters.header
2351
+ }),
2352
+ requestBody && requestContents.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
2353
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: t("openapi.requestBody") }),
2354
+ typeof requestBody.description === "string" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, { children: requestBody.description }) : null,
2355
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SchemaProperties, {
2356
+ title: t("openapi.bodyProperties"),
2357
+ schema: requestSchema,
2358
+ spec
2359
+ })
2360
+ ] }) : null
2361
+ ] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Col, {
2362
+ sticky: true,
2363
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RequestExamplesPanel, {
2364
+ spec,
2365
+ path,
2366
+ method,
2367
+ parameters,
2368
+ requestContents,
2369
+ selectedMediaType: selectedRequestMediaType,
2370
+ onSelectMediaType: onSelectRequestMediaType,
2371
+ selectedServer,
2372
+ serverVariables,
2373
+ auth
2374
+ })
2375
+ })]
2376
+ });
2377
+ }
2378
+ function EndpointResponse(arg0) {
2379
+ const { spec, operation } = arg0;
2380
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Row, {
2381
+ className: "relative mt-6",
2382
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Col, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResponseList, {
2144
2383
  operation,
2145
2384
  spec
2385
+ }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Col, {
2386
+ sticky: true,
2387
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResponseExamplesPanel, {
2388
+ operation,
2389
+ spec
2390
+ })
2146
2391
  })]
2147
2392
  });
2148
2393
  }
2394
+ //#endregion
2395
+ //#region source/openapi/components/OpenApiOperation.tsx
2149
2396
  var endpointMethodStyles = {
2150
2397
  GET: "bg-emerald-400/15 text-emerald-600 dark:bg-emerald-400/20 dark:text-emerald-300",
2151
2398
  POST: "bg-sky-400/15 text-sky-600 dark:bg-sky-400/20 dark:text-sky-300",
@@ -2206,8 +2453,25 @@ function getServerPreviewUrl(server, variables) {
2206
2453
  return (server.url ?? "").replace(/\{([^}]+)\}/g, (_, name) => variables[name] ?? server.variables?.[name]?.default ?? `{${name}}`);
2207
2454
  }
2208
2455
  function ServerUrlValue(arg0) {
2209
- const { server, variables, open, onToggle } = arg0;
2456
+ const { server, variables, open, interactive, onToggle } = arg0;
2210
2457
  const url = getServerPreviewUrl(server, variables);
2458
+ if (!interactive) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2459
+ "aria-label": "Server",
2460
+ 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",
2461
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2462
+ className: "sm:hidden",
2463
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ServerIcon, {
2464
+ className: "h-4 w-4",
2465
+ "aria-hidden": "true"
2466
+ })
2467
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2468
+ className: "hidden min-w-0 items-center overflow-hidden sm:flex",
2469
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2470
+ className: "truncate font-semibold text-xs",
2471
+ children: url
2472
+ })
2473
+ })]
2474
+ });
2211
2475
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
2212
2476
  type: "button",
2213
2477
  "aria-expanded": open,
@@ -2334,6 +2598,7 @@ function AuthPanel(arg0) {
2334
2598
  function EndpointIdentity(arg0) {
2335
2599
  const { method, path, servers, selectedServerKey, selectedServer, serverVariables, serverOpen, authOptions, selectedAuthName, selectedAuth, authValues, authOpen, onSelectServer, onChangeServerVariable, onToggleServer, onToggleAuth, onSelectAuth, onChangeAuthValue } = arg0;
2336
2600
  const segments = path.split("/").filter(Boolean);
2601
+ const serverInteractive = servers.length > 1 || Object.keys(selectedServer.variables ?? {}).length > 0;
2337
2602
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2338
2603
  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",
2339
2604
  children: [
@@ -2345,6 +2610,7 @@ function EndpointIdentity(arg0) {
2345
2610
  server: selectedServer,
2346
2611
  variables: serverVariables,
2347
2612
  open: serverOpen,
2613
+ interactive: serverInteractive,
2348
2614
  onToggle: onToggleServer
2349
2615
  }),
2350
2616
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -2382,7 +2648,7 @@ function EndpointIdentity(arg0) {
2382
2648
  }) : null
2383
2649
  ]
2384
2650
  }),
2385
- serverOpen ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ServerPanel, {
2651
+ serverInteractive && serverOpen ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ServerPanel, {
2386
2652
  servers,
2387
2653
  selectedKey: selectedServerKey,
2388
2654
  selectedServer,
@@ -2403,7 +2669,6 @@ function EndpointIdentity(arg0) {
2403
2669
  }
2404
2670
  function OpenApiOperation(arg0) {
2405
2671
  const { spec, path, method, operation } = arg0;
2406
- const t = require_PageActions.useBuiltInText();
2407
2672
  const id = (0, github_slugger.slug)(`${method.toLowerCase()} ${path}`);
2408
2673
  const summary = operation.summary ?? `${method} ${path}`;
2409
2674
  const description = operation.description;
@@ -2434,9 +2699,13 @@ function OpenApiOperation(arg0) {
2434
2699
  header: parameters.filter((parameter) => parameter.in === "header")
2435
2700
  };
2436
2701
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
2437
- className: "clarify-api-endpoint scroll-mt-24 py-16 first:pt-0 last:pb-0",
2702
+ className: "clarify-api-endpoint scroll-mt-24 pb-16 first:pt-0 last:pb-0",
2438
2703
  "aria-labelledby": id,
2439
2704
  children: [
2705
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Heading, {
2706
+ id,
2707
+ children: summary
2708
+ }),
2440
2709
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EndpointIdentity, {
2441
2710
  method,
2442
2711
  path,
@@ -2473,57 +2742,26 @@ function OpenApiOperation(arg0) {
2473
2742
  [name]: value
2474
2743
  }))
2475
2744
  }),
2476
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Heading, {
2477
- id,
2478
- className: "mt-6",
2479
- children: summary
2745
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EndpointRequest, {
2746
+ spec,
2747
+ path,
2748
+ method,
2749
+ description,
2750
+ groupedParameters,
2751
+ parameters,
2752
+ requestBody,
2753
+ requestContents,
2754
+ requestSchema,
2755
+ selectedRequestMediaType: selectedRequestContent?.mediaType ?? "",
2756
+ onSelectRequestMediaType: setSelectedRequestMediaType,
2757
+ selectedServer,
2758
+ serverVariables,
2759
+ auth: authInput
2480
2760
  }),
2481
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Row, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Col, { children: [
2482
- description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, {
2483
- className: "mt-4 *:first:mt-0 *:last:mb-0",
2484
- children: description
2485
- }) : null,
2486
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ParameterList, {
2487
- title: t("openapi.pathParameters"),
2488
- parameters: groupedParameters.path
2489
- }),
2490
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ParameterList, {
2491
- title: t("openapi.queryParameters"),
2492
- parameters: groupedParameters.query
2493
- }),
2494
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ParameterList, {
2495
- title: t("openapi.headers"),
2496
- parameters: groupedParameters.header
2497
- }),
2498
- requestBody && requestContents.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
2499
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: t("openapi.requestBody") }),
2500
- typeof requestBody.description === "string" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, { children: requestBody.description }) : null,
2501
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SchemaProperties, {
2502
- title: t("openapi.bodyProperties"),
2503
- schema: requestSchema,
2504
- spec
2505
- })
2506
- ] }) : null,
2507
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResponseList, {
2508
- operation,
2509
- spec
2510
- })
2511
- ] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Col, {
2512
- sticky: true,
2513
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EndpointExamples, {
2514
- spec,
2515
- path,
2516
- method,
2517
- operation,
2518
- parameters,
2519
- requestContents,
2520
- selectedRequestMediaType: selectedRequestContent?.mediaType ?? "",
2521
- onSelectRequestMediaType: setSelectedRequestMediaType,
2522
- selectedServer,
2523
- serverVariables,
2524
- auth: authInput
2525
- })
2526
- })] })
2761
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EndpointResponse, {
2762
+ spec,
2763
+ operation
2764
+ })
2527
2765
  ]
2528
2766
  });
2529
2767
  }
@@ -2612,6 +2850,12 @@ Object.defineProperty(exports, "Markdown", {
2612
2850
  return Markdown;
2613
2851
  }
2614
2852
  });
2853
+ Object.defineProperty(exports, "Mermaid", {
2854
+ enumerable: true,
2855
+ get: function() {
2856
+ return Mermaid;
2857
+ }
2858
+ });
2615
2859
  Object.defineProperty(exports, "OpenApiOperation", {
2616
2860
  enumerable: true,
2617
2861
  get: function() {
@@ -2703,4 +2947,4 @@ Object.defineProperty(exports, "primitives_exports", {
2703
2947
  }
2704
2948
  });
2705
2949
 
2706
- //# sourceMappingURL=OpenApiOperation-C4xZu4i0.cjs.map
2950
+ //# sourceMappingURL=OpenApiOperation-9SvCA_B4.cjs.map