@clarify-labs/renderer 0.6.7 → 0.7.1
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-CxQQyEHK.cjs → OpenApiOperation-C4xZu4i0.cjs} +154 -79
- package/output/OpenApiOperation-C4xZu4i0.cjs.map +1 -0
- package/output/{OpenApiOperation-CI_PeMSy.js → OpenApiOperation-LIL7bqxW.js} +129 -60
- package/output/OpenApiOperation-LIL7bqxW.js.map +1 -0
- package/output/{shell-D4tS8Jts.cjs → PageActions-1RDCHcUY.cjs} +597 -160
- package/output/PageActions-1RDCHcUY.cjs.map +1 -0
- package/output/{shell-DvTfFx6M.js → PageActions-yoDRjkq8.js} +531 -148
- package/output/PageActions-yoDRjkq8.js.map +1 -0
- package/output/{ThemeRoot-DErmHskn.js → ThemeRoot-CLa0yvRQ.js} +302 -106
- package/output/ThemeRoot-CLa0yvRQ.js.map +1 -0
- package/output/{ThemeRoot-BhP5M3Hd.cjs → ThemeRoot-DYS-lcK-.cjs} +349 -129
- package/output/ThemeRoot-DYS-lcK-.cjs.map +1 -0
- package/output/app/AppShell.d.ts +5 -2
- package/output/app/PageActions.d.ts +12 -0
- package/output/app/PageBanner.d.ts +7 -0
- package/output/app/PageFooter.d.ts +5 -1
- package/output/app/SectionProvider.d.ts +1 -0
- package/output/client.cjs +14 -4
- package/output/client.d.ts +4 -1
- package/output/client.js +4 -3
- package/output/components/LocalizedLink.d.ts +6 -0
- package/output/components/WebFrame.d.ts +11 -0
- package/output/components/index.d.ts +4 -0
- 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 +74 -59
- package/output/index.cjs +57 -28
- package/output/index.cjs.map +1 -1
- package/output/index.d.ts +9 -7
- 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 +3 -2
- package/output/preview.cjs +66 -28
- package/output/preview.cjs.map +1 -1
- package/output/preview.js +63 -25
- package/output/preview.js.map +1 -1
- package/output/{render-C_NHO3rz.cjs → render-CRTqZzyY.cjs} +10 -8
- package/output/render-CRTqZzyY.cjs.map +1 -0
- package/output/{render-HeCAMIGm.js → render-D0ls3d2j.js} +8 -6
- package/output/render-D0ls3d2j.js.map +1 -0
- package/output/renderer.css +575 -280
- package/output/server.cjs +10 -8
- package/output/server.cjs.map +1 -1
- package/output/server.js +7 -5
- 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/Search.d.ts +4 -0
- package/output/shell/SiteLogo.d.ts +2 -2
- package/output/shell/mobile.d.ts +2 -2
- package/output/shell/search/Highlight.d.ts +11 -0
- package/output/shell/search/SearchDialog.d.ts +13 -0
- package/output/shell/search/SearchInput.d.ts +8 -0
- package/output/shell/search/SearchResult.d.ts +10 -0
- package/output/shell/search/items.d.ts +3 -0
- package/output/shell/search/pagefind.d.ts +5 -0
- package/output/shell/search/types.d.ts +37 -0
- package/output/shell/search/useSearchProps.d.ts +10 -0
- 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 -18
- package/output/utils/href.d.ts +3 -3
- package/package.json +1 -1
- package/output/OpenApiOperation-CI_PeMSy.js.map +0 -1
- package/output/OpenApiOperation-CxQQyEHK.cjs.map +0 -1
- package/output/ThemeRoot-BhP5M3Hd.cjs.map +0 -1
- package/output/ThemeRoot-DErmHskn.js.map +0 -1
- package/output/render-C_NHO3rz.cjs.map +0 -1
- package/output/render-HeCAMIGm.js.map +0 -1
- package/output/shell-D4tS8Jts.cjs.map +0 -1
- package/output/shell-DvTfFx6M.js.map +0 -1
package/output/preview.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { a as authPlaceholder, c as getServerKey, d as getRequestBody, i as ResponseExamplesPanel, l as getServers, o as defaultServerVariables, r as RequestExamplesPanel, s as getAuthOptions, t as EndpointIdentity, u as getMediaTypeEntries } from "./OpenApiOperation-
|
|
2
|
-
import {
|
|
1
|
+
import { a as authPlaceholder, c as getServerKey, d as getRequestBody, i as ResponseExamplesPanel, l as getServers, o as defaultServerVariables, r as RequestExamplesPanel, s as getAuthOptions, t as EndpointIdentity, u as getMediaTypeEntries } from "./OpenApiOperation-LIL7bqxW.js";
|
|
2
|
+
import { A as OpenApisContext, O as ConfigContext, i as Navigation, k as LocaleContext, o as SectionProvider } from "./PageActions-yoDRjkq8.js";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { MemoryRouter } from "react-router-dom";
|
|
5
|
+
import { Menu, X } from "lucide-react";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
//#region source/preview/openapi.tsx
|
|
7
8
|
function schemaFromType(type) {
|
|
@@ -390,9 +391,9 @@ function PreviewEnvironment(arg0) {
|
|
|
390
391
|
const { children, initialEntry = "/preview", sections = [] } = arg0;
|
|
391
392
|
return /* @__PURE__ */ jsx(MemoryRouter, {
|
|
392
393
|
initialEntries: [initialEntry],
|
|
393
|
-
children: /* @__PURE__ */ jsx(
|
|
394
|
+
children: /* @__PURE__ */ jsx(ConfigContext.Provider, {
|
|
394
395
|
value: previewConfig,
|
|
395
|
-
children: /* @__PURE__ */ jsx(
|
|
396
|
+
children: /* @__PURE__ */ jsx(LocaleContext.Provider, {
|
|
396
397
|
value: previewConfig.i18n.defaultLocale,
|
|
397
398
|
children: /* @__PURE__ */ jsx(OpenApisContext.Provider, {
|
|
398
399
|
value: {},
|
|
@@ -406,7 +407,7 @@ function PreviewEnvironment(arg0) {
|
|
|
406
407
|
});
|
|
407
408
|
}
|
|
408
409
|
function Chrome(arg0) {
|
|
409
|
-
const { title, status, children } = arg0;
|
|
410
|
+
const { title, status, headerAction, children } = arg0;
|
|
410
411
|
return /* @__PURE__ */ jsxs("div", {
|
|
411
412
|
className: "clarify-app clarify-preview h-full overflow-hidden bg-(--clarify-theme-tokens-colors-background) text-(--clarify-ui-text) shadow-2xl ring-1 ring-(--clarify-theme-tokens-colors-border) dark:bg-zinc-950 dark:text-white dark:ring-white/10",
|
|
412
413
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
@@ -416,13 +417,14 @@ function Chrome(arg0) {
|
|
|
416
417
|
/* @__PURE__ */ jsx("span", { className: "size-2 rounded-full bg-amber-400" }),
|
|
417
418
|
/* @__PURE__ */ jsx("span", { className: "size-2 rounded-full bg-emerald-400" }),
|
|
418
419
|
/* @__PURE__ */ jsx("span", {
|
|
419
|
-
className: "ml-2 truncate font-medium text-(--clarify-ui-text-soft)",
|
|
420
|
+
className: "ml-2 min-w-0 flex-1 truncate font-medium text-(--clarify-ui-text-soft)",
|
|
420
421
|
children: title
|
|
421
422
|
}),
|
|
422
423
|
status ? /* @__PURE__ */ jsx("span", {
|
|
423
|
-
className: "
|
|
424
|
+
className: "hidden rounded-full bg-emerald-400/15 px-2 py-0.5 font-medium text-emerald-700 sm:inline dark:text-emerald-300",
|
|
424
425
|
children: status
|
|
425
|
-
}) : null
|
|
426
|
+
}) : null,
|
|
427
|
+
headerAction
|
|
426
428
|
]
|
|
427
429
|
}), children]
|
|
428
430
|
});
|
|
@@ -483,10 +485,27 @@ function PreviewNavigation(arg0) {
|
|
|
483
485
|
className: "px-2"
|
|
484
486
|
});
|
|
485
487
|
}
|
|
488
|
+
function MainPreviewMobileNavigation(arg0) {
|
|
489
|
+
const { isOpen, onClose, ...navigationProps } = arg0;
|
|
490
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
491
|
+
className: "clarify-preview-mobile-navigation pointer-events-none absolute inset-0 z-20",
|
|
492
|
+
children: [isOpen ? /* @__PURE__ */ jsx("button", {
|
|
493
|
+
type: "button",
|
|
494
|
+
className: "absolute inset-0 bg-zinc-950/20 backdrop-blur-[1px] dark:bg-black/30",
|
|
495
|
+
"aria-label": "Close documentation menu",
|
|
496
|
+
onClick: onClose
|
|
497
|
+
}) : null, /* @__PURE__ */ jsx("aside", {
|
|
498
|
+
id: "clarify-main-preview-mobile-navigation",
|
|
499
|
+
className: "pointer-events-auto absolute top-0 bottom-0 left-0 w-64 max-w-[82%] overflow-y-auto border-r border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-background) px-1 py-4 text-sm/7 shadow-2xl shadow-zinc-900/20 transition-transform duration-200 ease-out data-closed:-translate-x-full dark:border-white/10 dark:bg-zinc-950 dark:shadow-black/40",
|
|
500
|
+
"data-closed": !isOpen ? "true" : void 0,
|
|
501
|
+
children: /* @__PURE__ */ jsx(PreviewNavigation, { ...navigationProps })
|
|
502
|
+
})]
|
|
503
|
+
});
|
|
504
|
+
}
|
|
486
505
|
function PreviewMetricGrid(arg0) {
|
|
487
506
|
const { metrics } = arg0;
|
|
488
507
|
return /* @__PURE__ */ jsx("div", {
|
|
489
|
-
className: "grid grid-cols-
|
|
508
|
+
className: "grid grid-cols-1 gap-2 sm:grid-cols-3",
|
|
490
509
|
children: metrics.map((metric) => /* @__PURE__ */ jsxs("div", {
|
|
491
510
|
className: "rounded-xl border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) p-2.5 shadow-sm dark:border-white/10 dark:bg-zinc-900/50",
|
|
492
511
|
children: [
|
|
@@ -619,22 +638,41 @@ function MainContentPreview() {
|
|
|
619
638
|
});
|
|
620
639
|
}
|
|
621
640
|
function MainPreview() {
|
|
641
|
+
const [isMobileNavigationOpen, setMobileNavigationOpen] = useState(false);
|
|
642
|
+
const navigationProps = {
|
|
643
|
+
endpoint: embeddedEndpoint,
|
|
644
|
+
guide: embeddedGuide,
|
|
645
|
+
outputs: embeddedGuide.outputs ?? []
|
|
646
|
+
};
|
|
622
647
|
return /* @__PURE__ */ jsx(PreviewEnvironment, {
|
|
623
648
|
initialEntry: mainPreviewPath,
|
|
624
649
|
sections: mainPreviewSections,
|
|
625
650
|
children: /* @__PURE__ */ jsx(Chrome, {
|
|
626
651
|
title: "source/en-US/openapi/embedding.mdx",
|
|
627
652
|
status: "Rendered from OpenAPI + MDX",
|
|
653
|
+
headerAction: /* @__PURE__ */ jsx("button", {
|
|
654
|
+
type: "button",
|
|
655
|
+
className: "clarify-preview-mobile-menu-button -my-1 flex size-7 items-center justify-center rounded-(--clarify-theme-tokens-radius-md) text-(--clarify-ui-text-strong) transition hover:bg-(--clarify-ui-hover-background)",
|
|
656
|
+
"aria-controls": "clarify-main-preview-mobile-navigation",
|
|
657
|
+
"aria-expanded": isMobileNavigationOpen,
|
|
658
|
+
"aria-label": isMobileNavigationOpen ? "Close documentation menu" : "Open documentation menu",
|
|
659
|
+
onClick: () => setMobileNavigationOpen((value) => !value),
|
|
660
|
+
children: isMobileNavigationOpen ? /* @__PURE__ */ jsx(X, { className: "h-4 w-4 shrink-0" }) : /* @__PURE__ */ jsx(Menu, { className: "h-4 w-4 shrink-0" })
|
|
661
|
+
}),
|
|
628
662
|
children: /* @__PURE__ */ jsxs("div", {
|
|
629
|
-
className: "clarify-preview-shell grid",
|
|
630
|
-
children: [
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
663
|
+
className: "clarify-preview-shell relative grid overflow-hidden",
|
|
664
|
+
children: [
|
|
665
|
+
/* @__PURE__ */ jsx(MainPreviewMobileNavigation, {
|
|
666
|
+
...navigationProps,
|
|
667
|
+
isOpen: isMobileNavigationOpen,
|
|
668
|
+
onClose: () => setMobileNavigationOpen(false)
|
|
669
|
+
}),
|
|
670
|
+
/* @__PURE__ */ jsx("aside", {
|
|
671
|
+
className: "clarify-preview-sidebar border-r border-(--clarify-theme-tokens-colors-border) px-1 py-4 text-sm/7 dark:border-white/10 dark:bg-white/5",
|
|
672
|
+
children: /* @__PURE__ */ jsx(PreviewNavigation, { ...navigationProps })
|
|
673
|
+
}),
|
|
674
|
+
/* @__PURE__ */ jsx(MainContentPreview, {})
|
|
675
|
+
]
|
|
638
676
|
})
|
|
639
677
|
})
|
|
640
678
|
});
|
|
@@ -644,7 +682,7 @@ function MdxPreview() {
|
|
|
644
682
|
title: "source/started/index.mdx",
|
|
645
683
|
status: "Rendered by renderer",
|
|
646
684
|
children: /* @__PURE__ */ jsx("div", {
|
|
647
|
-
className: "clarify-preview-body overflow-hidden bg-(--clarify-theme-tokens-colors-background) p-5 dark:bg-zinc-950",
|
|
685
|
+
className: "clarify-preview-body overflow-x-hidden overflow-y-auto bg-(--clarify-theme-tokens-colors-background) p-4 sm:p-5 dark:bg-zinc-950",
|
|
648
686
|
children: /* @__PURE__ */ jsxs("article", {
|
|
649
687
|
className: "max-w-3xl text-sm/7 text-(--clarify-ui-text-soft)",
|
|
650
688
|
children: [
|
|
@@ -653,7 +691,7 @@ function MdxPreview() {
|
|
|
653
691
|
children: "MDX page"
|
|
654
692
|
}),
|
|
655
693
|
/* @__PURE__ */ jsx("h2", {
|
|
656
|
-
className: "mt-3 text-
|
|
694
|
+
className: "mt-3 text-xl/7 font-semibold tracking-tight text-(--clarify-ui-text-strong) sm:text-2xl/8",
|
|
657
695
|
children: "Get Started"
|
|
658
696
|
}),
|
|
659
697
|
/* @__PURE__ */ jsx("p", {
|
|
@@ -661,7 +699,7 @@ function MdxPreview() {
|
|
|
661
699
|
children: "Write pages in source/. Clarify turns MDX, config, and OpenAPI files into routes."
|
|
662
700
|
}),
|
|
663
701
|
/* @__PURE__ */ jsxs("div", {
|
|
664
|
-
className: "mt-
|
|
702
|
+
className: "mt-4 rounded-2xl border border-(--clarify-ui-accent-border) bg-(--clarify-ui-accent-background) p-4 text-sm/6 text-(--clarify-ui-text-strong) sm:mt-5",
|
|
665
703
|
children: [/* @__PURE__ */ jsx("div", {
|
|
666
704
|
className: "font-semibold text-(--clarify-ui-text-strong)",
|
|
667
705
|
children: "Static output ready"
|
|
@@ -671,7 +709,7 @@ function MdxPreview() {
|
|
|
671
709
|
})]
|
|
672
710
|
}),
|
|
673
711
|
/* @__PURE__ */ jsxs("div", {
|
|
674
|
-
className: "mt-
|
|
712
|
+
className: "mt-4 grid gap-3 sm:mt-5 sm:grid-cols-2 sm:gap-4",
|
|
675
713
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
676
714
|
className: "rounded-2xl border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) p-5 shadow-sm dark:border-white/10 dark:bg-zinc-900/50",
|
|
677
715
|
children: [/* @__PURE__ */ jsx("h3", {
|
|
@@ -715,11 +753,11 @@ function OpenApiPreview() {
|
|
|
715
753
|
title: "source/api.openapi.json",
|
|
716
754
|
status: "Endpoint + examples",
|
|
717
755
|
children: /* @__PURE__ */ jsx("div", {
|
|
718
|
-
className: "clarify-preview-openapi-window overflow-hidden bg-(--clarify-theme-tokens-colors-background) px-4 py-4 dark:bg-zinc-950",
|
|
756
|
+
className: "clarify-preview-openapi-window overflow-x-hidden overflow-y-auto bg-(--clarify-theme-tokens-colors-background) px-3 py-3 sm:px-4 sm:py-4 dark:bg-zinc-950",
|
|
719
757
|
children: /* @__PURE__ */ jsx("div", {
|
|
720
|
-
className: "clarify-preview-openapi-mask h-full
|
|
758
|
+
className: "clarify-preview-openapi-mask min-h-full",
|
|
721
759
|
children: /* @__PURE__ */ jsx("div", {
|
|
722
|
-
className: "clarify-preview-api-content clarify-preview-api-content-openapi origin-top pb-10",
|
|
760
|
+
className: "clarify-preview-api-content clarify-preview-api-content-openapi origin-top pb-6 sm:pb-10",
|
|
723
761
|
children: /* @__PURE__ */ jsx(OpenApiExamplesPreview, { endpoint: staticOutputEndpoint })
|
|
724
762
|
})
|
|
725
763
|
})
|
package/output/preview.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.js","names":[],"sources":["../source/preview/openapi.tsx","../source/preview.tsx"],"sourcesContent":["import { useState } from 'react'\n\nimport { authPlaceholder, defaultServerVariables, getAuthOptions, getServerKey, getServers, RequestExamplesPanel, ResponseExamplesPanel } from '../openapi/components/ExamplePanels'\nimport { EndpointIdentity } from '../openapi/components/OpenApiOperation'\nimport { getMediaTypeEntries, getRequestBody } from '../openapi/lib/helpers'\nimport type { OpenAPIOperation, OpenAPISpec } from '../openapi/lib/utils'\nimport type { OpenApiParameter, RequestAuthInput } from '../openapi/types'\n\nexport type PreviewParameter = {\n name: string\n in: string\n type: string\n required?: boolean\n description?: string\n schema?: unknown\n}\n\nexport type PreviewEndpoint = {\n method: string\n path: string\n summary: string\n description: string\n parameters?: PreviewParameter[]\n requestDescription?: string\n requestSchema?: unknown\n requestExample?: unknown\n response?: string\n responseStatus?: string\n responseDescription?: string\n responseSchema?: unknown\n responseExample?: unknown\n}\n\ntype CreatePreviewOpenApiResult = {\n operation: OpenAPIOperation\n spec: OpenAPISpec\n parameters: OpenApiParameter[]\n}\n\ntype OpenApiExamplesPreviewProps = { endpoint: PreviewEndpoint }\n\nfunction schemaFromType(type: string): unknown {\n if (type.endsWith('[]')) return { type: 'array', items: schemaFromType(type.slice(0, -2)) }\n if (type === 'number' || type === 'integer' || type === 'boolean' || type === 'object') return { type }\n return { type: 'string' }\n}\n\nfunction parseResponseExample(endpoint: PreviewEndpoint): unknown {\n if (typeof endpoint.responseExample !== 'undefined') return endpoint.responseExample\n if (!endpoint.response) return undefined\n\n try {\n return JSON.parse(endpoint.response)\n } catch {\n return endpoint.response\n }\n}\n\nfunction inferSchemaFromExample(example: unknown): unknown {\n if (Array.isArray(example)) {\n return { type: 'array', items: inferSchemaFromExample(example[0]) ?? { type: 'object' } }\n }\n\n if (typeof example === 'object' && example !== null) {\n return {\n type: 'object',\n properties: Object.fromEntries(Object.entries(example).map(([key, value]) => [key, inferSchemaFromExample(value)])),\n }\n }\n\n if (typeof example === 'number') return { type: Number.isInteger(example) ? 'integer' : 'number' }\n if (typeof example === 'boolean') return { type: 'boolean' }\n return typeof example === 'undefined' ? undefined : { type: 'string' }\n}\n\nfunction normalizeParameterLocation(location: string): string {\n return location === 'route' ? 'path' : location\n}\n\nfunction toOpenApiParameter(parameter: PreviewParameter): OpenApiParameter {\n return {\n name: parameter.name,\n in: normalizeParameterLocation(parameter.in),\n required: parameter.required,\n description: parameter.description,\n schema: parameter.schema ?? schemaFromType(parameter.type),\n }\n}\n\nfunction createPreviewOpenApi(endpoint: PreviewEndpoint): CreatePreviewOpenApiResult {\n const method = endpoint.method.toLowerCase()\n const parameters = (endpoint.parameters ?? []).map(toOpenApiParameter)\n const responseExample = parseResponseExample(endpoint)\n const responseSchema = endpoint.responseSchema ?? inferSchemaFromExample(responseExample)\n const requestSchema = endpoint.requestSchema ?? inferSchemaFromExample(endpoint.requestExample)\n const operation = {\n summary: endpoint.summary,\n description: endpoint.description,\n parameters,\n requestBody: requestSchema\n ? {\n description: endpoint.requestDescription,\n required: true,\n content: {\n 'application/json': {\n schema: requestSchema,\n example: endpoint.requestExample,\n },\n },\n }\n : undefined,\n responses: {\n [endpoint.responseStatus ?? '200']: {\n description: endpoint.responseDescription ?? 'OK',\n content: {\n 'application/json': {\n schema: responseSchema,\n example: responseExample,\n },\n },\n },\n },\n } as OpenAPIOperation\n const spec = {\n openapi: '3.1.0',\n info: {\n title: 'Clarify Build API',\n version: '2026-06-20',\n description: 'API reference generated from OpenAPI and rendered as static documentation.',\n },\n servers: [\n {\n url: 'https://server',\n description: 'Production',\n },\n {\n url: 'https://test-server',\n description: 'Test',\n },\n ],\n components: {\n securitySchemes: {\n bearerAuth: {\n type: 'http',\n scheme: 'bearer',\n bearerFormat: 'JWT',\n },\n },\n },\n security: [{ bearerAuth: [] }],\n paths: {\n [endpoint.path]: {\n [method]: operation,\n },\n },\n } as OpenAPISpec\n\n return { operation, spec, parameters }\n}\n\nexport function OpenApiExamplesPreview(arg0: OpenApiExamplesPreviewProps) {\n const { endpoint } = arg0\n const { operation, spec, parameters } = createPreviewOpenApi(endpoint)\n const method = endpoint.method.toUpperCase()\n const requestBody = getRequestBody(spec, operation)\n const requestContents = getMediaTypeEntries(requestBody?.content, spec)\n const [selectedRequestMediaType, setSelectedRequestMediaType] = useState(requestContents[0]?.mediaType ?? '')\n const selectedRequestContent = requestContents.find((content) => content.mediaType === selectedRequestMediaType) ?? requestContents[0]\n const servers = getServers(spec, operation, endpoint.path)\n const [selectedServerKey, setSelectedServerKey] = useState(getServerKey(servers[0], 0))\n const selectedServer = servers.find((server, index) => getServerKey(server, index) === selectedServerKey) ?? servers[0]\n const [serverVariables, setServerVariables] = useState(defaultServerVariables(selectedServer))\n const [serverOpen, setServerOpen] = useState(false)\n const authOptions = getAuthOptions(spec, operation)\n const [selectedAuthName, setSelectedAuthName] = useState(authOptions[0]?.name ?? '')\n const selectedAuth = authOptions.find((option) => option.name === selectedAuthName)\n const [authValues, setAuthValues] = useState<Record<string, string>>({})\n const [authOpen, setAuthOpen] = useState(false)\n const authInput: RequestAuthInput | undefined = selectedAuth\n ? { name: selectedAuth.name, scheme: selectedAuth.scheme, value: authValues[selectedAuth.name] ?? authPlaceholder(selectedAuth) }\n : undefined\n\n return (\n <div className=\"space-y-4\">\n <EndpointIdentity\n method={method}\n path={endpoint.path}\n servers={servers}\n selectedServerKey={selectedServerKey}\n selectedServer={selectedServer}\n serverVariables={serverVariables}\n serverOpen={serverOpen}\n authOptions={authOptions}\n selectedAuthName={selectedAuthName}\n selectedAuth={selectedAuth}\n authValues={authValues}\n authOpen={authOpen}\n onSelectServer={(value) => {\n const nextServer = servers.find((server, index) => getServerKey(server, index) === value) ?? servers[0]\n setSelectedServerKey(value)\n setServerVariables(defaultServerVariables(nextServer))\n }}\n onChangeServerVariable={(name, value) => setServerVariables((current) => ({ ...current, [name]: value }))}\n onToggleServer={() => {\n setServerOpen((current) => !current)\n setAuthOpen(false)\n }}\n onToggleAuth={() => {\n setAuthOpen((current) => !current)\n setServerOpen(false)\n }}\n onSelectAuth={setSelectedAuthName}\n onChangeAuthValue={(name, value) => setAuthValues((current) => ({ ...current, [name]: value }))}\n />\n <div className=\"grid min-w-0 gap-4 lg:grid-cols-2\">\n <RequestExamplesPanel\n spec={spec}\n path={endpoint.path}\n method={method}\n parameters={parameters}\n requestContents={requestContents}\n selectedMediaType={selectedRequestContent?.mediaType ?? ''}\n onSelectMediaType={setSelectedRequestMediaType}\n selectedServer={selectedServer}\n serverVariables={serverVariables}\n auth={authInput}\n />\n <ResponseExamplesPanel operation={operation} spec={spec} />\n </div>\n </div>\n )\n}\n","import type { ReactNode } from 'react'\nimport { MemoryRouter } from 'react-router-dom'\n\nimport { SectionProvider } from './app/SectionProvider'\nimport type { Section } from './app/SectionProvider'\nimport { ClarifyConfigContext, ClarifyLocaleContext, OpenApisContext } from './context'\nimport { OpenApiExamplesPreview } from './preview/openapi'\nimport type { PreviewEndpoint } from './preview/openapi'\nimport { Navigation } from './shell'\nimport type { ClarifyConfig, NavigationNode } from './types'\n\nexport type PreviewGuide = {\n label: string\n title: string\n body: string\n embed: string\n outputs?: string[]\n}\n\nexport type PreviewMetric = {\n label: string\n value: string\n hint?: string\n}\n\nexport type PreviewCard = {\n title: string\n description: string\n}\n\nconst embeddedEndpoint = {\n method: 'GET',\n path: '/examples/basic-request',\n summary: 'Basic request',\n description: 'Rendered from api.openapi.json inside the MDX guide.',\n parameters: [\n { name: 'cursor', in: 'query', type: 'string', description: 'Start after this cursor.' },\n { name: 'limit', in: 'query', type: 'integer', description: 'Max items to return.' },\n { name: 'X-Trace-Id', in: 'header', type: 'string', description: 'Optional request trace.' },\n ],\n responseDescription: 'A page of example records.',\n responseSchema: {\n type: 'object',\n required: ['items'],\n properties: {\n items: { type: 'array', items: { type: 'object' } },\n next: { type: 'string' },\n },\n },\n responseExample: {\n items: [],\n next: 'cursor_2',\n },\n} satisfies PreviewEndpoint\n\nconst embeddedGuide = {\n label: 'source/en-US/openapi/embedding.mdx',\n title: 'Embed OpenAPI in MDX',\n body: 'Use MDX for workflow context, then render the exact operation from the spec.',\n embed: '<OpenApiOperation specPath=\"/api\" path=\"/examples/basic-request\" method=\"get\" />',\n outputs: ['/openapi/embedding', '/api', '/api.openapi.json', '/llms.txt'],\n} satisfies PreviewGuide\n\nconst staticOutputEndpoint = {\n method: 'POST',\n path: '/api/{id}/path',\n summary: 'Create static build',\n description: 'Build static docs from MDX and OpenAPI sources.',\n parameters: [\n { name: 'id', in: 'path', type: 'string', required: true, description: 'Project ID.' }\n ],\n responseDescription: 'Build metadata and static outputs.',\n responseSchema: {\n type: 'object',\n required: ['id', 'status', 'outputs'],\n properties: {\n id: { type: 'string', description: 'Build identifier.' },\n status: { type: 'string', enum: ['queued', 'running', 'ready'], description: 'Current build state.' },\n outputs: {\n type: 'array',\n description: 'Generated static artifacts.',\n items: {\n type: 'object',\n required: ['path', 'kind'],\n properties: {\n path: { type: 'string' },\n kind: { type: 'string', enum: ['html', 'asset', 'openapi', 'llms'] },\n },\n },\n },\n },\n },\n requestDescription: 'Static build options.',\n requestSchema: {\n type: 'object',\n required: ['source', 'output'],\n properties: {\n source: { type: 'string', description: 'MDX source root.' },\n output: { type: 'string', description: 'Static output root.' },\n includeSearchIndex: { type: 'boolean', description: 'Generate search data.' },\n },\n },\n requestExample: {\n source: 'source',\n output: 'output',\n includeSearchIndex: true,\n },\n responseExample: {\n id: 'build_01HY',\n status: 'ready',\n outputs: [\n { path: '/openapi/index.html', kind: 'html' },\n { path: '/api.openapi.json', kind: 'openapi' },\n { path: '/llms.txt', kind: 'llms' },\n ],\n },\n} satisfies PreviewEndpoint\n\nconst previewConfig = {\n title: 'Clarify preview',\n description: 'Renderer preview environment',\n rootDirectory: 'source',\n routePrefix: '/',\n outputDirectory: 'output',\n theme: {\n preset: 'default',\n tokens: {\n colors: {\n primary: '#2563eb',\n accent: '#60a5fa',\n background: '#ffffff',\n foreground: '#18181b',\n surface: '#ffffff',\n muted: '#71717a',\n border: 'rgb(24 24 27 / 0.1)',\n codeBackground: '#f4f4f5',\n },\n radius: {\n sm: '0.375rem',\n md: '0.5rem',\n lg: '0.75rem',\n xl: '1rem',\n },\n },\n layout: {\n maxWidth: '88rem',\n },\n editor: false,\n },\n i18n: {\n defaultLocale: 'en',\n missing: 'fallback',\n locales: [{ code: 'en', label: 'English' }],\n },\n} satisfies ClarifyConfig\n\nconst methodStyles: Record<string, string> = {\n GET: 'bg-emerald-400/15 text-emerald-600 dark:bg-emerald-400/20 dark:text-emerald-300',\n POST: 'bg-sky-400/15 text-sky-600 dark:bg-sky-400/20 dark:text-sky-300',\n PUT: 'bg-amber-400/15 text-amber-600 dark:bg-amber-400/20 dark:text-amber-300',\n PATCH: 'bg-amber-400/15 text-amber-600 dark:bg-amber-400/20 dark:text-amber-300',\n DELETE: 'bg-rose-400/15 text-rose-600 dark:bg-rose-400/20 dark:text-rose-300',\n}\n\nconst mainPreviewPath = '/openapi/embedding'\n\nconst mainPreviewSections = [\n { id: 'overview', title: 'Overview' },\n { id: 'request-example', title: 'Request example' }\n] satisfies Section[]\n\ntype PreviewEnvironmentProps = { children: ReactNode; initialEntry?: string; sections?: Section[] }\n\nfunction PreviewEnvironment(arg0: PreviewEnvironmentProps) {\n const { children, initialEntry = '/preview', sections = [] } = arg0\n\n return (\n <MemoryRouter initialEntries={[initialEntry]}>\n <ClarifyConfigContext.Provider value={previewConfig}>\n <ClarifyLocaleContext.Provider value={previewConfig.i18n.defaultLocale}>\n <OpenApisContext.Provider value={{}}>\n <SectionProvider sections={sections}>\n {children}\n </SectionProvider>\n </OpenApisContext.Provider>\n </ClarifyLocaleContext.Provider>\n </ClarifyConfigContext.Provider>\n </MemoryRouter>\n )\n}\n\ntype ChromeProps = { title: string; status?: string; children: ReactNode }\n\nfunction Chrome(arg0: ChromeProps) {\n const { title, status, children } = arg0\n\n return (\n <div className=\"clarify-app clarify-preview h-full overflow-hidden bg-(--clarify-theme-tokens-colors-background) text-(--clarify-ui-text) shadow-2xl ring-1 ring-(--clarify-theme-tokens-colors-border) dark:bg-zinc-950 dark:text-white dark:ring-white/10\">\n <div className=\"flex items-center gap-3 border-b border-(--clarify-theme-tokens-colors-border) px-4 py-3 text-xs/6 text-(--clarify-ui-text-faint) dark:border-white/10\">\n <span className=\"size-2 rounded-full bg-rose-400\" />\n <span className=\"size-2 rounded-full bg-amber-400\" />\n <span className=\"size-2 rounded-full bg-emerald-400\" />\n <span className=\"ml-2 truncate font-medium text-(--clarify-ui-text-soft)\">{title}</span>\n {status ? <span className=\"ml-auto hidden rounded-full bg-emerald-400/15 px-2 py-0.5 font-medium text-emerald-700 sm:inline dark:text-emerald-300\">{status}</span> : null}\n </div>\n {children}\n </div>\n )\n}\n\ntype MethodBadgeProps = { method: string }\n\nfunction MethodBadge(arg0: MethodBadgeProps) {\n const method = arg0.method.toUpperCase()\n\n return (\n <span className={`rounded-md px-2.5 py-0.5 text-xs/6 font-black tracking-wide ${methodStyles[method] ?? 'bg-(--clarify-ui-subtle-background) text-(--clarify-ui-text-soft)'}`}>\n {method}\n </span>\n )\n}\n\ntype CreatePreviewNavigationProps = { endpoint: PreviewEndpoint; guide?: PreviewGuide; outputs: string[] }\n\nfunction createPreviewNavigation(arg0: CreatePreviewNavigationProps): NavigationNode[] {\n const { endpoint, guide, outputs } = arg0\n\n return [\n {\n title: 'Guides',\n path: '/guides',\n icon: 'BookOpenText',\n children: [\n { title: guide?.title ?? 'MDX guide', path: mainPreviewPath, icon: 'FileText' },\n { title: 'Getting started', path: '/getting-started', icon: 'Rocket' },\n ],\n },\n {\n title: 'API Reference',\n path: '/api',\n icon: 'Braces',\n children: [\n { title: endpoint.summary, path: endpoint.path, icon: 'Cable' },\n { title: 'Generate static output', path: staticOutputEndpoint.path, icon: 'UploadCloud' },\n ],\n },\n {\n title: 'Build Output',\n path: '/output',\n icon: 'PackageCheck',\n children: [\n { title: `Routes (${outputs.length})`, path: '/output/routes', icon: 'ListTree' }\n ],\n },\n ] satisfies NavigationNode[]\n}\n\ntype PreviewNavigationProps = { endpoint: PreviewEndpoint; guide?: PreviewGuide; outputs: string[] }\n\nfunction PreviewNavigation(arg0: PreviewNavigationProps) {\n return <Navigation navigation={createPreviewNavigation(arg0)} className=\"px-2\" />\n}\n\ntype PreviewMetricGridProps = { metrics: PreviewMetric[] }\n\nfunction PreviewMetricGrid(arg0: PreviewMetricGridProps) {\n const { metrics } = arg0\n\n return (\n <div className=\"grid grid-cols-3 gap-2\">\n {metrics.map((metric) => (\n <div key={metric.label} className=\"rounded-xl border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) p-2.5 shadow-sm dark:border-white/10 dark:bg-zinc-900/50\">\n <div className=\"text-xs/5 text-(--clarify-ui-text-faint)\">{metric.label}</div>\n <div className=\"text-base/6 font-semibold text-(--clarify-ui-text-strong)\">{metric.value}</div>\n {metric.hint ? <div className=\"text-xs/5 text-(--clarify-ui-text-faint)\">{metric.hint}</div> : null}\n </div>\n ))}\n </div>\n )\n}\n\ntype PreviewLabelProps = { children: ReactNode }\n\nfunction PreviewLabel(arg0: PreviewLabelProps) {\n return <div className=\"text-xs/5 font-semibold uppercase tracking-wider text-(--clarify-ui-text-faint)\">{arg0.children}</div>\n}\n\ntype GuideSummaryPreviewProps = { guide: PreviewGuide }\n\nfunction GuideSummaryPreview(arg0: GuideSummaryPreviewProps) {\n const { guide } = arg0\n\n return (\n <header className=\"border-b border-(--clarify-theme-tokens-colors-border) pb-4 dark:border-white/10\">\n <PreviewLabel>{guide.label}</PreviewLabel>\n <h2 className=\"mt-1 text-xl/7 font-semibold tracking-tight text-(--clarify-ui-text-strong)\">{guide.title}</h2>\n <p className=\"mt-2 max-w-2xl text-sm/6 text-(--clarify-ui-text-soft)\">{guide.body}</p>\n <pre className=\"mt-3 overflow-hidden rounded-xl bg-zinc-950 px-3 py-2 text-xs/5 whitespace-pre-wrap text-zinc-300\">{guide.embed}</pre>\n </header>\n )\n}\n\ntype EndpointSummaryPreviewProps = { endpoint: PreviewEndpoint }\n\nfunction EndpointSummaryPreview(arg0: EndpointSummaryPreviewProps) {\n const { endpoint } = arg0\n\n return (\n <div className=\"min-w-0\">\n <div className=\"flex flex-wrap items-center gap-3\">\n <MethodBadge method={endpoint.method} />\n <code className=\"text-sm font-medium text-(--clarify-ui-text)\">{endpoint.path}</code>\n </div>\n <h3 className=\"mt-3 text-lg/7 font-semibold tracking-tight text-(--clarify-ui-text-strong)\">{endpoint.summary}</h3>\n <p className=\"mt-1 text-sm/6 text-(--clarify-ui-text-soft)\">{endpoint.description}</p>\n </div>\n )\n}\n\ntype EmbeddedApiPreviewProps = { endpoint: PreviewEndpoint }\n\nfunction EmbeddedApiPreview(arg0: EmbeddedApiPreviewProps) {\n const { endpoint } = arg0\n\n return (\n <div className=\"clarify-preview-api-frame min-w-0 overflow-hidden border-t border-(--clarify-theme-tokens-colors-border) pt-4 dark:border-white/10\">\n <div className=\"clarify-preview-api-content clarify-preview-api-content-embedded\">\n <OpenApiExamplesPreview endpoint={endpoint} />\n </div>\n </div>\n )\n}\n\ntype OutputListPreviewProps = { outputs: string[] }\n\nfunction OutputListPreview(arg0: OutputListPreviewProps) {\n const { outputs } = arg0\n\n return (\n <div className=\"border-t border-(--clarify-theme-tokens-colors-border) pt-4 dark:border-white/10\">\n <PreviewLabel>Static output</PreviewLabel>\n <div className=\"mt-3 grid gap-2 sm:grid-cols-2 xl:grid-cols-4\">\n {outputs.map((output) => (\n <div key={output} className=\"flex items-center gap-2 rounded-lg bg-(--clarify-ui-subtle-background) px-3 py-2 text-xs/5 text-(--clarify-ui-text-soft) dark:bg-white/5\">\n <span className=\"size-1.5 rounded-full bg-emerald-400\" />\n <span className=\"truncate font-mono\">{output}</span>\n </div>\n ))}\n </div>\n </div>\n )\n}\n\nfunction MainContentPreview() {\n return (\n <section className=\"min-w-0 bg-(--clarify-theme-tokens-colors-background) px-5 py-4 dark:bg-zinc-950\">\n <div className=\"clarify-preview-content-window overflow-hidden\">\n <div className=\"space-y-4\">\n <GuideSummaryPreview guide={embeddedGuide} />\n <PreviewMetricGrid metrics={[\n { label: 'MDX', value: 'Guide', hint: 'context' },\n { label: 'Spec', value: 'OpenAPI', hint: 'source' },\n { label: 'Out', value: 'Static', hint: 'CDN' },\n ]} />\n <div className=\"clarify-preview-endpoint-grid grid gap-4\">\n <EndpointSummaryPreview endpoint={embeddedEndpoint} />\n <EmbeddedApiPreview endpoint={embeddedEndpoint} />\n </div>\n <OutputListPreview outputs={embeddedGuide.outputs ?? []} />\n </div>\n </div>\n </section>\n )\n}\n\nexport function MainPreview() {\n return (\n <PreviewEnvironment initialEntry={mainPreviewPath} sections={mainPreviewSections}>\n <Chrome title=\"source/en-US/openapi/embedding.mdx\" status=\"Rendered from OpenAPI + MDX\">\n <div className=\"clarify-preview-shell grid\">\n <aside className=\"border-r border-(--clarify-theme-tokens-colors-border) px-1 py-4 text-sm/7 dark:border-white/10 dark:bg-white/5\">\n <PreviewNavigation endpoint={embeddedEndpoint} guide={embeddedGuide} outputs={embeddedGuide.outputs ?? []} />\n </aside>\n <MainContentPreview />\n </div>\n </Chrome>\n </PreviewEnvironment>\n )\n}\n\nexport function MdxPreview() {\n return (\n <PreviewEnvironment>\n <Chrome title=\"source/started/index.mdx\" status=\"Rendered by renderer\">\n <div className=\"clarify-preview-body overflow-hidden bg-(--clarify-theme-tokens-colors-background) p-5 dark:bg-zinc-950\">\n <article className=\"max-w-3xl text-sm/7 text-(--clarify-ui-text-soft)\">\n <div className=\"inline-flex rounded-full bg-(--clarify-ui-accent-background) px-3 py-1 text-xs/5 font-semibold text-(--clarify-ui-accent-text)\">MDX page</div>\n <h2 className=\"mt-3 text-2xl/8 font-semibold tracking-tight text-(--clarify-ui-text-strong)\">Get Started</h2>\n <p className=\"mt-3\">Write pages in source/. Clarify turns MDX, config, and OpenAPI files into routes.</p>\n <div className=\"mt-5 rounded-2xl border border-(--clarify-ui-accent-border) bg-(--clarify-ui-accent-background) p-4 text-sm/6 text-(--clarify-ui-text-strong)\">\n <div className=\"font-semibold text-(--clarify-ui-text-strong)\">Static output ready</div>\n <p className=\"mt-1\">output/ is plain static files.</p>\n </div>\n <div className=\"mt-5 grid gap-4 sm:grid-cols-2\">\n <div className=\"rounded-2xl border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) p-5 shadow-sm dark:border-white/10 dark:bg-zinc-900/50\">\n <h3 className=\"text-base/6 font-semibold text-(--clarify-ui-text-strong)\">MDX pages</h3>\n <p className=\"mt-2 text-sm/6\">Guides live beside code.</p>\n </div>\n <div className=\"rounded-2xl border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) p-5 shadow-sm dark:border-white/10 dark:bg-zinc-900/50\">\n <h3 className=\"text-base/6 font-semibold text-(--clarify-ui-text-strong)\">API embeds</h3>\n <p className=\"mt-2 text-sm/6\">Specs render inline.</p>\n </div>\n </div>\n <div className=\"mt-5 rounded-2xl border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) p-5 shadow-sm dark:border-white/10 dark:bg-zinc-900/50\">\n <div className=\"flex items-center gap-3\">\n <MethodBadge method={embeddedEndpoint.method} />\n <code className=\"text-sm font-medium text-(--clarify-ui-text)\">{embeddedEndpoint.path}</code>\n </div>\n <p className=\"mt-3 text-sm/6\">{embeddedEndpoint.description}</p>\n </div>\n </article>\n </div>\n </Chrome>\n </PreviewEnvironment>\n )\n}\n\nexport function OpenApiPreview() {\n return (\n <PreviewEnvironment>\n <Chrome title=\"source/api.openapi.json\" status=\"Endpoint + examples\">\n <div className=\"clarify-preview-openapi-window overflow-hidden bg-(--clarify-theme-tokens-colors-background) px-4 py-4 dark:bg-zinc-950\">\n <div className=\"clarify-preview-openapi-mask h-full overflow-hidden\">\n <div className=\"clarify-preview-api-content clarify-preview-api-content-openapi origin-top pb-10\">\n <OpenApiExamplesPreview endpoint={staticOutputEndpoint} />\n </div>\n </div>\n </div>\n </Chrome>\n </PreviewEnvironment>\n )\n}\n"],"mappings":";;;;;;AAyCA,SAAS,eAAe,MAAuB;CAC7C,IAAI,KAAK,SAAS,IAAI,GAAG,OAAO;EAAE,MAAM;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AAO;MAAiC,CAAA,CAClD;;KACL,qBAAC,OAAD;MAAK,WAAU;gBAAf,CACE,qBAAC,OAAD;OAAK,WAAU;iBAAf,CACE,oBAAC,MAAD;QAAI,WAAU;kBAA4D;OAAa,CAAA,GACvF,oBAAC,KAAD;QAAG,WAAU;kBAAiB;OAA2B,CAAA,CACtD;UACL,qBAAC,OAAD;OAAK,WAAU;iBAAf,CACE,oBAAC,MAAD;QAAI,WAAU;kBAA4D;OAAc,CAAA,GACxF,oBAAC,KAAD;QAAG,WAAU;kBAAiB;OAAuB,CAAA,CAClD;QACF;;KACL,qBAAC,OAAD;MAAK,WAAU;gBAAf,CACE,qBAAC,OAAD;OAAK,WAAU;iBAAf,CACE,oBAAC,aAAD,EAAa,QAAQ,iBAAiB,OAAS,CAAA,GAC/C,oBAAC,QAAD;QAAM,WAAU;kBAAgD,iBAAiB;OAAW,CAAA,CACzF;UACL,oBAAC,KAAD;OAAG,WAAU;iBAAkB,iBAAiB;MAAe,CAAA,CAC5D;;IACE;;EACN,CAAA;CACC,CAAA,EACU,CAAA;AAExB;AAEA,SAAgB,iBAAiB;CAC/B,OACE,oBAAC,oBAAD,EAAA,UACE,oBAAC,QAAD;EAAQ,OAAM;EAA0B,QAAO;YAC7C,oBAAC,OAAD;GAAK,WAAU;aACb,oBAAC,OAAD;IAAK,WAAU;cACb,oBAAC,OAAD;KAAK,WAAU;eACb,oBAAC,wBAAD,EAAwB,UAAU,qBAAuB,CAAA;IACtD,CAAA;GACF,CAAA;EACF,CAAA;CACC,CAAA,EACU,CAAA;AAExB"}
|
|
1
|
+
{"version":3,"file":"preview.js","names":[],"sources":["../source/preview/openapi.tsx","../source/preview.tsx"],"sourcesContent":["import { useState } from 'react'\n\nimport { authPlaceholder, defaultServerVariables, getAuthOptions, getServerKey, getServers, RequestExamplesPanel, ResponseExamplesPanel } from '../openapi/components/ExamplePanels'\nimport { EndpointIdentity } from '../openapi/components/OpenApiOperation'\nimport { getMediaTypeEntries, getRequestBody } from '../openapi/lib/helpers'\nimport type { OpenAPIOperation, OpenAPISpec } from '../openapi/lib/utils'\nimport type { OpenApiParameter, RequestAuthInput } from '../openapi/types'\n\nexport type PreviewParameter = {\n name: string\n in: string\n type: string\n required?: boolean\n description?: string\n schema?: unknown\n}\n\nexport type PreviewEndpoint = {\n method: string\n path: string\n summary: string\n description: string\n parameters?: PreviewParameter[]\n requestDescription?: string\n requestSchema?: unknown\n requestExample?: unknown\n response?: string\n responseStatus?: string\n responseDescription?: string\n responseSchema?: unknown\n responseExample?: unknown\n}\n\ntype CreatePreviewOpenApiResult = {\n operation: OpenAPIOperation\n spec: OpenAPISpec\n parameters: OpenApiParameter[]\n}\n\ntype OpenApiExamplesPreviewProps = { endpoint: PreviewEndpoint }\n\nfunction schemaFromType(type: string): unknown {\n if (type.endsWith('[]')) return { type: 'array', items: schemaFromType(type.slice(0, -2)) }\n if (type === 'number' || type === 'integer' || type === 'boolean' || type === 'object') return { type }\n return { type: 'string' }\n}\n\nfunction parseResponseExample(endpoint: PreviewEndpoint): unknown {\n if (typeof endpoint.responseExample !== 'undefined') return endpoint.responseExample\n if (!endpoint.response) return undefined\n\n try {\n return JSON.parse(endpoint.response)\n } catch {\n return endpoint.response\n }\n}\n\nfunction inferSchemaFromExample(example: unknown): unknown {\n if (Array.isArray(example)) {\n return { type: 'array', items: inferSchemaFromExample(example[0]) ?? { type: 'object' } }\n }\n\n if (typeof example === 'object' && example !== null) {\n return {\n type: 'object',\n properties: Object.fromEntries(Object.entries(example).map(([key, value]) => [key, inferSchemaFromExample(value)])),\n }\n }\n\n if (typeof example === 'number') return { type: Number.isInteger(example) ? 'integer' : 'number' }\n if (typeof example === 'boolean') return { type: 'boolean' }\n return typeof example === 'undefined' ? undefined : { type: 'string' }\n}\n\nfunction normalizeParameterLocation(location: string): string {\n return location === 'route' ? 'path' : location\n}\n\nfunction toOpenApiParameter(parameter: PreviewParameter): OpenApiParameter {\n return {\n name: parameter.name,\n in: normalizeParameterLocation(parameter.in),\n required: parameter.required,\n description: parameter.description,\n schema: parameter.schema ?? schemaFromType(parameter.type),\n }\n}\n\nfunction createPreviewOpenApi(endpoint: PreviewEndpoint): CreatePreviewOpenApiResult {\n const method = endpoint.method.toLowerCase()\n const parameters = (endpoint.parameters ?? []).map(toOpenApiParameter)\n const responseExample = parseResponseExample(endpoint)\n const responseSchema = endpoint.responseSchema ?? inferSchemaFromExample(responseExample)\n const requestSchema = endpoint.requestSchema ?? inferSchemaFromExample(endpoint.requestExample)\n const operation = {\n summary: endpoint.summary,\n description: endpoint.description,\n parameters,\n requestBody: requestSchema\n ? {\n description: endpoint.requestDescription,\n required: true,\n content: {\n 'application/json': {\n schema: requestSchema,\n example: endpoint.requestExample,\n },\n },\n }\n : undefined,\n responses: {\n [endpoint.responseStatus ?? '200']: {\n description: endpoint.responseDescription ?? 'OK',\n content: {\n 'application/json': {\n schema: responseSchema,\n example: responseExample,\n },\n },\n },\n },\n } as OpenAPIOperation\n const spec = {\n openapi: '3.1.0',\n info: {\n title: 'Clarify Build API',\n version: '2026-06-20',\n description: 'API reference generated from OpenAPI and rendered as static documentation.',\n },\n servers: [\n {\n url: 'https://server',\n description: 'Production',\n },\n {\n url: 'https://test-server',\n description: 'Test',\n },\n ],\n components: {\n securitySchemes: {\n bearerAuth: {\n type: 'http',\n scheme: 'bearer',\n bearerFormat: 'JWT',\n },\n },\n },\n security: [{ bearerAuth: [] }],\n paths: {\n [endpoint.path]: {\n [method]: operation,\n },\n },\n } as OpenAPISpec\n\n return { operation, spec, parameters }\n}\n\nexport function OpenApiExamplesPreview(arg0: OpenApiExamplesPreviewProps) {\n const { endpoint } = arg0\n const { operation, spec, parameters } = createPreviewOpenApi(endpoint)\n const method = endpoint.method.toUpperCase()\n const requestBody = getRequestBody(spec, operation)\n const requestContents = getMediaTypeEntries(requestBody?.content, spec)\n const [selectedRequestMediaType, setSelectedRequestMediaType] = useState(requestContents[0]?.mediaType ?? '')\n const selectedRequestContent = requestContents.find((content) => content.mediaType === selectedRequestMediaType) ?? requestContents[0]\n const servers = getServers(spec, operation, endpoint.path)\n const [selectedServerKey, setSelectedServerKey] = useState(getServerKey(servers[0], 0))\n const selectedServer = servers.find((server, index) => getServerKey(server, index) === selectedServerKey) ?? servers[0]\n const [serverVariables, setServerVariables] = useState(defaultServerVariables(selectedServer))\n const [serverOpen, setServerOpen] = useState(false)\n const authOptions = getAuthOptions(spec, operation)\n const [selectedAuthName, setSelectedAuthName] = useState(authOptions[0]?.name ?? '')\n const selectedAuth = authOptions.find((option) => option.name === selectedAuthName)\n const [authValues, setAuthValues] = useState<Record<string, string>>({})\n const [authOpen, setAuthOpen] = useState(false)\n const authInput: RequestAuthInput | undefined = selectedAuth\n ? { name: selectedAuth.name, scheme: selectedAuth.scheme, value: authValues[selectedAuth.name] ?? authPlaceholder(selectedAuth) }\n : undefined\n\n return (\n <div className=\"space-y-4\">\n <EndpointIdentity\n method={method}\n path={endpoint.path}\n servers={servers}\n selectedServerKey={selectedServerKey}\n selectedServer={selectedServer}\n serverVariables={serverVariables}\n serverOpen={serverOpen}\n authOptions={authOptions}\n selectedAuthName={selectedAuthName}\n selectedAuth={selectedAuth}\n authValues={authValues}\n authOpen={authOpen}\n onSelectServer={(value) => {\n const nextServer = servers.find((server, index) => getServerKey(server, index) === value) ?? servers[0]\n setSelectedServerKey(value)\n setServerVariables(defaultServerVariables(nextServer))\n }}\n onChangeServerVariable={(name, value) => setServerVariables((current) => ({ ...current, [name]: value }))}\n onToggleServer={() => {\n setServerOpen((current) => !current)\n setAuthOpen(false)\n }}\n onToggleAuth={() => {\n setAuthOpen((current) => !current)\n setServerOpen(false)\n }}\n onSelectAuth={setSelectedAuthName}\n onChangeAuthValue={(name, value) => setAuthValues((current) => ({ ...current, [name]: value }))}\n />\n <div className=\"grid min-w-0 gap-4 lg:grid-cols-2\">\n <RequestExamplesPanel\n spec={spec}\n path={endpoint.path}\n method={method}\n parameters={parameters}\n requestContents={requestContents}\n selectedMediaType={selectedRequestContent?.mediaType ?? ''}\n onSelectMediaType={setSelectedRequestMediaType}\n selectedServer={selectedServer}\n serverVariables={serverVariables}\n auth={authInput}\n />\n <ResponseExamplesPanel operation={operation} spec={spec} />\n </div>\n </div>\n )\n}\n","import { Menu, X } from 'lucide-react'\nimport type { ReactNode } from 'react'\nimport { useState } from 'react'\nimport { MemoryRouter } from 'react-router-dom'\n\nimport { SectionProvider } from './app/SectionProvider'\nimport type { Section } from './app/SectionProvider'\nimport { ConfigContext, LocaleContext, OpenApisContext } from './context'\nimport { OpenApiExamplesPreview } from './preview/openapi'\nimport type { PreviewEndpoint } from './preview/openapi'\nimport { Navigation } from './shell'\nimport type { Config, NavigationNode } from './types'\n\nexport type PreviewGuide = {\n label: string\n title: string\n body: string\n embed: string\n outputs?: string[]\n}\n\nexport type PreviewMetric = {\n label: string\n value: string\n hint?: string\n}\n\nexport type PreviewCard = {\n title: string\n description: string\n}\n\nconst embeddedEndpoint = {\n method: 'GET',\n path: '/examples/basic-request',\n summary: 'Basic request',\n description: 'Rendered from api.openapi.json inside the MDX guide.',\n parameters: [\n { name: 'cursor', in: 'query', type: 'string', description: 'Start after this cursor.' },\n { name: 'limit', in: 'query', type: 'integer', description: 'Max items to return.' },\n { name: 'X-Trace-Id', in: 'header', type: 'string', description: 'Optional request trace.' },\n ],\n responseDescription: 'A page of example records.',\n responseSchema: {\n type: 'object',\n required: ['items'],\n properties: {\n items: { type: 'array', items: { type: 'object' } },\n next: { type: 'string' },\n },\n },\n responseExample: {\n items: [],\n next: 'cursor_2',\n },\n} satisfies PreviewEndpoint\n\nconst embeddedGuide = {\n label: 'source/en-US/openapi/embedding.mdx',\n title: 'Embed OpenAPI in MDX',\n body: 'Use MDX for workflow context, then render the exact operation from the spec.',\n embed: '<OpenApiOperation specPath=\"/api\" path=\"/examples/basic-request\" method=\"get\" />',\n outputs: ['/openapi/embedding', '/api', '/api.openapi.json', '/llms.txt'],\n} satisfies PreviewGuide\n\nconst staticOutputEndpoint = {\n method: 'POST',\n path: '/api/{id}/path',\n summary: 'Create static build',\n description: 'Build static docs from MDX and OpenAPI sources.',\n parameters: [\n { name: 'id', in: 'path', type: 'string', required: true, description: 'Project ID.' }\n ],\n responseDescription: 'Build metadata and static outputs.',\n responseSchema: {\n type: 'object',\n required: ['id', 'status', 'outputs'],\n properties: {\n id: { type: 'string', description: 'Build identifier.' },\n status: { type: 'string', enum: ['queued', 'running', 'ready'], description: 'Current build state.' },\n outputs: {\n type: 'array',\n description: 'Generated static artifacts.',\n items: {\n type: 'object',\n required: ['path', 'kind'],\n properties: {\n path: { type: 'string' },\n kind: { type: 'string', enum: ['html', 'asset', 'openapi', 'llms'] },\n },\n },\n },\n },\n },\n requestDescription: 'Static build options.',\n requestSchema: {\n type: 'object',\n required: ['source', 'output'],\n properties: {\n source: { type: 'string', description: 'MDX source root.' },\n output: { type: 'string', description: 'Static output root.' },\n includeSearchIndex: { type: 'boolean', description: 'Generate search data.' },\n },\n },\n requestExample: {\n source: 'source',\n output: 'output',\n includeSearchIndex: true,\n },\n responseExample: {\n id: 'build_01HY',\n status: 'ready',\n outputs: [\n { path: '/openapi/index.html', kind: 'html' },\n { path: '/api.openapi.json', kind: 'openapi' },\n { path: '/llms.txt', kind: 'llms' },\n ],\n },\n} satisfies PreviewEndpoint\n\nconst previewConfig = {\n title: 'Clarify preview',\n description: 'Renderer preview environment',\n rootDirectory: 'source',\n routePrefix: '/',\n outputDirectory: 'output',\n theme: {\n preset: 'default',\n tokens: {\n colors: {\n primary: '#2563eb',\n accent: '#60a5fa',\n background: '#ffffff',\n foreground: '#18181b',\n surface: '#ffffff',\n muted: '#71717a',\n border: 'rgb(24 24 27 / 0.1)',\n codeBackground: '#f4f4f5',\n },\n radius: {\n sm: '0.375rem',\n md: '0.5rem',\n lg: '0.75rem',\n xl: '1rem',\n },\n },\n layout: {\n maxWidth: '88rem',\n },\n editor: false,\n },\n i18n: {\n defaultLocale: 'en',\n missing: 'fallback',\n locales: [{ code: 'en', label: 'English' }],\n },\n} satisfies Config\n\nconst methodStyles: Record<string, string> = {\n GET: 'bg-emerald-400/15 text-emerald-600 dark:bg-emerald-400/20 dark:text-emerald-300',\n POST: 'bg-sky-400/15 text-sky-600 dark:bg-sky-400/20 dark:text-sky-300',\n PUT: 'bg-amber-400/15 text-amber-600 dark:bg-amber-400/20 dark:text-amber-300',\n PATCH: 'bg-amber-400/15 text-amber-600 dark:bg-amber-400/20 dark:text-amber-300',\n DELETE: 'bg-rose-400/15 text-rose-600 dark:bg-rose-400/20 dark:text-rose-300',\n}\n\nconst mainPreviewPath = '/openapi/embedding'\n\nconst mainPreviewSections = [\n { id: 'overview', title: 'Overview' },\n { id: 'request-example', title: 'Request example' }\n] satisfies Section[]\n\ntype PreviewEnvironmentProps = { children: ReactNode; initialEntry?: string; sections?: Section[] }\n\nfunction PreviewEnvironment(arg0: PreviewEnvironmentProps) {\n const { children, initialEntry = '/preview', sections = [] } = arg0\n\n return (\n <MemoryRouter initialEntries={[initialEntry]}>\n <ConfigContext.Provider value={previewConfig}>\n <LocaleContext.Provider value={previewConfig.i18n.defaultLocale}>\n <OpenApisContext.Provider value={{}}>\n <SectionProvider sections={sections}>\n {children}\n </SectionProvider>\n </OpenApisContext.Provider>\n </LocaleContext.Provider>\n </ConfigContext.Provider>\n </MemoryRouter>\n )\n}\n\ntype ChromeProps = { title: string; status?: string; headerAction?: ReactNode; children: ReactNode }\n\nfunction Chrome(arg0: ChromeProps) {\n const { title, status, headerAction, children } = arg0\n\n return (\n <div className=\"clarify-app clarify-preview h-full overflow-hidden bg-(--clarify-theme-tokens-colors-background) text-(--clarify-ui-text) shadow-2xl ring-1 ring-(--clarify-theme-tokens-colors-border) dark:bg-zinc-950 dark:text-white dark:ring-white/10\">\n <div className=\"flex items-center gap-3 border-b border-(--clarify-theme-tokens-colors-border) px-4 py-3 text-xs/6 text-(--clarify-ui-text-faint) dark:border-white/10\">\n <span className=\"size-2 rounded-full bg-rose-400\" />\n <span className=\"size-2 rounded-full bg-amber-400\" />\n <span className=\"size-2 rounded-full bg-emerald-400\" />\n <span className=\"ml-2 min-w-0 flex-1 truncate font-medium text-(--clarify-ui-text-soft)\">{title}</span>\n {status ? <span className=\"hidden rounded-full bg-emerald-400/15 px-2 py-0.5 font-medium text-emerald-700 sm:inline dark:text-emerald-300\">{status}</span> : null}\n {headerAction}\n </div>\n {children}\n </div>\n )\n}\n\ntype MethodBadgeProps = { method: string }\n\nfunction MethodBadge(arg0: MethodBadgeProps) {\n const method = arg0.method.toUpperCase()\n\n return (\n <span className={`rounded-md px-2.5 py-0.5 text-xs/6 font-black tracking-wide ${methodStyles[method] ?? 'bg-(--clarify-ui-subtle-background) text-(--clarify-ui-text-soft)'}`}>\n {method}\n </span>\n )\n}\n\ntype CreatePreviewNavigationProps = { endpoint: PreviewEndpoint; guide?: PreviewGuide; outputs: string[] }\n\nfunction createPreviewNavigation(arg0: CreatePreviewNavigationProps): NavigationNode[] {\n const { endpoint, guide, outputs } = arg0\n\n return [\n {\n title: 'Guides',\n path: '/guides',\n icon: 'BookOpenText',\n children: [\n { title: guide?.title ?? 'MDX guide', path: mainPreviewPath, icon: 'FileText' },\n { title: 'Getting started', path: '/getting-started', icon: 'Rocket' },\n ],\n },\n {\n title: 'API Reference',\n path: '/api',\n icon: 'Braces',\n children: [\n { title: endpoint.summary, path: endpoint.path, icon: 'Cable' },\n { title: 'Generate static output', path: staticOutputEndpoint.path, icon: 'UploadCloud' },\n ],\n },\n {\n title: 'Build Output',\n path: '/output',\n icon: 'PackageCheck',\n children: [\n { title: `Routes (${outputs.length})`, path: '/output/routes', icon: 'ListTree' }\n ],\n },\n ] satisfies NavigationNode[]\n}\n\ntype PreviewNavigationProps = { endpoint: PreviewEndpoint; guide?: PreviewGuide; outputs: string[] }\n\nfunction PreviewNavigation(arg0: PreviewNavigationProps) {\n return <Navigation navigation={createPreviewNavigation(arg0)} className=\"px-2\" />\n}\n\ntype MainPreviewMobileNavigationProps = PreviewNavigationProps & { isOpen: boolean; onClose: () => void }\n\nfunction MainPreviewMobileNavigation(arg0: MainPreviewMobileNavigationProps) {\n const { isOpen, onClose, ...navigationProps } = arg0\n const navigationId = 'clarify-main-preview-mobile-navigation'\n\n return (\n <div className=\"clarify-preview-mobile-navigation pointer-events-none absolute inset-0 z-20\">\n {isOpen ? (\n <button\n type=\"button\"\n className=\"absolute inset-0 bg-zinc-950/20 backdrop-blur-[1px] dark:bg-black/30\"\n aria-label=\"Close documentation menu\"\n onClick={onClose}\n />\n ) : null}\n <aside\n id={navigationId}\n className=\"pointer-events-auto absolute top-0 bottom-0 left-0 w-64 max-w-[82%] overflow-y-auto border-r border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-background) px-1 py-4 text-sm/7 shadow-2xl shadow-zinc-900/20 transition-transform duration-200 ease-out data-closed:-translate-x-full dark:border-white/10 dark:bg-zinc-950 dark:shadow-black/40\"\n data-closed={!isOpen ? 'true' : undefined}\n >\n <PreviewNavigation {...navigationProps} />\n </aside>\n </div>\n )\n}\n\ntype PreviewMetricGridProps = { metrics: PreviewMetric[] }\n\nfunction PreviewMetricGrid(arg0: PreviewMetricGridProps) {\n const { metrics } = arg0\n\n return (\n <div className=\"grid grid-cols-1 gap-2 sm:grid-cols-3\">\n {metrics.map((metric) => (\n <div key={metric.label} className=\"rounded-xl border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) p-2.5 shadow-sm dark:border-white/10 dark:bg-zinc-900/50\">\n <div className=\"text-xs/5 text-(--clarify-ui-text-faint)\">{metric.label}</div>\n <div className=\"text-base/6 font-semibold text-(--clarify-ui-text-strong)\">{metric.value}</div>\n {metric.hint ? <div className=\"text-xs/5 text-(--clarify-ui-text-faint)\">{metric.hint}</div> : null}\n </div>\n ))}\n </div>\n )\n}\n\ntype PreviewLabelProps = { children: ReactNode }\n\nfunction PreviewLabel(arg0: PreviewLabelProps) {\n return <div className=\"text-xs/5 font-semibold uppercase tracking-wider text-(--clarify-ui-text-faint)\">{arg0.children}</div>\n}\n\ntype GuideSummaryPreviewProps = { guide: PreviewGuide }\n\nfunction GuideSummaryPreview(arg0: GuideSummaryPreviewProps) {\n const { guide } = arg0\n\n return (\n <header className=\"border-b border-(--clarify-theme-tokens-colors-border) pb-4 dark:border-white/10\">\n <PreviewLabel>{guide.label}</PreviewLabel>\n <h2 className=\"mt-1 text-xl/7 font-semibold tracking-tight text-(--clarify-ui-text-strong)\">{guide.title}</h2>\n <p className=\"mt-2 max-w-2xl text-sm/6 text-(--clarify-ui-text-soft)\">{guide.body}</p>\n <pre className=\"mt-3 overflow-hidden rounded-xl bg-zinc-950 px-3 py-2 text-xs/5 whitespace-pre-wrap text-zinc-300\">{guide.embed}</pre>\n </header>\n )\n}\n\ntype EndpointSummaryPreviewProps = { endpoint: PreviewEndpoint }\n\nfunction EndpointSummaryPreview(arg0: EndpointSummaryPreviewProps) {\n const { endpoint } = arg0\n\n return (\n <div className=\"min-w-0\">\n <div className=\"flex flex-wrap items-center gap-3\">\n <MethodBadge method={endpoint.method} />\n <code className=\"text-sm font-medium text-(--clarify-ui-text)\">{endpoint.path}</code>\n </div>\n <h3 className=\"mt-3 text-lg/7 font-semibold tracking-tight text-(--clarify-ui-text-strong)\">{endpoint.summary}</h3>\n <p className=\"mt-1 text-sm/6 text-(--clarify-ui-text-soft)\">{endpoint.description}</p>\n </div>\n )\n}\n\ntype EmbeddedApiPreviewProps = { endpoint: PreviewEndpoint }\n\nfunction EmbeddedApiPreview(arg0: EmbeddedApiPreviewProps) {\n const { endpoint } = arg0\n\n return (\n <div className=\"clarify-preview-api-frame min-w-0 overflow-hidden border-t border-(--clarify-theme-tokens-colors-border) pt-4 dark:border-white/10\">\n <div className=\"clarify-preview-api-content clarify-preview-api-content-embedded\">\n <OpenApiExamplesPreview endpoint={endpoint} />\n </div>\n </div>\n )\n}\n\ntype OutputListPreviewProps = { outputs: string[] }\n\nfunction OutputListPreview(arg0: OutputListPreviewProps) {\n const { outputs } = arg0\n\n return (\n <div className=\"border-t border-(--clarify-theme-tokens-colors-border) pt-4 dark:border-white/10\">\n <PreviewLabel>Static output</PreviewLabel>\n <div className=\"mt-3 grid gap-2 sm:grid-cols-2 xl:grid-cols-4\">\n {outputs.map((output) => (\n <div key={output} className=\"flex items-center gap-2 rounded-lg bg-(--clarify-ui-subtle-background) px-3 py-2 text-xs/5 text-(--clarify-ui-text-soft) dark:bg-white/5\">\n <span className=\"size-1.5 rounded-full bg-emerald-400\" />\n <span className=\"truncate font-mono\">{output}</span>\n </div>\n ))}\n </div>\n </div>\n )\n}\n\nfunction MainContentPreview() {\n return (\n <section className=\"min-w-0 bg-(--clarify-theme-tokens-colors-background) px-5 py-4 dark:bg-zinc-950\">\n <div className=\"clarify-preview-content-window overflow-hidden\">\n <div className=\"space-y-4\">\n <GuideSummaryPreview guide={embeddedGuide} />\n <PreviewMetricGrid metrics={[\n { label: 'MDX', value: 'Guide', hint: 'context' },\n { label: 'Spec', value: 'OpenAPI', hint: 'source' },\n { label: 'Out', value: 'Static', hint: 'CDN' },\n ]} />\n <div className=\"clarify-preview-endpoint-grid grid gap-4\">\n <EndpointSummaryPreview endpoint={embeddedEndpoint} />\n <EmbeddedApiPreview endpoint={embeddedEndpoint} />\n </div>\n <OutputListPreview outputs={embeddedGuide.outputs ?? []} />\n </div>\n </div>\n </section>\n )\n}\n\nexport function MainPreview() {\n const [isMobileNavigationOpen, setMobileNavigationOpen] = useState(false)\n const navigationProps = { endpoint: embeddedEndpoint, guide: embeddedGuide, outputs: embeddedGuide.outputs ?? [] }\n\n return (\n <PreviewEnvironment initialEntry={mainPreviewPath} sections={mainPreviewSections}>\n <Chrome\n title=\"source/en-US/openapi/embedding.mdx\"\n status=\"Rendered from OpenAPI + MDX\"\n headerAction={\n <button\n type=\"button\"\n className=\"clarify-preview-mobile-menu-button -my-1 flex size-7 items-center justify-center rounded-(--clarify-theme-tokens-radius-md) text-(--clarify-ui-text-strong) transition hover:bg-(--clarify-ui-hover-background)\"\n aria-controls=\"clarify-main-preview-mobile-navigation\"\n aria-expanded={isMobileNavigationOpen}\n aria-label={isMobileNavigationOpen ? 'Close documentation menu' : 'Open documentation menu'}\n onClick={() => setMobileNavigationOpen((value) => !value)}\n >\n {isMobileNavigationOpen ? <X className=\"h-4 w-4 shrink-0\" /> : <Menu className=\"h-4 w-4 shrink-0\" />}\n </button>\n }\n >\n <div className=\"clarify-preview-shell relative grid overflow-hidden\">\n <MainPreviewMobileNavigation {...navigationProps} isOpen={isMobileNavigationOpen} onClose={() => setMobileNavigationOpen(false)} />\n <aside className=\"clarify-preview-sidebar border-r border-(--clarify-theme-tokens-colors-border) px-1 py-4 text-sm/7 dark:border-white/10 dark:bg-white/5\">\n <PreviewNavigation {...navigationProps} />\n </aside>\n <MainContentPreview />\n </div>\n </Chrome>\n </PreviewEnvironment>\n )\n}\n\nexport function MdxPreview() {\n return (\n <PreviewEnvironment>\n <Chrome title=\"source/started/index.mdx\" status=\"Rendered by renderer\">\n <div className=\"clarify-preview-body overflow-x-hidden overflow-y-auto bg-(--clarify-theme-tokens-colors-background) p-4 sm:p-5 dark:bg-zinc-950\">\n <article className=\"max-w-3xl text-sm/7 text-(--clarify-ui-text-soft)\">\n <div className=\"inline-flex rounded-full bg-(--clarify-ui-accent-background) px-3 py-1 text-xs/5 font-semibold text-(--clarify-ui-accent-text)\">MDX page</div>\n <h2 className=\"mt-3 text-xl/7 font-semibold tracking-tight text-(--clarify-ui-text-strong) sm:text-2xl/8\">Get Started</h2>\n <p className=\"mt-3\">Write pages in source/. Clarify turns MDX, config, and OpenAPI files into routes.</p>\n <div className=\"mt-4 rounded-2xl border border-(--clarify-ui-accent-border) bg-(--clarify-ui-accent-background) p-4 text-sm/6 text-(--clarify-ui-text-strong) sm:mt-5\">\n <div className=\"font-semibold text-(--clarify-ui-text-strong)\">Static output ready</div>\n <p className=\"mt-1\">output/ is plain static files.</p>\n </div>\n <div className=\"mt-4 grid gap-3 sm:mt-5 sm:grid-cols-2 sm:gap-4\">\n <div className=\"rounded-2xl border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) p-5 shadow-sm dark:border-white/10 dark:bg-zinc-900/50\">\n <h3 className=\"text-base/6 font-semibold text-(--clarify-ui-text-strong)\">MDX pages</h3>\n <p className=\"mt-2 text-sm/6\">Guides live beside code.</p>\n </div>\n <div className=\"rounded-2xl border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) p-5 shadow-sm dark:border-white/10 dark:bg-zinc-900/50\">\n <h3 className=\"text-base/6 font-semibold text-(--clarify-ui-text-strong)\">API embeds</h3>\n <p className=\"mt-2 text-sm/6\">Specs render inline.</p>\n </div>\n </div>\n <div className=\"mt-5 rounded-2xl border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) p-5 shadow-sm dark:border-white/10 dark:bg-zinc-900/50\">\n <div className=\"flex items-center gap-3\">\n <MethodBadge method={embeddedEndpoint.method} />\n <code className=\"text-sm font-medium text-(--clarify-ui-text)\">{embeddedEndpoint.path}</code>\n </div>\n <p className=\"mt-3 text-sm/6\">{embeddedEndpoint.description}</p>\n </div>\n </article>\n </div>\n </Chrome>\n </PreviewEnvironment>\n )\n}\n\nexport function OpenApiPreview() {\n return (\n <PreviewEnvironment>\n <Chrome title=\"source/api.openapi.json\" status=\"Endpoint + examples\">\n <div className=\"clarify-preview-openapi-window overflow-x-hidden overflow-y-auto bg-(--clarify-theme-tokens-colors-background) px-3 py-3 sm:px-4 sm:py-4 dark:bg-zinc-950\">\n <div className=\"clarify-preview-openapi-mask min-h-full\">\n <div className=\"clarify-preview-api-content clarify-preview-api-content-openapi origin-top pb-6 sm:pb-10\">\n <OpenApiExamplesPreview endpoint={staticOutputEndpoint} />\n </div>\n </div>\n </div>\n </Chrome>\n </PreviewEnvironment>\n )\n}\n"],"mappings":";;;;;;;AAyCA,SAAS,eAAe,MAAuB;CAC7C,IAAI,KAAK,SAAS,IAAI,GAAG,OAAO;EAAE,MAAM;EAAS,OAAO,eAAe,K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B,OAAS,CAAA,GAC/C,oBAAC,QAAD;QAAM,WAAU;kBAAgD,iBAAiB;OAAW,CAAA,CACzF;UACL,oBAAC,KAAD;OAAG,WAAU;iBAAkB,iBAAiB;MAAe,CAAA,CAC5D;;IACE;;EACN,CAAA;CACC,CAAA,EACU,CAAA;AAExB;AAEA,SAAgB,iBAAiB;CAC/B,OACE,oBAAC,oBAAD,EAAA,UACE,oBAAC,QAAD;EAAQ,OAAM;EAA0B,QAAO;YAC7C,oBAAC,OAAD;GAAK,WAAU;aACb,oBAAC,OAAD;IAAK,WAAU;cACb,oBAAC,OAAD;KAAK,WAAU;eACb,oBAAC,wBAAD,EAAwB,UAAU,qBAAuB,CAAA;IACtD,CAAA;GACF,CAAA;EACF,CAAA;CACC,CAAA,EACU,CAAA;AAExB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_ThemeRoot = require("./ThemeRoot-
|
|
1
|
+
const require_PageActions = require("./PageActions-1RDCHcUY.cjs");
|
|
2
|
+
const require_ThemeRoot = require("./ThemeRoot-DYS-lcK-.cjs");
|
|
3
3
|
let react = require("react");
|
|
4
4
|
let react_router_dom = require("react-router-dom");
|
|
5
5
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -23,22 +23,24 @@ function isHydrationDebugEnabled() {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
function render(options) {
|
|
26
|
-
const { config, routes, navigation, openApis = {}, container, themeEditor = false } = options;
|
|
26
|
+
const { config, routes, navigation, openApis = {}, bannerComponent, footerComponent, container, themeEditor = false } = options;
|
|
27
27
|
const target = container ?? document.getElementById("root");
|
|
28
28
|
if (!target) throw new Error("[clarify] 渲染失败:找不到挂载节点,请确保 HTML 中存在 id=\"root\" 的元素");
|
|
29
29
|
const app = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.StrictMode, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_router_dom.BrowserRouter, {
|
|
30
30
|
basename: config.routePrefix,
|
|
31
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
31
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PageActions.ConfigContext.Provider, {
|
|
32
32
|
value: config,
|
|
33
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
33
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PageActions.OpenApisContext.Provider, {
|
|
34
34
|
value: openApis,
|
|
35
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
35
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PageActions.ThemeProvider, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ThemeRoot.ThemeRoot, {
|
|
36
36
|
theme: config.theme,
|
|
37
37
|
themeEditor,
|
|
38
38
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ThemeRoot.AppShell, {
|
|
39
39
|
config,
|
|
40
40
|
routes,
|
|
41
|
-
navigation: navigation ?? []
|
|
41
|
+
navigation: navigation ?? [],
|
|
42
|
+
bannerComponent,
|
|
43
|
+
footerComponent
|
|
42
44
|
})
|
|
43
45
|
}) })
|
|
44
46
|
})
|
|
@@ -62,4 +64,4 @@ Object.defineProperty(exports, "render", {
|
|
|
62
64
|
}
|
|
63
65
|
});
|
|
64
66
|
|
|
65
|
-
//# sourceMappingURL=render-
|
|
67
|
+
//# sourceMappingURL=render-CRTqZzyY.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-CRTqZzyY.cjs","names":[],"sources":["../source/runtime/render.tsx"],"sourcesContent":["import { StrictMode } from 'react'\nimport { hydrateRoot, createRoot } from 'react-dom/client'\nimport { BrowserRouter } from 'react-router-dom'\n\nimport { AppShell } from '../app/AppShell'\nimport { ConfigContext, OpenApisContext } from '../context'\nimport { ThemeProvider } from '../theme/ThemeProvider'\nimport { ThemeRoot } from '../theme/ThemeRoot'\nimport type { RenderOptions } from '../types'\n\n/**\n * Clarify 客户端 Hydration 入口。\n * 在文档项目的 main.tsx 中调用:\n * ```ts\n * import { render } from '@clarify-labs/renderer';\n * import { routes } from 'virtual:clarify-routes';\n * import { config } from 'virtual:clarify-config';\n * render({ config, routes });\n * ```\n */\nfunction isHydrationDebugEnabled(): boolean {\n try {\n const params = new URLSearchParams(window.location.search)\n return params.get('clarifyHydrationDebug') === '1' || window.localStorage.getItem('clarify:hydration-debug') === '1'\n } catch {\n return false\n }\n}\n\nexport function render(options: RenderOptions) {\n const { config, routes, navigation, openApis = {}, bannerComponent, footerComponent, container, themeEditor = false } = options\n\n const target = container ?? document.getElementById('root')\n if (!target) {\n throw new Error('[clarify] 渲染失败:找不到挂载节点,请确保 HTML 中存在 id=\"root\" 的元素')\n }\n\n const app = (\n <StrictMode>\n <BrowserRouter basename={config.routePrefix}>\n <ConfigContext.Provider value={config}>\n <OpenApisContext.Provider value={openApis}>\n <ThemeProvider>\n <ThemeRoot theme={config.theme} themeEditor={themeEditor}>\n <AppShell config={config} routes={routes} navigation={navigation ?? []} bannerComponent={bannerComponent} footerComponent={footerComponent} />\n </ThemeRoot>\n </ThemeProvider>\n </OpenApisContext.Provider>\n </ConfigContext.Provider>\n </BrowserRouter>\n </StrictMode>\n )\n\n const hydrationDebug = isHydrationDebugEnabled()\n\n try {\n hydrateRoot(target as Element, app, {\n onRecoverableError(error, errorInfo) {\n // Phase 1: suppress hydration mismatch noise by default. React 19\n // recovers automatically, but diagnostics can be enabled explicitly.\n if (hydrationDebug) {\n console.warn('[clarify] Recoverable hydration error:', error, errorInfo)\n }\n },\n })\n } catch (err) {\n console.warn('[clarify] Hydration failed, falling back to client render:', err)\n createRoot(target as Element).render(app)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAoBA,SAAS,0BAAmC;CAC1C,IAAI;EAEF,OAAO,IADY,gBAAgB,OAAO,SAAS,MAC5C,EAAO,IAAI,uBAAuB,MAAM,OAAO,OAA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O as ConfigContext, m as ThemeProvider } from "./PageActions-yoDRjkq8.js";
|
|
2
|
+
import { c as AppShell, t as ThemeRoot } from "./ThemeRoot-CLa0yvRQ.js";
|
|
3
3
|
import { StrictMode } from "react";
|
|
4
4
|
import { BrowserRouter } from "react-router-dom";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -23,12 +23,12 @@ function isHydrationDebugEnabled() {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
function render(options) {
|
|
26
|
-
const { config, routes, navigation, openApis = {}, container, themeEditor = false } = options;
|
|
26
|
+
const { config, routes, navigation, openApis = {}, bannerComponent, footerComponent, container, themeEditor = false } = options;
|
|
27
27
|
const target = container ?? document.getElementById("root");
|
|
28
28
|
if (!target) throw new Error("[clarify] 渲染失败:找不到挂载节点,请确保 HTML 中存在 id=\"root\" 的元素");
|
|
29
29
|
const app = /* @__PURE__ */ jsx(StrictMode, { children: /* @__PURE__ */ jsx(BrowserRouter, {
|
|
30
30
|
basename: config.routePrefix,
|
|
31
|
-
children: /* @__PURE__ */ jsx(
|
|
31
|
+
children: /* @__PURE__ */ jsx(ConfigContext.Provider, {
|
|
32
32
|
value: config,
|
|
33
33
|
children: /* @__PURE__ */ jsx(OpenApisContext.Provider, {
|
|
34
34
|
value: openApis,
|
|
@@ -38,7 +38,9 @@ function render(options) {
|
|
|
38
38
|
children: /* @__PURE__ */ jsx(AppShell, {
|
|
39
39
|
config,
|
|
40
40
|
routes,
|
|
41
|
-
navigation: navigation ?? []
|
|
41
|
+
navigation: navigation ?? [],
|
|
42
|
+
bannerComponent,
|
|
43
|
+
footerComponent
|
|
42
44
|
})
|
|
43
45
|
}) })
|
|
44
46
|
})
|
|
@@ -57,4 +59,4 @@ function render(options) {
|
|
|
57
59
|
//#endregion
|
|
58
60
|
export { render as t };
|
|
59
61
|
|
|
60
|
-
//# sourceMappingURL=render-
|
|
62
|
+
//# sourceMappingURL=render-D0ls3d2j.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-D0ls3d2j.js","names":[],"sources":["../source/runtime/render.tsx"],"sourcesContent":["import { StrictMode } from 'react'\nimport { hydrateRoot, createRoot } from 'react-dom/client'\nimport { BrowserRouter } from 'react-router-dom'\n\nimport { AppShell } from '../app/AppShell'\nimport { ConfigContext, OpenApisContext } from '../context'\nimport { ThemeProvider } from '../theme/ThemeProvider'\nimport { ThemeRoot } from '../theme/ThemeRoot'\nimport type { RenderOptions } from '../types'\n\n/**\n * Clarify 客户端 Hydration 入口。\n * 在文档项目的 main.tsx 中调用:\n * ```ts\n * import { render } from '@clarify-labs/renderer';\n * import { routes } from 'virtual:clarify-routes';\n * import { config } from 'virtual:clarify-config';\n * render({ config, routes });\n * ```\n */\nfunction isHydrationDebugEnabled(): boolean {\n try {\n const params = new URLSearchParams(window.location.search)\n return params.get('clarifyHydrationDebug') === '1' || window.localStorage.getItem('clarify:hydration-debug') === '1'\n } catch {\n return false\n }\n}\n\nexport function render(options: RenderOptions) {\n const { config, routes, navigation, openApis = {}, bannerComponent, footerComponent, container, themeEditor = false } = options\n\n const target = container ?? document.getElementById('root')\n if (!target) {\n throw new Error('[clarify] 渲染失败:找不到挂载节点,请确保 HTML 中存在 id=\"root\" 的元素')\n }\n\n const app = (\n <StrictMode>\n <BrowserRouter basename={config.routePrefix}>\n <ConfigContext.Provider value={config}>\n <OpenApisContext.Provider value={openApis}>\n <ThemeProvider>\n <ThemeRoot theme={config.theme} themeEditor={themeEditor}>\n <AppShell config={config} routes={routes} navigation={navigation ?? []} bannerComponent={bannerComponent} footerComponent={footerComponent} />\n </ThemeRoot>\n </ThemeProvider>\n </OpenApisContext.Provider>\n </ConfigContext.Provider>\n </BrowserRouter>\n </StrictMode>\n )\n\n const hydrationDebug = isHydrationDebugEnabled()\n\n try {\n hydrateRoot(target as Element, app, {\n onRecoverableError(error, errorInfo) {\n // Phase 1: suppress hydration mismatch noise by default. React 19\n // recovers automatically, but diagnostics can be enabled explicitly.\n if (hydrationDebug) {\n console.warn('[clarify] Recoverable hydration error:', error, errorInfo)\n }\n },\n })\n } catch (err) {\n console.warn('[clarify] Hydration failed, falling back to client render:', err)\n createRoot(target as Element).render(app)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAoBA,SAAS,0BAAmC;CAC1C,IAAI;EAEF,OAAO,IADY,gBAAgB,OAAO,SAAS,MAC5C,EAAO,IAAI,uBAAuB,MAAM,OAAO,OAAO,aAAa,QAAQ,yBAAyB,MAAM;CACnH,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAgB,OAAO,SAAwB;CAC7C,MAAM,EAAE,QAAQ,QAAQ,YAAY,WAAW,CAAC,GAAG,iBAAiB,iBAAiB,WAAW,cAAc,UAAU;CAExH,MAAM,SAAS,aAAa,SAAS,eAAe,MAAM;CAC1D,IAAI,CAAC,QACH,MAAM,IAAI,MAAM,qDAAmD;CAGrE,MAAM,MACJ,oBAAC,YAAD,EAAA,UACE,oBAAC,eAAD;EAAe,UAAU,OAAO;YAC9B,oBAAC,cAAc,UAAf;GAAwB,OAAO;aAC7B,oBAAC,gBAAgB,UAAjB;IAA0B,OAAO;cAC/B,oBAAC,eAAD,EAAA,UACE,oBAAC,WAAD;KAAW,OAAO,OAAO;KAAoB;eAC3C,oBAAC,UAAD;MAAkB;MAAgB;MAAQ,YAAY,cAAc,CAAC;MAAoB;MAAkC;KAAkB,CAAA;IACpI,CAAA,EACE,CAAA;GACS,CAAA;EACJ,CAAA;CACX,CAAA,EACL,CAAA;CAGd,MAAM,iBAAiB,wBAAwB;CAE/C,IAAI;EACF,YAAY,QAAmB,KAAK,EAClC,mBAAmB,OAAO,WAAW;GAGnC,IAAI,gBACF,QAAQ,KAAK,0CAA0C,OAAO,SAAS;EAE3E,EACF,CAAC;CACH,SAAS,KAAK;EACZ,QAAQ,KAAK,8DAA8D,GAAG;EAC9E,WAAW,MAAiB,EAAE,OAAO,GAAG;CAC1C;AACF"}
|