@clarify-labs/renderer 0.7.2 → 0.8.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/{ThemeRoot-UWj0iK1X.cjs → ClarifyShell-B74Fq4UU.cjs} +389 -161
- package/output/ClarifyShell-B74Fq4UU.cjs.map +1 -0
- package/output/{ThemeRoot-QULrwQf6.js → ClarifyShell-BPv2bxI4.js} +361 -157
- package/output/ClarifyShell-BPv2bxI4.js.map +1 -0
- package/output/{OpenApiOperation-BcyW_ULy.cjs → OpenApiOperation-BMXfV15v.cjs} +209 -7
- package/output/OpenApiOperation-BMXfV15v.cjs.map +1 -0
- package/output/{OpenApiOperation-tUKf7lZ4.js → OpenApiOperation-fJ3QQOJX.js} +205 -9
- package/output/OpenApiOperation-fJ3QQOJX.js.map +1 -0
- package/output/{PageActions-yoDRjkq8.js → PageActions-BwY7ierv.js} +55 -81
- package/output/PageActions-BwY7ierv.js.map +1 -0
- package/output/{PageActions-1RDCHcUY.cjs → PageActions-DOKkt2zo.cjs} +59 -79
- package/output/PageActions-DOKkt2zo.cjs.map +1 -0
- package/output/app/AppShell.d.ts +2 -3
- package/output/app/PageBanner.d.ts +0 -2
- package/output/app/PageFooter.d.ts +1 -5
- package/output/client.cjs +8 -8
- package/output/client.js +3 -3
- package/output/components/Code.d.ts +5 -1
- package/output/components/Mermaid.d.ts +7 -0
- package/output/components/index.d.ts +1 -0
- package/output/context.d.ts +1 -1
- package/output/core/i18n.d.ts +1 -1
- package/output/core/types.d.ts +8 -14
- package/output/index.cjs +27 -24
- package/output/index.cjs.map +1 -1
- package/output/index.d.ts +7 -4
- package/output/index.js +14 -14
- package/output/index.js.map +1 -1
- package/output/mdx/components.d.ts +3 -0
- package/output/mdx/primitives.d.ts +1 -0
- package/output/preview.cjs +3 -2
- package/output/preview.cjs.map +1 -1
- package/output/preview.js +3 -2
- package/output/preview.js.map +1 -1
- package/output/{render-psutGbsg.js → render-Cghgq1AQ.js} +10 -20
- package/output/render-Cghgq1AQ.js.map +1 -0
- package/output/{render-ByWbJbrA.cjs → render-ZSckbg74.cjs} +10 -20
- package/output/render-ZSckbg74.cjs.map +1 -0
- package/output/renderer.css +77 -21
- package/output/runtime/ClarifyShell.d.ts +22 -0
- package/output/server.cjs +10 -19
- package/output/server.cjs.map +1 -1
- package/output/server.js +10 -19
- package/output/server.js.map +1 -1
- package/output/shell/search/pagefind.d.ts +0 -1
- package/output/slots/RuntimeSlot.d.ts +58 -0
- package/output/slots/context.d.ts +20 -0
- package/output/slots/index.d.ts +5 -0
- package/output/slots/types.d.ts +50 -0
- package/output/utils/localized-text.d.ts +7 -0
- package/package.json +8 -3
- package/output/OpenApiOperation-BcyW_ULy.cjs.map +0 -1
- package/output/OpenApiOperation-tUKf7lZ4.js.map +0 -1
- package/output/PageActions-1RDCHcUY.cjs.map +0 -1
- package/output/PageActions-yoDRjkq8.js.map +0 -1
- package/output/ThemeRoot-QULrwQf6.js.map +0 -1
- package/output/ThemeRoot-UWj0iK1X.cjs.map +0 -1
- package/output/render-ByWbJbrA.cjs.map +0 -1
- package/output/render-psutGbsg.js.map +0 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D as copyTextToClipboard, M as useConfig, N as useLocale, O as useBuiltInText, T as localizeHref, c as remToPx, g as useTheme, l as lucideIconRegistry, n as PageTitleActions, s as useSectionStore, u as resolveLucideIconName, w as isExternalHref } from "./PageActions-BwY7ierv.js";
|
|
2
2
|
import { t as markdownRemarkPlugins } from "./remark-Dd2WU50s.js";
|
|
3
3
|
import clsx from "clsx";
|
|
4
4
|
import { Children, createContext, createElement, forwardRef, isValidElement, useContext, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
5
5
|
import { Link } from "react-router-dom";
|
|
6
6
|
import { Listbox, ListboxButton, ListboxOption, ListboxOptions, Tab, TabGroup, TabList, TabPanel, TabPanels, Transition } from "@headlessui/react";
|
|
7
|
-
import { AlertTriangle, ArrowRight, Check, CheckCircle2, CheckIcon, ChevronDown, ChevronDownIcon, ChevronRight, ChevronsUpDownIcon, CircleCheck, Clipboard, ClipboardIcon, CodeIcon, Info, Lightbulb, LinkIcon, LockKeyholeIcon, PackageIcon, ServerIcon, UnlockKeyholeIcon, XCircle } from "lucide-react";
|
|
7
|
+
import { AlertTriangle, ArrowRight, Check, CheckCircle2, CheckIcon, ChevronDown, ChevronDownIcon, ChevronRight, ChevronsUpDownIcon, CircleCheck, Clipboard, ClipboardIcon, CodeIcon, Info, Lightbulb, LinkIcon, LockKeyholeIcon, Maximize2, PackageIcon, ServerIcon, UnlockKeyholeIcon, XCircle, ZoomIn, ZoomOut } from "lucide-react";
|
|
8
8
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { useInView } from "framer-motion";
|
|
10
10
|
import { create } from "zustand";
|
|
11
|
+
import { TransformComponent, TransformWrapper, useControls } from "react-zoom-pan-pinch";
|
|
11
12
|
import ReactMarkdown from "react-markdown";
|
|
12
13
|
import { slug } from "github-slugger";
|
|
13
14
|
import { snippetz } from "@scalar/snippetz";
|
|
@@ -207,6 +208,166 @@ function Card(arg0) {
|
|
|
207
208
|
});
|
|
208
209
|
}
|
|
209
210
|
//#endregion
|
|
211
|
+
//#region source/components/Mermaid.tsx
|
|
212
|
+
var mermaidModulePromise;
|
|
213
|
+
async function loadMermaid() {
|
|
214
|
+
mermaidModulePromise = mermaidModulePromise ?? import("mermaid").then((module) => module.default);
|
|
215
|
+
return mermaidModulePromise;
|
|
216
|
+
}
|
|
217
|
+
function ZoomControls() {
|
|
218
|
+
const { zoomIn, zoomOut, resetTransform } = useControls();
|
|
219
|
+
const t = useBuiltInText();
|
|
220
|
+
const buttonClassName = "flex h-7 w-7 items-center justify-center rounded-md bg-(--clarify-theme-tokens-colors-surface) text-(--clarify-ui-text-soft) shadow-xs ring-1 ring-(--clarify-theme-tokens-colors-border) transition hover:bg-(--clarify-ui-hover-background) hover:text-(--clarify-theme-tokens-colors-foreground)";
|
|
221
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
222
|
+
className: "clarify-mermaid-controls absolute top-2 right-2 z-10 flex gap-1 opacity-0 transition group-hover:opacity-100 focus-within:opacity-100",
|
|
223
|
+
children: [
|
|
224
|
+
/* @__PURE__ */ jsx("button", {
|
|
225
|
+
type: "button",
|
|
226
|
+
"aria-label": t("mermaid.zoomIn"),
|
|
227
|
+
title: t("mermaid.zoomIn"),
|
|
228
|
+
onClick: () => zoomIn(),
|
|
229
|
+
className: buttonClassName,
|
|
230
|
+
children: /* @__PURE__ */ jsx(ZoomIn, {
|
|
231
|
+
className: "h-4 w-4",
|
|
232
|
+
"aria-hidden": "true"
|
|
233
|
+
})
|
|
234
|
+
}),
|
|
235
|
+
/* @__PURE__ */ jsx("button", {
|
|
236
|
+
type: "button",
|
|
237
|
+
"aria-label": t("mermaid.zoomOut"),
|
|
238
|
+
title: t("mermaid.zoomOut"),
|
|
239
|
+
onClick: () => zoomOut(),
|
|
240
|
+
className: buttonClassName,
|
|
241
|
+
children: /* @__PURE__ */ jsx(ZoomOut, {
|
|
242
|
+
className: "h-4 w-4",
|
|
243
|
+
"aria-hidden": "true"
|
|
244
|
+
})
|
|
245
|
+
}),
|
|
246
|
+
/* @__PURE__ */ jsx("button", {
|
|
247
|
+
type: "button",
|
|
248
|
+
"aria-label": t("mermaid.resetZoom"),
|
|
249
|
+
title: t("mermaid.resetZoom"),
|
|
250
|
+
onClick: () => resetTransform(),
|
|
251
|
+
className: buttonClassName,
|
|
252
|
+
children: /* @__PURE__ */ jsx(Maximize2, {
|
|
253
|
+
className: "h-4 w-4",
|
|
254
|
+
"aria-hidden": "true"
|
|
255
|
+
})
|
|
256
|
+
})
|
|
257
|
+
]
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
function Mermaid(arg0) {
|
|
261
|
+
const { chart, className } = arg0;
|
|
262
|
+
const t = useBuiltInText();
|
|
263
|
+
const { resolvedTheme } = useTheme();
|
|
264
|
+
const renderId = `clarify-mermaid-${useId().replace(/[^a-zA-Z0-9]/g, "")}`;
|
|
265
|
+
const containerRef = useRef(null);
|
|
266
|
+
const [svg, setSvg] = useState("");
|
|
267
|
+
const [error, setError] = useState(void 0);
|
|
268
|
+
const [focused, setFocused] = useState(false);
|
|
269
|
+
useEffect(() => {
|
|
270
|
+
let cancelled = false;
|
|
271
|
+
async function renderChart() {
|
|
272
|
+
const source = chart.trim();
|
|
273
|
+
if (!source) {
|
|
274
|
+
setSvg("");
|
|
275
|
+
setError(void 0);
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
try {
|
|
279
|
+
const mermaid = await loadMermaid();
|
|
280
|
+
mermaid.initialize({
|
|
281
|
+
startOnLoad: false,
|
|
282
|
+
securityLevel: "strict",
|
|
283
|
+
theme: resolvedTheme === "dark" ? "dark" : "default",
|
|
284
|
+
fontFamily: "inherit"
|
|
285
|
+
});
|
|
286
|
+
const { svg: renderedSvg } = await mermaid.render(renderId, source);
|
|
287
|
+
if (!cancelled) {
|
|
288
|
+
setSvg(renderedSvg);
|
|
289
|
+
setError(void 0);
|
|
290
|
+
}
|
|
291
|
+
} catch (renderError) {
|
|
292
|
+
if (!cancelled) {
|
|
293
|
+
setSvg("");
|
|
294
|
+
setError(renderError instanceof Error ? renderError.message : String(renderError));
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
renderChart();
|
|
299
|
+
return () => {
|
|
300
|
+
cancelled = true;
|
|
301
|
+
};
|
|
302
|
+
}, [
|
|
303
|
+
chart,
|
|
304
|
+
renderId,
|
|
305
|
+
resolvedTheme
|
|
306
|
+
]);
|
|
307
|
+
if (error) return /* @__PURE__ */ jsxs("div", {
|
|
308
|
+
className: clsx("clarify-mermaid clarify-mermaid-error my-6 overflow-x-auto rounded-2xl border border-(--clarify-ui-accent-border) bg-(--clarify-ui-accent-background) p-4", className),
|
|
309
|
+
children: [
|
|
310
|
+
/* @__PURE__ */ jsx("p", {
|
|
311
|
+
className: "text-sm font-semibold text-(--clarify-error-accent-text)",
|
|
312
|
+
children: t("mermaid.renderError")
|
|
313
|
+
}),
|
|
314
|
+
/* @__PURE__ */ jsx("pre", {
|
|
315
|
+
className: "mt-2 text-xs whitespace-pre-wrap text-(--clarify-ui-text-soft)",
|
|
316
|
+
children: error
|
|
317
|
+
}),
|
|
318
|
+
/* @__PURE__ */ jsx("pre", {
|
|
319
|
+
className: "mt-2 text-xs whitespace-pre-wrap text-(--clarify-ui-text-faint)",
|
|
320
|
+
children: chart.trim()
|
|
321
|
+
})
|
|
322
|
+
]
|
|
323
|
+
});
|
|
324
|
+
if (!svg) return /* @__PURE__ */ jsx("div", {
|
|
325
|
+
className: clsx("clarify-mermaid clarify-mermaid-loading not-prose my-6 overflow-x-auto rounded-2xl border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) p-4", className),
|
|
326
|
+
children: /* @__PURE__ */ jsx("pre", {
|
|
327
|
+
className: "text-xs text-(--clarify-ui-text-soft)",
|
|
328
|
+
children: chart.trim()
|
|
329
|
+
})
|
|
330
|
+
});
|
|
331
|
+
return /* @__PURE__ */ jsx("div", {
|
|
332
|
+
ref: containerRef,
|
|
333
|
+
tabIndex: 0,
|
|
334
|
+
role: "group",
|
|
335
|
+
onPointerDown: () => containerRef.current?.focus(),
|
|
336
|
+
onFocus: () => setFocused(true),
|
|
337
|
+
onBlur: () => setFocused(false),
|
|
338
|
+
className: clsx("clarify-mermaid group not-prose relative my-6 overflow-hidden rounded-2xl border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary)", className),
|
|
339
|
+
children: /* @__PURE__ */ jsxs(TransformWrapper, {
|
|
340
|
+
minScale: .5,
|
|
341
|
+
maxScale: 8,
|
|
342
|
+
initialScale: 1,
|
|
343
|
+
centerOnInit: true,
|
|
344
|
+
smooth: true,
|
|
345
|
+
wheel: {
|
|
346
|
+
step: .05,
|
|
347
|
+
wheelDisabled: !focused,
|
|
348
|
+
touchPadDisabled: !focused
|
|
349
|
+
},
|
|
350
|
+
doubleClick: { mode: "reset" },
|
|
351
|
+
children: [
|
|
352
|
+
/* @__PURE__ */ jsx(ZoomControls, {}),
|
|
353
|
+
/* @__PURE__ */ jsx(TransformComponent, {
|
|
354
|
+
wrapperClass: "!w-full !cursor-grab active:!cursor-grabbing",
|
|
355
|
+
contentClass: "!w-full justify-center [&_svg]:h-auto [&_svg]:max-w-full",
|
|
356
|
+
wrapperStyle: { height: "min(70vh, 32rem)" },
|
|
357
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
358
|
+
className: "flex h-full w-full items-center justify-center p-4",
|
|
359
|
+
dangerouslySetInnerHTML: { __html: svg }
|
|
360
|
+
})
|
|
361
|
+
}),
|
|
362
|
+
/* @__PURE__ */ jsx("p", {
|
|
363
|
+
className: clsx("clarify-mermaid-hint pointer-events-none absolute bottom-2 left-1/2 z-10 -translate-x-1/2 rounded-full bg-(--clarify-theme-tokens-colors-surface)/90 px-2.5 py-1 text-2xs text-(--clarify-ui-text-soft) shadow-xs ring-1 ring-(--clarify-theme-tokens-colors-border) backdrop-blur-sm transition", focused ? "opacity-0" : "opacity-0 group-hover:opacity-100"),
|
|
364
|
+
children: t("mermaid.scrollHint")
|
|
365
|
+
})
|
|
366
|
+
]
|
|
367
|
+
})
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
//#endregion
|
|
210
371
|
//#region source/components/Code.tsx
|
|
211
372
|
var languageNames = {
|
|
212
373
|
js: "JavaScript",
|
|
@@ -428,8 +589,10 @@ function Code(arg0) {
|
|
|
428
589
|
});
|
|
429
590
|
}
|
|
430
591
|
function Pre(arg0) {
|
|
431
|
-
const { children, ...props } = arg0;
|
|
432
|
-
|
|
592
|
+
const { children, language, code, ...props } = arg0;
|
|
593
|
+
const isGrouped = useContext(CodeGroupContext);
|
|
594
|
+
if (language === "mermaid") return /* @__PURE__ */ jsx(Mermaid, { chart: code ?? getNodeText(children) });
|
|
595
|
+
if (isGrouped) return children;
|
|
433
596
|
return /* @__PURE__ */ jsx(CodeGroup, {
|
|
434
597
|
...props,
|
|
435
598
|
children
|
|
@@ -747,7 +910,7 @@ function HeroPattern() {
|
|
|
747
910
|
function Prose(arg0) {
|
|
748
911
|
const { as, className, ...props } = arg0;
|
|
749
912
|
return /* @__PURE__ */ jsx(as ?? "div", {
|
|
750
|
-
className: clsx(className, "clarify-prose prose max-w-none dark:prose-invert", "[html_:where(&>*)]:w-full [html_:where(&>*)]:min-w-0 [html_:where(&>*)]:max-w-full"),
|
|
913
|
+
className: clsx(className, "clarify-prose prose max-w-none min-w-0 dark:prose-invert wrap-break-word", "[html_:where(&>*)]:w-full [html_:where(&>*)]:min-w-0 [html_:where(&>*)]:max-w-full"),
|
|
751
914
|
...props
|
|
752
915
|
});
|
|
753
916
|
}
|
|
@@ -822,18 +985,29 @@ var primitives_exports = /* @__PURE__ */ __exportAll({
|
|
|
822
985
|
h2: () => h2,
|
|
823
986
|
h3: () => h3,
|
|
824
987
|
pre: () => pre,
|
|
988
|
+
table: () => table,
|
|
825
989
|
wrapper: () => wrapper
|
|
826
990
|
});
|
|
827
991
|
function wrapper(arg0) {
|
|
828
992
|
const { children } = arg0;
|
|
829
993
|
return /* @__PURE__ */ jsx("article", {
|
|
830
|
-
className: "clarify-mdx-page flex h-full flex-col pt-14 pb-10",
|
|
994
|
+
className: "clarify-mdx-page flex h-full min-w-0 flex-col pt-14 pb-10",
|
|
831
995
|
children: /* @__PURE__ */ jsx(Prose, {
|
|
832
996
|
className: "flex-auto",
|
|
833
997
|
children
|
|
834
998
|
})
|
|
835
999
|
});
|
|
836
1000
|
}
|
|
1001
|
+
function table(arg0) {
|
|
1002
|
+
const { className, ...props } = arg0;
|
|
1003
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1004
|
+
className: "overflow-x-auto",
|
|
1005
|
+
children: /* @__PURE__ */ jsx("table", {
|
|
1006
|
+
className,
|
|
1007
|
+
...props
|
|
1008
|
+
})
|
|
1009
|
+
});
|
|
1010
|
+
}
|
|
837
1011
|
function a(arg0) {
|
|
838
1012
|
const { href = "", ...props } = arg0;
|
|
839
1013
|
return /* @__PURE__ */ jsx(LocalizedLink, {
|
|
@@ -937,6 +1111,23 @@ function Property(arg0) {
|
|
|
937
1111
|
}
|
|
938
1112
|
//#endregion
|
|
939
1113
|
//#region source/mdx/Markdown.tsx
|
|
1114
|
+
function getMermaidChart(children) {
|
|
1115
|
+
if (!isValidElement(children)) return void 0;
|
|
1116
|
+
const props = children.props;
|
|
1117
|
+
const className = typeof props.className === "string" ? props.className : "";
|
|
1118
|
+
if (!/\blanguage-mermaid\b/.test(className)) return void 0;
|
|
1119
|
+
return typeof props.children === "string" ? props.children : void 0;
|
|
1120
|
+
}
|
|
1121
|
+
function MarkdownTable(arg0) {
|
|
1122
|
+
const { className, ...props } = arg0;
|
|
1123
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1124
|
+
className: "overflow-x-auto",
|
|
1125
|
+
children: /* @__PURE__ */ jsx("table", {
|
|
1126
|
+
className,
|
|
1127
|
+
...props
|
|
1128
|
+
})
|
|
1129
|
+
});
|
|
1130
|
+
}
|
|
940
1131
|
var markdownComponents = {
|
|
941
1132
|
a(props) {
|
|
942
1133
|
return /* @__PURE__ */ jsx(a, { ...props });
|
|
@@ -946,10 +1137,15 @@ var markdownComponents = {
|
|
|
946
1137
|
},
|
|
947
1138
|
pre(arg0) {
|
|
948
1139
|
const { children, ...props } = arg0;
|
|
1140
|
+
const chart = getMermaidChart(children);
|
|
1141
|
+
if (chart !== void 0) return /* @__PURE__ */ jsx(Mermaid, { chart });
|
|
949
1142
|
return /* @__PURE__ */ jsx(pre, {
|
|
950
1143
|
...props,
|
|
951
1144
|
children
|
|
952
1145
|
});
|
|
1146
|
+
},
|
|
1147
|
+
table(props) {
|
|
1148
|
+
return /* @__PURE__ */ jsx(MarkdownTable, { ...props });
|
|
953
1149
|
}
|
|
954
1150
|
};
|
|
955
1151
|
function Markdown(arg0) {
|
|
@@ -2512,7 +2708,7 @@ function OpenApiOperation(arg0) {
|
|
|
2512
2708
|
header: parameters.filter((parameter) => parameter.in === "header")
|
|
2513
2709
|
};
|
|
2514
2710
|
return /* @__PURE__ */ jsxs("section", {
|
|
2515
|
-
className: "clarify-api-endpoint scroll-mt-24
|
|
2711
|
+
className: "clarify-api-endpoint scroll-mt-24 pb-16 first:pt-0 last:pb-0",
|
|
2516
2712
|
"aria-labelledby": id,
|
|
2517
2713
|
children: [
|
|
2518
2714
|
/* @__PURE__ */ jsx(Heading, {
|
|
@@ -2579,6 +2775,6 @@ function OpenApiOperation(arg0) {
|
|
|
2579
2775
|
});
|
|
2580
2776
|
}
|
|
2581
2777
|
//#endregion
|
|
2582
|
-
export { Code as C,
|
|
2778
|
+
export { Button as A, Code as C, Card as D, Mermaid as E, CardGroup as O, Collapse as S, Pre as T, HeroPattern as _, authPlaceholder as a, Tag as b, getServerKey as c, getRequestBody$1 as d, Markdown as f, GridPattern as g, Prose as h, ResponseExamplesPanel as i, Callout as k, getServers as l, WebFrame as m, OpenApiOperation as n, defaultServerVariables as o, primitives_exports as p, RequestExamplesPanel as r, getAuthOptions as s, EndpointIdentity as t, getMediaTypeEntries as u, Logo as v, CodeGroup as w, Feedback as x, Heading as y };
|
|
2583
2779
|
|
|
2584
|
-
//# sourceMappingURL=OpenApiOperation-
|
|
2780
|
+
//# sourceMappingURL=OpenApiOperation-fJ3QQOJX.js.map
|