@clarify-labs/renderer 0.11.4 → 0.11.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/output/{ClarifyShell-gzlibEm8.js → ClarifyShell-CKvXZj0f.js} +120 -41
  2. package/output/ClarifyShell-CKvXZj0f.js.map +1 -0
  3. package/output/{ClarifyShell-Cvb7Nk3A.cjs → ClarifyShell-CukbPOAd.cjs} +120 -41
  4. package/output/ClarifyShell-CukbPOAd.cjs.map +1 -0
  5. package/output/{MermaidViewer-CPuTNujY.cjs → MermaidViewer-FOg263MO.cjs} +6 -7
  6. package/output/MermaidViewer-FOg263MO.cjs.map +1 -0
  7. package/output/{MermaidViewer-EVuBmrzA.js → MermaidViewer-_tpH0JNn.js} +6 -7
  8. package/output/MermaidViewer-_tpH0JNn.js.map +1 -0
  9. package/output/{OpenApiOperation-Ddax6Pen.js → OpenApiOperation-Dv9u2GEJ.js} +63 -59
  10. package/output/OpenApiOperation-Dv9u2GEJ.js.map +1 -0
  11. package/output/{OpenApiOperation-QqYCuqve.cjs → OpenApiOperation-c-I6Nw9j.cjs} +82 -60
  12. package/output/OpenApiOperation-c-I6Nw9j.cjs.map +1 -0
  13. package/output/{PageActions-BBRz0tJ4.js → PageActions-DviEypf6.js} +41 -43
  14. package/output/PageActions-DviEypf6.js.map +1 -0
  15. package/output/{PageActions-ypH6U0Vc.cjs → PageActions-ob2OJusG.cjs} +41 -43
  16. package/output/PageActions-ob2OJusG.cjs.map +1 -0
  17. package/output/{SearchDialog-Df6jknma.js → SearchDialog-89JAjQMh.js} +3 -3
  18. package/output/{SearchDialog-Df6jknma.js.map → SearchDialog-89JAjQMh.js.map} +1 -1
  19. package/output/{SearchDialog-DCGBhNnW.cjs → SearchDialog-CTiUIKeo.cjs} +3 -3
  20. package/output/{SearchDialog-DCGBhNnW.cjs.map → SearchDialog-CTiUIKeo.cjs.map} +1 -1
  21. package/output/app/AppShell.d.ts +1 -0
  22. package/output/app/BuiltWithClarify.d.ts +5 -1
  23. package/output/app/ContentDiagnostic.d.ts +1 -1
  24. package/output/client.cjs +3 -3
  25. package/output/client.js +3 -3
  26. package/output/{i18n-LXAq0RIC.js → i18n-Cff810G_.js} +3 -3
  27. package/output/i18n-Cff810G_.js.map +1 -0
  28. package/output/{i18n-Ds-f-qlT.cjs → i18n-Cjfk1N7i.cjs} +3 -3
  29. package/output/i18n-Cjfk1N7i.cjs.map +1 -0
  30. package/output/index.cjs +104 -20
  31. package/output/index.cjs.map +1 -1
  32. package/output/index.d.ts +3 -3
  33. package/output/index.js +102 -21
  34. package/output/index.js.map +1 -1
  35. package/output/mdx/components.d.ts +2 -1
  36. package/output/openapi/components/EndpointMethodBadge.d.ts +1 -0
  37. package/output/openapi/components/OpenApiLink.d.ts +9 -0
  38. package/output/openapi/components/OpenApiRequest.d.ts +1 -0
  39. package/output/openapi/components/useOpenApiRequestState.d.ts +1 -1
  40. package/output/openapi/entry.d.ts +4 -3
  41. package/output/openapi/index.d.ts +1 -0
  42. package/output/openapi/lib/utils.d.ts +1 -0
  43. package/output/preview.cjs +4 -4
  44. package/output/preview.cjs.map +1 -1
  45. package/output/preview.js +4 -4
  46. package/output/preview.js.map +1 -1
  47. package/output/{render-C2rZuVLy.js → render-B41PHjt8.js} +2 -2
  48. package/output/{render-C2rZuVLy.js.map → render-B41PHjt8.js.map} +1 -1
  49. package/output/{render-BQkaRYoY.cjs → render-BxiVlY6q.cjs} +2 -2
  50. package/output/{render-BQkaRYoY.cjs.map → render-BxiVlY6q.cjs.map} +1 -1
  51. package/output/renderer.css +38 -16
  52. package/output/server.cjs +2 -2
  53. package/output/server.js +2 -2
  54. package/package.json +1 -1
  55. package/output/ClarifyShell-Cvb7Nk3A.cjs.map +0 -1
  56. package/output/ClarifyShell-gzlibEm8.js.map +0 -1
  57. package/output/MermaidViewer-CPuTNujY.cjs.map +0 -1
  58. package/output/MermaidViewer-EVuBmrzA.js.map +0 -1
  59. package/output/OpenApiOperation-Ddax6Pen.js.map +0 -1
  60. package/output/OpenApiOperation-QqYCuqve.cjs.map +0 -1
  61. package/output/PageActions-BBRz0tJ4.js.map +0 -1
  62. package/output/PageActions-ypH6U0Vc.cjs.map +0 -1
  63. package/output/i18n-Ds-f-qlT.cjs.map +0 -1
  64. package/output/i18n-LXAq0RIC.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../source/app/ContentDiagnostic.tsx","../source/openapi/lib/spec-path.ts","../source/openapi/entry.tsx","../source/mdx/components.ts","../source/mdx/DocShell.tsx"],"sourcesContent":["import type { ComponentType } from 'react'\n\nimport { RenderErrorPanel } from './RenderErrorPanel'\n\nexport type ContentDiagnosticKind = 'markdown' | 'mdx' | 'openapi' | 'route-load'\n\nexport type ContentDiagnostic = {\n kind: ContentDiagnosticKind\n title: string\n message: string\n details?: string\n filePath?: string\n}\n\ntype ContentDiagnosticPanelProps = {\n data: ContentDiagnostic\n}\n\nfunction ContentDiagnosticPanel(params: ContentDiagnosticPanelProps) {\n const { data } = params\n const typeLabels: Record<ContentDiagnosticKind, string> = {\n markdown: 'Markdown',\n mdx: 'MDX',\n openapi: 'OpenAPI',\n 'route-load': 'Route',\n }\n const typeLabel = typeLabels[data.kind]\n const detailsLabel = data.kind === 'mdx' || data.kind === 'markdown' ? 'Why it happened' : 'Details'\n const pathLabel = 'File'\n\n return (\n <RenderErrorPanel\n title={data.title}\n description={data.message}\n titleId=\"clarify-content-diagnostic-title\"\n metadata={[\n { label: pathLabel, value: data.filePath ?? 'Unknown' },\n { label: 'Type', value: typeLabel },\n ]}\n detailsLabel={detailsLabel}\n detailsContent={data.details ? (\n <pre className=\"max-h-(--clarify-error-details-max-height) overflow-auto whitespace-pre-wrap wrap-break-word font-mono\">\n {data.details}\n </pre>\n ) : null}\n />\n )\n}\n\nexport function createContentDiagnosticComponent(data: ContentDiagnostic): ComponentType {\n return function ContentDiagnosticComponent() {\n return <ContentDiagnosticPanel data={data} />\n }\n}\n","import { useEffect, useState } from 'react'\nimport { useLocation } from 'react-router-dom'\n\nimport { useConfig, useLocale, useOpenApiSpecs } from '../../core/context'\n\nimport type { OpenAPISpec } from './utils'\n\ntype OpenApiSpecResult = {\n spec: OpenAPISpec | null\n loading: boolean\n}\n\ntype OpenApiSpecModule = { default: OpenAPISpec } | OpenAPISpec\n\ntype LoadedSpecState = {\n loader?: () => Promise<OpenApiSpecModule>\n spec: OpenAPISpec | null\n}\n\nfunction isOpenApiSpecLoader(value: unknown): value is () => Promise<OpenApiSpecModule> {\n return typeof value === 'function'\n}\n\nfunction getLoadedSpec(value: OpenApiSpecModule): OpenAPISpec {\n return value && typeof value === 'object' && 'default' in value\n ? value.default\n : value\n}\n\nconst VIRTUAL_PREFIX = 'virtual:clarify-page/'\n\nfunction resolveRelativePath(fromDir: string, to: string): string {\n const parts = (fromDir + '/' + to).split('/').filter(Boolean)\n const stack: string[] = []\n for (const part of parts) {\n if (part === '..') {\n stack.pop()\n } else if (part !== '.') {\n stack.push(part)\n }\n }\n return stack.join('/')\n}\n\nfunction normalizeSpecPath(specPath: string, currentRoutePath?: string, routePrefix = ''): string {\n if (specPath.startsWith(VIRTUAL_PREFIX)) return specPath\n\n const normalizedRoutePrefix = routePrefix.replace(/^\\/+|\\/+$/g, '')\n const normalizedSpecPath = specPath.startsWith('/') && normalizedRoutePrefix && specPath.slice(1).startsWith(`${normalizedRoutePrefix}/`)\n ? '/' + specPath.slice(normalizedRoutePrefix.length + 2)\n : specPath\n\n if (normalizedSpecPath.startsWith('/')) {\n return VIRTUAL_PREFIX + normalizedSpecPath.replace(/^\\//, '')\n }\n const fromDir = currentRoutePath === '/' ? '' : currentRoutePath?.replace(/^\\//, '').replace(/\\/[^/]*$/, '') ?? ''\n const normalizedFromDir = normalizedRoutePrefix && fromDir.startsWith(`${normalizedRoutePrefix}/`)\n ? fromDir.slice(normalizedRoutePrefix.length + 1)\n : fromDir\n return VIRTUAL_PREFIX + resolveRelativePath(normalizedFromDir, normalizedSpecPath)\n}\n\n/**\n * Prefer a locale-qualified registry key for absolute specPath values, then\n * fall back to the normalized key. The CLI registers visible route aliases,\n * while relative paths already resolve through the current localized route.\n */\nfunction specModuleCandidates(moduleId: string, specPath: string, locale: string | undefined): string[] {\n const candidates: string[] = []\n if (locale && specPath.startsWith('/') && !specPath.startsWith(VIRTUAL_PREFIX)) {\n const rest = moduleId.slice(VIRTUAL_PREFIX.length)\n if (!rest.startsWith(`${locale}/`) && rest !== locale) candidates.push(`${VIRTUAL_PREFIX}${locale}/${rest}`)\n }\n candidates.push(moduleId)\n return candidates\n}\n\nexport function useOpenApiSpec(spec?: OpenAPISpec, specPath?: string): OpenApiSpecResult {\n const config = useConfig()\n const locale = useLocale()\n const specs = useOpenApiSpecs()\n const location = useLocation()\n const [loadedSpec, setLoadedSpec] = useState<LoadedSpecState>({ spec: null })\n const normalized = specPath ? normalizeSpecPath(specPath, location.pathname, config.routePrefix) : undefined\n const candidates = specPath && normalized ? specModuleCandidates(normalized, specPath, locale) : []\n const registryValue = candidates.map(candidate => specs[candidate]).find(Boolean)\n\n useEffect(() => {\n let cancelled = false\n\n if (!isOpenApiSpecLoader(registryValue)) return\n\n registryValue().then(module => {\n if (!cancelled) setLoadedSpec({ loader: registryValue, spec: getLoadedSpec(module) })\n }).catch(() => {\n if (!cancelled) setLoadedSpec({ loader: registryValue, spec: null })\n })\n\n return () => {\n cancelled = true\n }\n }, [registryValue])\n\n if (spec) return { spec, loading: false }\n if (!specPath) return { spec: null, loading: false }\n if (isOpenApiSpecLoader(registryValue)) {\n return loadedSpec.loader === registryValue\n ? { spec: loadedSpec.spec, loading: false }\n : { spec: null, loading: true }\n }\n return { spec: registryValue ?? null, loading: false }\n}\n","import type { ReactNode } from 'react'\n\nimport { PageActions } from '../app/PageActions'\nimport { Prose } from '../components/Prose'\nimport { useBuiltInText } from '../core/i18n'\nimport { Markdown } from '../mdx/Markdown'\n\nimport { OpenApiOperation as OpenApiOperationComponent } from './components/OpenApiOperation'\nimport { OpenApiRequestWorkbench } from './components/OpenApiRequest'\nimport { useOpenApiSpec } from './lib/spec-path'\nimport { getOpenApiOperationEntry, listOpenApiOperations } from './lib/utils'\nimport type { OpenAPISpec } from './lib/utils'\n\ntype OpenApiPathsProps = { spec: OpenAPISpec; tagFilter?: string[] }\n\ntype OpenApiHeaderProps = { spec: OpenAPISpec }\n\ntype WarningBoxProps = {\n children: ReactNode\n tone?: 'amber' | 'red'\n}\n\nexport type OpenApiDocumentProps = {\n spec?: OpenAPISpec\n specPath?: string\n tagFilter?: string[]\n}\n\nexport type OpenApiRouteData = {\n spec: OpenAPISpec\n}\n\ntype OpenApiOperationWithSpecProps = {\n spec: OpenAPISpec\n path: string\n method: string\n}\n\nexport type OpenApiOperationProps = {\n specPath: string\n path: string\n method: string\n}\n\nexport type OpenApiRequestProps = OpenApiOperationProps\n\nfunction OpenApiHeader(arg0: OpenApiHeaderProps): ReactNode {\n const { spec } = arg0\n\n const t = useBuiltInText()\n return (\n <header className=\"clarify-openapi-header mb-16 border-b border-(--clarify-theme-tokens-colors-border) pb-8\">\n <p className=\"mb-3 text-xs/6 font-medium tracking-widest text-(--clarify-ui-accent-text) uppercase\">\n {t('openapi.openApiReference')}\n </p>\n <h1 className=\"clarify-page-title\">{spec.info?.title ?? t('openapi.apiDocumentation')}</h1>\n {spec.info?.description ? <Markdown className=\"lead mt-4 *:first:mt-0 *:last:mb-0\">{spec.info.description}</Markdown> : null}\n {spec.info?.version ? <p className=\"mt-4 text-sm text-(--clarify-ui-text-faint)\">{t('openapi.version', { version: spec.info.version })}</p> : null}\n </header>\n )\n}\n\nfunction operationMatchesTags(operationTags: string[] | undefined, filterTags: string[] | undefined): boolean {\n if (!filterTags?.length) return true\n return operationTags?.some(tag => filterTags.includes(tag)) ?? false\n}\n\nfunction OpenApiPaths(arg0: OpenApiPathsProps): ReactNode {\n const { spec, tagFilter } = arg0\n\n const entries = listOpenApiOperations(spec)\n .filter(({ operation }) => operationMatchesTags(operation.tags, tagFilter))\n .map(({ path, method, operation, source }) => ({\n path,\n method: method.toUpperCase(),\n operation,\n source,\n }))\n\n return (\n <div className=\"clarify-openai-endpoints divide-y divide-zinc-200/70 dark:divide-white/10\">\n {entries.map(({ path, method, operation, source }) => (\n <OpenApiOperationComponent key={`${source}-${method}-${path}`} spec={spec} path={path} method={method} operation={operation} operationSource={source} />\n ))}\n </div>\n )\n}\n\nfunction WarningBox(arg0: WarningBoxProps): ReactNode {\n const { children, tone = 'amber' } = arg0\n\n const classes = tone === 'red'\n ? 'rounded-lg border border-red-200 bg-red-50 p-4 text-sm text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-200'\n : 'rounded-lg border border-amber-200 bg-amber-50 p-4 text-sm text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200'\n\n return <div className={`clarify-warning ${classes}`}>{children}</div>\n}\n\nexport function OpenApiDocument(arg0: OpenApiDocumentProps): ReactNode {\n const { spec, specPath, tagFilter } = arg0\n const t = useBuiltInText()\n const { spec: resolved, loading } = useOpenApiSpec(spec, specPath)\n\n if (loading) {\n return <WarningBox>{t('openapi.loading')}</WarningBox>\n }\n if (!resolved) {\n return <WarningBox>{t('openapi.specNotFound', { specPath: specPath ?? t('openapi.specPathMissing') })}</WarningBox>\n }\n\n return (\n <article className=\"clarify-openapi-page relative flex h-full flex-col pt-16 pb-10\">\n <div className=\"clarify-page-actions mb-4 flex justify-end sm:absolute sm:top-16 sm:right-0 sm:mb-0\">\n <PageActions />\n </div>\n <Prose className=\"flex-auto\">\n <OpenApiHeader spec={resolved} />\n <OpenApiPaths spec={resolved} tagFilter={tagFilter} />\n </Prose>\n </article>\n )\n}\n\nfunction OpenApiOperationWithSpec(arg0: OpenApiOperationWithSpecProps): ReactNode {\n const { spec, path, method } = arg0\n const t = useBuiltInText()\n const entry = getOpenApiOperationEntry(spec, path, method)\n\n if (!entry) {\n return <WarningBox tone=\"red\">{t('openapi.endpointNotFound', { endpoint: `${method.toUpperCase()} ${path}` })}</WarningBox>\n }\n\n const normalizedMethod = entry.method.toUpperCase()\n return <OpenApiOperationComponent key={`${entry.source}-${normalizedMethod}-${path}`} spec={spec} path={path} method={normalizedMethod} operation={entry.operation} operationSource={entry.source} />\n}\n\nexport function OpenApiOperation(arg0: OpenApiOperationProps): ReactNode {\n const { specPath, path, method } = arg0\n const t = useBuiltInText()\n const { spec, loading } = useOpenApiSpec(undefined, specPath)\n\n if (loading) {\n return <WarningBox>{t('openapi.loading')}</WarningBox>\n }\n if (!spec) {\n return <WarningBox>{t('openapi.specNotFound', { specPath })}</WarningBox>\n }\n\n return <OpenApiOperationWithSpec spec={spec} path={path} method={method} />\n}\n\nexport function OpenApiRequest(arg0: OpenApiRequestProps): ReactNode {\n const { specPath, path, method } = arg0\n const t = useBuiltInText()\n const { spec, loading } = useOpenApiSpec(undefined, specPath)\n\n if (loading) return <WarningBox>{t('openapi.loading')}</WarningBox>\n if (!spec) return <WarningBox>{t('openapi.specNotFound', { specPath })}</WarningBox>\n\n const entry = getOpenApiOperationEntry(spec, path, method)\n if (!entry) return <WarningBox tone=\"red\">{t('openapi.endpointNotFound', { endpoint: `${method.toUpperCase()} ${path}` })}</WarningBox>\n\n return (\n <OpenApiRequestWorkbench\n spec={spec}\n path={path}\n method={entry.method.toUpperCase()}\n operation={entry.operation}\n operationSource={entry.source}\n />\n )\n}\n\nexport function createOpenApiRouteComponent(data: OpenApiRouteData) {\n return function OpenApiRoutePage() {\n return <OpenApiDocument spec={data.spec} />\n }\n}\n","import { Collapse } from '../components/Collapse'\nimport { Mermaid } from '../components/Mermaid'\nimport { OpenApiRequest, OpenApiDocument, OpenApiOperation } from '../openapi'\n\nimport * as mdxPrimitives from './primitives'\n\nconst builtInMDXComponents = {\n ...mdxPrimitives,\n Collapse,\n Mermaid,\n}\n\nconst builtInOpenAPIComponents = {\n OpenApiRequest,\n OpenApiDocument,\n OpenApiOperation,\n}\n\nexport function useMDXComponents(components: Record<string, unknown> = {}) {\n return {\n ...components,\n ...builtInMDXComponents,\n ...builtInOpenAPIComponents,\n }\n}\n","import type { ReactNode } from 'react'\n\nimport { Prose } from '../components/Prose'\n\nexport type DocShellProps = {\n title: string\n subtitle?: string\n children: ReactNode\n}\n\nexport function DocShell(arg0: DocShellProps) {\n const { title, subtitle, children } = arg0\n\n return (\n <main className=\"clarify-doc-shell min-h-screen bg-(--clarify-theme-tokens-colors-background) px-6 py-10 text-(--clarify-theme-tokens-colors-foreground) md:px-10\">\n <div className=\"mx-auto max-w-6xl\">\n <header className=\"mb-10\">\n <h1 className=\"text-3xl font-bold tracking-tight md:text-5xl\">{title}</h1>\n {subtitle ? <p className=\"mt-3 max-w-2xl text-(--clarify-ui-text-soft)\">{subtitle}</p> : null}\n </header>\n <Prose>{children}</Prose>\n </div>\n </main>\n )\n}\n"],"mappings":";;;;;;;;;;;AAkBA,SAAS,uBAAuB,QAAqC;CACnE,MAAM,EAAE,SAAS;CAOjB,MAAM,YAAY;EALhB,UAAU;EACV,KAAK;EACL,SAAS;EACT,cAAc;CAEE,EAAW,KAAK;CAClC,MAAM,eAAe,KAAK,SAAS,SAAS,KAAK,SAAS,aAAa,oBAAoB;CAG3F,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,qBAAA,kBAAD;EACE,OAAO,KAAK;EACZ,aAAa,KAAK;EAClB,SAAQ;EACR,UAAU,CACR;GAAE,OAAO;GAAW,OAAO,KAAK,YAAY;EAAU,GACtD;GAAE,OAAO;GAAQ,OAAO;EAAU,CACpC;EACc;EACd,gBAAgB,KAAK,UACnB,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;GAAK,WAAU;aACZ,KAAK;EACH,CAAA,IACH;CACL,CAAA;AAEL;AAEA,SAAgB,iCAAiC,MAAwC;CACvF,OAAO,SAAS,6BAA6B;EAC3C,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,wBAAD,EAA8B,KAAO,CAAA;CAC9C;AACF;;;AClCA,SAAS,oBAAoB,OAA2D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IACnF;OACR,iBAAA,GAAA,kBAAA,IAAA,CAAC,yBAAA,OAAD,EAAQ,SAAgB,CAAA,CACrB;;CACD,CAAA;AAEV"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../source/app/ContentDiagnostic.tsx","../source/openapi/lib/spec-path.ts","../source/openapi/entry.tsx","../source/openapi/components/OpenApiLink.tsx","../source/mdx/components.ts","../source/mdx/DocShell.tsx"],"sourcesContent":["import type { ComponentType } from 'react'\n\nimport { RenderErrorPanel } from './RenderErrorPanel'\n\nexport type ContentDiagnosticKind = 'markdown' | 'markdown+jsx' | 'openapi' | 'route-load'\n\nexport type ContentDiagnostic = {\n kind: ContentDiagnosticKind\n title: string\n message: string\n details?: string\n filePath?: string\n}\n\ntype ContentDiagnosticPanelProps = {\n data: ContentDiagnostic\n}\n\nfunction ContentDiagnosticPanel(params: ContentDiagnosticPanelProps) {\n const { data } = params\n const typeLabels: Record<ContentDiagnosticKind, string> = {\n markdown: 'Markdown',\n 'markdown+jsx': 'MDX',\n openapi: 'OpenAPI',\n 'route-load': 'Route',\n }\n const typeLabel = typeLabels[data.kind]\n const detailsLabel = data.kind === 'markdown+jsx' || data.kind === 'markdown' ? 'Why it happened' : 'Details'\n const pathLabel = 'File'\n\n return (\n <RenderErrorPanel\n title={data.title}\n description={data.message}\n titleId=\"clarify-content-diagnostic-title\"\n metadata={[\n { label: pathLabel, value: data.filePath ?? 'Unknown' },\n { label: 'Type', value: typeLabel },\n ]}\n detailsLabel={detailsLabel}\n detailsContent={data.details ? (\n <pre className=\"max-h-(--clarify-error-details-max-height) overflow-auto whitespace-pre-wrap wrap-break-word font-mono\">\n {data.details}\n </pre>\n ) : null}\n />\n )\n}\n\nexport function createContentDiagnosticComponent(data: ContentDiagnostic): ComponentType {\n return function ContentDiagnosticComponent() {\n return <ContentDiagnosticPanel data={data} />\n }\n}\n","import { useEffect, useState } from 'react'\nimport { useLocation } from 'react-router-dom'\n\nimport { useConfig, useLocale, useOpenApiSpecs } from '../../core/context'\n\nimport type { OpenAPISpec } from './utils'\n\ntype OpenApiSpecResult = {\n spec: OpenAPISpec | null\n loading: boolean\n}\n\ntype OpenApiSpecModule = { default: OpenAPISpec } | OpenAPISpec\n\ntype LoadedSpecState = {\n loader?: () => Promise<OpenApiSpecModule>\n spec: OpenAPISpec | null\n}\n\nfunction isOpenApiSpecLoader(value: unknown): value is () => Promise<OpenApiSpecModule> {\n return typeof value === 'function'\n}\n\nfunction getLoadedSpec(value: OpenApiSpecModule): OpenAPISpec {\n return value && typeof value === 'object' && 'default' in value\n ? value.default\n : value\n}\n\nconst VIRTUAL_PREFIX = 'virtual:clarify-page/'\n\nfunction resolveRelativePath(fromDir: string, to: string): string {\n const parts = (fromDir + '/' + to).split('/').filter(Boolean)\n const stack: string[] = []\n for (const part of parts) {\n if (part === '..') {\n stack.pop()\n } else if (part !== '.') {\n stack.push(part)\n }\n }\n return stack.join('/')\n}\n\nfunction normalizeSpecPath(specPath: string, currentRoutePath?: string, routePrefix = ''): string {\n if (specPath.startsWith(VIRTUAL_PREFIX)) return specPath\n\n const normalizedRoutePrefix = routePrefix.replace(/^\\/+|\\/+$/g, '')\n const normalizedSpecPath = specPath.startsWith('/') && normalizedRoutePrefix && specPath.slice(1).startsWith(`${normalizedRoutePrefix}/`)\n ? '/' + specPath.slice(normalizedRoutePrefix.length + 2)\n : specPath\n\n if (normalizedSpecPath.startsWith('/')) {\n return VIRTUAL_PREFIX + normalizedSpecPath.replace(/^\\//, '')\n }\n const fromDir = currentRoutePath === '/' ? '' : currentRoutePath?.replace(/^\\//, '').replace(/\\/[^/]*$/, '') ?? ''\n const normalizedFromDir = normalizedRoutePrefix && fromDir.startsWith(`${normalizedRoutePrefix}/`)\n ? fromDir.slice(normalizedRoutePrefix.length + 1)\n : fromDir\n return VIRTUAL_PREFIX + resolveRelativePath(normalizedFromDir, normalizedSpecPath)\n}\n\n/**\n * Prefer a locale-qualified registry key for absolute specPath values, then\n * fall back to the normalized key. The CLI registers visible route aliases,\n * while relative paths already resolve through the current localized route.\n */\nfunction specModuleCandidates(moduleId: string, specPath: string, locale: string | undefined): string[] {\n const candidates: string[] = []\n if (locale && specPath.startsWith('/') && !specPath.startsWith(VIRTUAL_PREFIX)) {\n const rest = moduleId.slice(VIRTUAL_PREFIX.length)\n if (!rest.startsWith(`${locale}/`) && rest !== locale) candidates.push(`${VIRTUAL_PREFIX}${locale}/${rest}`)\n }\n candidates.push(moduleId)\n return candidates\n}\n\nexport function useOpenApiSpec(spec?: OpenAPISpec, specPath?: string): OpenApiSpecResult {\n const config = useConfig()\n const locale = useLocale()\n const specs = useOpenApiSpecs()\n const location = useLocation()\n const [loadedSpec, setLoadedSpec] = useState<LoadedSpecState>({ spec: null })\n const normalized = specPath ? normalizeSpecPath(specPath, location.pathname, config.routePrefix) : undefined\n const candidates = specPath && normalized ? specModuleCandidates(normalized, specPath, locale) : []\n const registryValue = candidates.map(candidate => specs[candidate]).find(Boolean)\n\n useEffect(() => {\n let cancelled = false\n\n if (!isOpenApiSpecLoader(registryValue)) return\n\n registryValue().then(module => {\n if (!cancelled) setLoadedSpec({ loader: registryValue, spec: getLoadedSpec(module) })\n }).catch(() => {\n if (!cancelled) setLoadedSpec({ loader: registryValue, spec: null })\n })\n\n return () => {\n cancelled = true\n }\n }, [registryValue])\n\n if (spec) return { spec, loading: false }\n if (!specPath) return { spec: null, loading: false }\n if (isOpenApiSpecLoader(registryValue)) {\n return loadedSpec.loader === registryValue\n ? { spec: loadedSpec.spec, loading: false }\n : { spec: null, loading: true }\n }\n return { spec: registryValue ?? null, loading: false }\n}\n","import type { ReactNode } from 'react'\n\nimport { PageActions } from '../app/PageActions'\nimport { Prose } from '../components/Prose'\nimport { useBuiltInText } from '../core/i18n'\nimport { Markdown } from '../mdx/Markdown'\n\nimport { OpenApiOperation as OpenApiOperationComponent } from './components/OpenApiOperation'\nimport { OpenApiRequestWorkbench } from './components/OpenApiRequest'\nimport { useOpenApiSpec } from './lib/spec-path'\nimport { getOpenApiOperationEntryById, listOpenApiOperations } from './lib/utils'\nimport type { OpenAPISpec } from './lib/utils'\n\ntype OpenApiPathsProps = { spec: OpenAPISpec; tagFilter?: string[] }\n\ntype OpenApiHeaderProps = { spec: OpenAPISpec }\n\ntype WarningBoxProps = {\n children: ReactNode\n tone?: 'amber' | 'red'\n}\n\nexport type OpenApiDocumentProps = {\n spec?: OpenAPISpec\n specPath?: string\n tagFilter?: string[]\n}\n\nexport type OpenApiRouteData = {\n spec: OpenAPISpec\n}\n\ntype OpenApiOperationWithSpecProps = {\n spec: OpenAPISpec\n operationId: string\n}\n\nexport type OpenApiOperationProps = {\n specPath: string\n operationId: string\n}\n\nexport type OpenApiRequestProps = OpenApiOperationProps & {\n requestExample?: string\n}\n\nfunction OpenApiHeader(arg0: OpenApiHeaderProps): ReactNode {\n const { spec } = arg0\n\n const t = useBuiltInText()\n return (\n <header className=\"clarify-openapi-header mb-16 border-b border-(--clarify-theme-tokens-colors-border) pb-8\">\n <p className=\"mb-3 text-xs/6 font-medium tracking-widest text-(--clarify-ui-accent-text) uppercase\">\n {t('openapi.openApiReference')}\n </p>\n <h1 className=\"clarify-page-title\">{spec.info?.title ?? t('openapi.apiDocumentation')}</h1>\n {spec.info?.description ? <Markdown className=\"lead mt-4 *:first:mt-0 *:last:mb-0\">{spec.info.description}</Markdown> : null}\n {spec.info?.version ? <p className=\"mt-4 text-sm text-(--clarify-ui-text-faint)\">{t('openapi.version', { version: spec.info.version })}</p> : null}\n </header>\n )\n}\n\nfunction operationMatchesTags(operationTags: string[] | undefined, filterTags: string[] | undefined): boolean {\n if (!filterTags?.length) return true\n return operationTags?.some(tag => filterTags.includes(tag)) ?? false\n}\n\nfunction OpenApiPaths(arg0: OpenApiPathsProps): ReactNode {\n const { spec, tagFilter } = arg0\n\n const entries = listOpenApiOperations(spec)\n .filter(({ operation }) => operationMatchesTags(operation.tags, tagFilter))\n .map(({ path, method, operation, source }) => ({\n path,\n method: method.toUpperCase(),\n operation,\n source,\n }))\n\n return (\n <div className=\"clarify-openai-endpoints divide-y divide-zinc-200/70 dark:divide-white/10\">\n {entries.map(({ path, method, operation, source }) => (\n <OpenApiOperationComponent key={`${source}-${method}-${path}`} spec={spec} path={path} method={method} operation={operation} operationSource={source} />\n ))}\n </div>\n )\n}\n\nfunction WarningBox(arg0: WarningBoxProps): ReactNode {\n const { children, tone = 'amber' } = arg0\n\n const classes = tone === 'red'\n ? 'rounded-lg border border-red-200 bg-red-50 p-4 text-sm text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-200'\n : 'rounded-lg border border-amber-200 bg-amber-50 p-4 text-sm text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200'\n\n return <div className={`clarify-warning ${classes}`}>{children}</div>\n}\n\nexport function OpenApiDocument(arg0: OpenApiDocumentProps): ReactNode {\n const { spec, specPath, tagFilter } = arg0\n const t = useBuiltInText()\n const { spec: resolved, loading } = useOpenApiSpec(spec, specPath)\n\n if (loading) {\n return <WarningBox>{t('openapi.loading')}</WarningBox>\n }\n if (!resolved) {\n return <WarningBox>{t('openapi.specNotFound', { specPath: specPath ?? t('openapi.specPathMissing') })}</WarningBox>\n }\n\n return (\n <article className=\"clarify-openapi-page relative flex h-full flex-col pt-16 pb-10\">\n <div className=\"clarify-page-actions mb-4 flex justify-end sm:absolute sm:top-16 sm:right-0 sm:mb-0\">\n <PageActions />\n </div>\n <Prose className=\"flex-auto\">\n <OpenApiHeader spec={resolved} />\n <OpenApiPaths spec={resolved} tagFilter={tagFilter} />\n </Prose>\n </article>\n )\n}\n\nfunction OpenApiOperationWithSpec(arg0: OpenApiOperationWithSpecProps): ReactNode {\n const { spec, operationId } = arg0\n const t = useBuiltInText()\n const entry = getOpenApiOperationEntryById(spec, operationId)\n\n if (!entry) {\n return <WarningBox tone=\"red\">{t('openapi.endpointNotFound', { endpoint: operationId })}</WarningBox>\n }\n\n const normalizedMethod = entry.method.toUpperCase()\n return <OpenApiOperationComponent key={`${entry.source}-${normalizedMethod}-${entry.path}`} spec={spec} path={entry.path} method={normalizedMethod} operation={entry.operation} operationSource={entry.source} />\n}\n\nexport function OpenApiOperation(arg0: OpenApiOperationProps): ReactNode {\n const { specPath, operationId } = arg0\n const t = useBuiltInText()\n const { spec, loading } = useOpenApiSpec(undefined, specPath)\n\n if (loading) {\n return <WarningBox>{t('openapi.loading')}</WarningBox>\n }\n if (!spec) {\n return <WarningBox>{t('openapi.specNotFound', { specPath })}</WarningBox>\n }\n\n return <OpenApiOperationWithSpec spec={spec} operationId={operationId} />\n}\n\nexport function OpenApiRequest(arg0: OpenApiRequestProps): ReactNode {\n const { specPath, operationId, requestExample } = arg0\n const t = useBuiltInText()\n const { spec, loading } = useOpenApiSpec(undefined, specPath)\n\n if (loading) return <WarningBox>{t('openapi.loading')}</WarningBox>\n if (!spec) return <WarningBox>{t('openapi.specNotFound', { specPath })}</WarningBox>\n\n const entry = getOpenApiOperationEntryById(spec, operationId)\n if (!entry) return <WarningBox tone=\"red\">{t('openapi.endpointNotFound', { endpoint: operationId })}</WarningBox>\n\n return (\n <OpenApiRequestWorkbench\n spec={spec}\n path={entry.path}\n method={entry.method.toUpperCase()}\n operation={entry.operation}\n operationSource={entry.source}\n requestExample={requestExample}\n />\n )\n}\n\nexport function createOpenApiRouteComponent(data: OpenApiRouteData) {\n return function OpenApiRoutePage() {\n return <OpenApiDocument spec={data.spec} />\n }\n}\n","import clsx from 'clsx'\nimport { ArrowRight } from 'lucide-react'\nimport type { ReactNode } from 'react'\n\nimport { LocalizedLink } from '../../components/LocalizedLink'\nimport { useConfig, useLocale } from '../../core/context'\nimport { useBuiltInText } from '../../core/i18n'\nimport { localizeHref, prefixHref } from '../../utils/href'\nimport { useOpenApiSpec } from '../lib/spec-path'\nimport { getOpenApiOperationEntryById, getOpenApiOperationSectionId } from '../lib/utils'\n\nimport { EndpointMethodBadge } from './EndpointMethodBadge'\n\nexport type OpenApiLinkProps = {\n specPath: string\n operationId: string\n href?: string\n inline?: boolean\n className?: string\n}\n\ntype OpenApiLinkViewProps = {\n href: string\n method: string\n path: string\n label: string\n className?: string\n}\n\nexport function OpenApiLink(arg0: OpenApiLinkProps): ReactNode {\n const { specPath, operationId, href: hrefOverride, inline = false, className } = arg0\n const config = useConfig()\n const locale = useLocale()\n const t = useBuiltInText()\n const { spec, loading } = useOpenApiSpec(undefined, specPath)\n\n if (loading) return <span className={className}>{t('openapi.loading')}</span>\n\n const entry = spec ? getOpenApiOperationEntryById(spec, operationId) : undefined\n if (!entry) return <span className={className}>{t('openapi.endpointNotFound', { endpoint: operationId })}</span>\n\n const sectionId = getOpenApiOperationSectionId(entry.operation) || operationId\n const targetPath = hrefOverride ?? specPath\n const href = `${prefixHref(localizeHref(targetPath, config, locale), config.routePrefix)}#${sectionId}`\n const method = entry.method.toUpperCase()\n const title = entry.operation.summary?.trim() || ''\n\n if (inline) return <OpenApiLinkInline href={href} method={method} path={entry.path} label={title || entry.path} className={className} />\n return <OpenApiLinkBlock href={href} method={method} path={entry.path} label={title} className={className} />\n}\n\nfunction OpenApiLinkInline(arg0: OpenApiLinkViewProps): ReactNode {\n const { href, method, label, className } = arg0\n\n return (\n <LocalizedLink\n href={href}\n className={clsx(\n 'clarify-openapi-link clarify-openapi-link-inline not-prose inline-flex max-w-full items-center gap-1.5 rounded-md bg-(--clarify-ui-active-background) py-px pr-1.5 pl-px align-[0.125em] text-(--clarify-theme-tokens-colors-foreground) no-underline transition-colors hover:bg-(--clarify-ui-accent-background) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary) focus-visible:ring-offset-2',\n className,\n )}\n aria-label={`${method}: ${label}`}\n >\n <EndpointMethodBadge method={method} compact />\n <span className=\"truncate text-[0.8125rem]/5 font-medium\">{label}</span>\n </LocalizedLink>\n )\n}\n\nfunction OpenApiLinkBlock(arg0: OpenApiLinkViewProps): ReactNode {\n const { href, method, path, label, className } = arg0\n\n return (\n <LocalizedLink\n href={href}\n className={clsx(\n 'clarify-openapi-link not-prose group flex w-full items-center gap-3 rounded-lg border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) px-3 py-3 no-underline transition-colors hover:border-(--clarify-ui-accent-border) hover:bg-(--clarify-ui-hover-background) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary) focus-visible:ring-offset-2',\n className,\n )}\n >\n <EndpointMethodBadge method={method} />\n <span className=\"min-w-0 flex-1\">\n <code className=\"block truncate bg-transparent p-0 font-mono text-sm/6 font-semibold text-(--clarify-theme-tokens-colors-foreground)\">{path}</code>\n {label ? <span className=\"mt-0.5 block truncate text-xs/5 text-(--clarify-ui-text-faint)\">{label}</span> : null}\n </span>\n <span className=\"flex size-8 shrink-0 items-center justify-center rounded-md text-(--clarify-ui-text-faint) transition-colors group-hover:bg-(--clarify-theme-tokens-colors-surface) group-hover:text-(--clarify-ui-accent-text)\">\n <ArrowRight aria-hidden=\"true\" className=\"size-4\" />\n </span>\n </LocalizedLink>\n )\n}\n","import { Collapse } from '../components/Collapse'\nimport { Mermaid } from '../components/Mermaid'\nimport { OpenApiRequest, OpenApiDocument, OpenApiLink, OpenApiOperation } from '../openapi'\n\nimport * as mdxPrimitives from './primitives'\n\nconst builtInMDXComponents = {\n ...mdxPrimitives,\n Collapse,\n Mermaid,\n}\n\nconst builtInOpenAPIComponents = {\n OpenApiLink,\n OpenApiRequest,\n OpenApiDocument,\n OpenApiOperation,\n}\n\nexport function useMDXComponents(components: Record<string, unknown> = {}) {\n return {\n ...components,\n ...builtInMDXComponents,\n ...builtInOpenAPIComponents,\n }\n}\n","import type { ReactNode } from 'react'\n\nimport { Prose } from '../components/Prose'\n\nexport type DocShellProps = {\n title: string\n subtitle?: string\n children: ReactNode\n}\n\nexport function DocShell(arg0: DocShellProps) {\n const { title, subtitle, children } = arg0\n\n return (\n <main className=\"clarify-doc-shell min-h-screen bg-(--clarify-theme-tokens-colors-background) px-6 py-10 text-(--clarify-theme-tokens-colors-foreground) md:px-10\">\n <div className=\"mx-auto max-w-6xl\">\n <header className=\"mb-10\">\n <h1 className=\"text-3xl font-bold tracking-tight md:text-5xl\">{title}</h1>\n {subtitle ? <p className=\"mt-3 max-w-2xl text-(--clarify-ui-text-soft)\">{subtitle}</p> : null}\n </header>\n <Prose>{children}</Prose>\n </div>\n </main>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;AAkBA,SAAS,uBAAuB,QAAqC;CACnE,MAAM,EAAE,SAAS;CAOjB,MAAM,YAAY;EALhB,UAAU;EACV,gBAAgB;EAChB,SAAS;EACT,cAAc;CAEE,EAAW,KAAK;CAClC,MAAM,eAAe,KAAK,SAAS,kBAAkB,KAAK,SAAS,aAAa,oBAAoB;CAGpG,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,qBAAA,kBAAD;EACE,OAAO,KAAK;EACZ,aAAa,KAAK;EAClB,SAAQ;EACR,UAAU,CACR;GAAE,OAAO;GAAW,OAAO,KAAK,YAAY;EAAU,GACtD;GAAE,OAAO;GAAQ,OAAO;EAAU,CACpC;EACc;EACd,gBAAgB,KAAK,UACnB,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;GAAK,WAAU;aACZ,KAAK;EACH,CAAA,IACH;CACL,CAAA;AAEL;AAEA,SAAgB,iCAAiC,MAAwC;CACvF,OAAO,SAAS,6BAA6B;EAC3C,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,wBAAD,EAA8B,KAAO,CAAA;CAC9C;AACF;;;AClCA,SAAS,oBAAoB,OAA2D;CACtF,OAAO,OAAO,UAAU;AAC1B;AAEA,SAAS,cAAc,OAAuC;CAC5D,OAAO,SAAS,OAAO,UAAU,YAAY,aAAa,QACtD,MAAM,UACN;AACN;AAEA,IAAM,iBAAiB;AAEvB,SAAS,oBAAoB,SAAiB,IAAoB;CAChE,MAAM,SAAS,UAAU,MAAM,GAAA,CAAI,MAAM,GAAG,CAAC,CAAC,OAAO,OAAO;CAC5D,MAAM,QAAkB,CAAC;CAC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EA,IAAM,2BAA2B;CAC/B;CACA;CACA;CACA;AACF;AAEA,SAAgB,iBAAiB,aAAsC,CAAC,GAAG;CACzE,OAAO;EACL,GAAG;EACH,GAAG;EACH,GAAG;CACL;AACF;;;ACfA,SAAgB,SAAS,MAAqB;CAC5C,MAAM,EAAE,OAAO,UAAU,aAAa;CAEtC,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;EAAM,WAAU;YACd,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;GAAK,WAAU;aAAf,CACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,UAAD;IAAQ,WAAU;cAAlB,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD;KAAI,WAAU;eAAiD;IAAU,CAAA,GACxE,WAAW,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;KAAG,WAAU;eAAgD;IAAY,CAAA,IAAI,IACnF;OACR,iBAAA,GAAA,kBAAA,IAAA,CAAC,yBAAA,OAAD,EAAQ,SAAgB,CAAA,CACrB;;CACD,CAAA;AAEV"}
package/output/index.d.ts CHANGED
@@ -9,7 +9,7 @@ import { OpenApiSpecsContext, useOpenApiSpecs } from './context';
9
9
  import { useMDXComponents } from './mdx/components';
10
10
  import { DocShell } from './mdx/DocShell';
11
11
  import { markdownRemarkPlugins, parseCodeMeta } from './mdx/remark';
12
- import { OpenApiRequest, OpenApiDocument, OpenApiOperation, createOpenApiRouteComponent } from './openapi';
12
+ import { OpenApiRequest, OpenApiDocument, OpenApiLink, OpenApiOperation, createOpenApiRouteComponent } from './openapi';
13
13
  import { render } from './runtime/render';
14
14
  import { SlotProvider, RuntimeSlot, RuntimeSlotsProvider, useSlot } from './slots';
15
15
  import { applyThemeVariables, themeEditorPresets, ThemeEditor } from './theme/ThemeEditor';
@@ -18,7 +18,7 @@ import { ThemeToggle } from './theme/ThemeToggle';
18
18
  import { themePresets, themeBootstrapScript } from './theme/variables';
19
19
  import { Config, RouteItem, RouteSection, RenderOptions, ServerRenderOptions } from './types';
20
20
  import { remToPx } from './utils/remToPx';
21
- export type { OpenApiRequestProps, OpenApiOperationProps, OpenApiDocumentProps, OpenAPIOperation, OpenAPISpec, OpenApiRouteData } from './openapi';
21
+ export type { OpenApiRequestProps, OpenApiOperationProps, OpenApiDocumentProps, OpenApiLinkProps, OpenAPIOperation, OpenAPISpec, OpenApiRouteData } from './openapi';
22
22
  export type { ThemeEditorProps } from './theme/ThemeEditor';
23
23
  export type { StepProps, StepsProps, TabItem, TabProps, TabsProps } from './components';
24
24
  export type { ContentDiagnostic, ContentDiagnosticKind };
@@ -28,4 +28,4 @@ export { AppShell, render, OpenApiSpecsContext, useOpenApiSpecs, BuiltWithClarif
28
28
  export { Button, Callout, Card, CardGroup, Code, CodeGroup, Collapse, Pre, Prose, Heading, Logo, Mermaid, GridPattern, HeroPattern, Feedback, Step, Steps, Tab, Tabs, Tag, WebFrame };
29
29
  export { DocShell, useMDXComponents, markdownRemarkPlugins, parseCodeMeta };
30
30
  export { SlotProvider, RuntimeSlot, RuntimeSlotsProvider, useSlot };
31
- export { OpenApiRequest, OpenApiDocument, OpenApiOperation };
31
+ export { OpenApiRequest, OpenApiDocument, OpenApiLink, OpenApiOperation };
package/output/index.js CHANGED
@@ -1,22 +1,24 @@
1
- import { A as Code, C as GridPattern, D as Tag, E as Heading, F as CardGroup, I as Callout, L as Button, M as Pre, N as Mermaid, O as Feedback, P as Card, S as Prose, T as Logo, _ as WebFrame, b as Step, d as getOpenApiOperationEntry, f as listOpenApiOperations, g as primitives_exports, h as Markdown, j as CodeGroup, k as Collapse, n as OpenApiOperation$1, r as OpenApiRequestWorkbench, v as TabItem, w as HeroPattern, x as Steps, y as Tabs } from "./OpenApiOperation-Ddax6Pen.js";
2
- import { a as useConfig, c as useOpenApiSpecs, i as OpenApiSpecsContext, s as useLocale, t as useBuiltInText } from "./i18n-LXAq0RIC.js";
3
- import { a as themeBootstrapScript, c as AppShell, d as RenderErrorPanel, f as BuiltWithClarify, g as useSlot, h as SlotProvider, i as themeEditorPresets, l as PageFooter, m as RuntimeSlotsProvider, n as ThemeEditor, o as themePresets, p as RuntimeSlot, r as applyThemeVariables, u as PageBanner } from "./ClarifyShell-gzlibEm8.js";
4
- import { a as SectionProvider, h as useTheme, m as ThemeProvider, o as useSectionStore, p as ThemeToggle, s as remToPx, t as PageActions } from "./PageActions-BBRz0tJ4.js";
1
+ import { A as Feedback, B as LocalizedLink, C as Steps, D as Logo, E as HeroPattern, F as Mermaid, I as Card, L as CardGroup, M as Code, N as CodeGroup, O as Heading, P as Pre, R as Callout, S as Step, T as GridPattern, _ as Markdown, b as TabItem, d as EndpointMethodBadge, f as getOpenApiOperationEntryById, j as Collapse, k as Tag, m as listOpenApiOperations, n as OpenApiOperation$1, p as getOpenApiOperationSectionId, r as OpenApiRequestWorkbench, v as primitives_exports, w as Prose, x as Tabs, y as WebFrame, z as Button } from "./OpenApiOperation-Dv9u2GEJ.js";
2
+ import { a as useConfig, c as useOpenApiSpecs, i as OpenApiSpecsContext, s as useLocale, t as useBuiltInText } from "./i18n-Cff810G_.js";
3
+ import { a as themeBootstrapScript, c as AppShell, d as RenderErrorPanel, f as BuiltWithClarify, g as useSlot, h as SlotProvider, i as themeEditorPresets, l as PageFooter, m as RuntimeSlotsProvider, n as ThemeEditor, o as themePresets, p as RuntimeSlot, r as applyThemeVariables, u as PageBanner } from "./ClarifyShell-CKvXZj0f.js";
4
+ import { T as prefixHref, a as SectionProvider, h as useTheme, m as ThemeProvider, o as useSectionStore, p as ThemeToggle, s as remToPx, t as PageActions, w as localizeHref } from "./PageActions-DviEypf6.js";
5
5
  import { n as parseCodeMeta, t as markdownRemarkPlugins } from "./remark-C9iRQM0R.js";
6
- import { t as render } from "./render-C2rZuVLy.js";
6
+ import { t as render } from "./render-B41PHjt8.js";
7
+ import clsx from "clsx";
7
8
  import { useEffect, useState } from "react";
8
9
  import { useLocation } from "react-router-dom";
10
+ import { ArrowRight } from "lucide-react";
9
11
  import { jsx, jsxs } from "react/jsx-runtime";
10
12
  //#region source/app/ContentDiagnostic.tsx
11
13
  function ContentDiagnosticPanel(params) {
12
14
  const { data } = params;
13
15
  const typeLabel = {
14
16
  markdown: "Markdown",
15
- mdx: "MDX",
17
+ "markdown+jsx": "MDX",
16
18
  openapi: "OpenAPI",
17
19
  "route-load": "Route"
18
20
  }[data.kind];
19
- const detailsLabel = data.kind === "mdx" || data.kind === "markdown" ? "Why it happened" : "Details";
21
+ const detailsLabel = data.kind === "markdown+jsx" || data.kind === "markdown" ? "Why it happened" : "Details";
20
22
  return /* @__PURE__ */ jsx(RenderErrorPanel, {
21
23
  title: data.title,
22
24
  description: data.message,
@@ -201,51 +203,51 @@ function OpenApiDocument(arg0) {
201
203
  });
202
204
  }
203
205
  function OpenApiOperationWithSpec(arg0) {
204
- const { spec, path, method } = arg0;
206
+ const { spec, operationId } = arg0;
205
207
  const t = useBuiltInText();
206
- const entry = getOpenApiOperationEntry(spec, path, method);
208
+ const entry = getOpenApiOperationEntryById(spec, operationId);
207
209
  if (!entry) return /* @__PURE__ */ jsx(WarningBox, {
208
210
  tone: "red",
209
- children: t("openapi.endpointNotFound", { endpoint: `${method.toUpperCase()} ${path}` })
211
+ children: t("openapi.endpointNotFound", { endpoint: operationId })
210
212
  });
211
213
  const normalizedMethod = entry.method.toUpperCase();
212
214
  return /* @__PURE__ */ jsx(OpenApiOperation$1, {
213
215
  spec,
214
- path,
216
+ path: entry.path,
215
217
  method: normalizedMethod,
216
218
  operation: entry.operation,
217
219
  operationSource: entry.source
218
- }, `${entry.source}-${normalizedMethod}-${path}`);
220
+ }, `${entry.source}-${normalizedMethod}-${entry.path}`);
219
221
  }
220
222
  function OpenApiOperation(arg0) {
221
- const { specPath, path, method } = arg0;
223
+ const { specPath, operationId } = arg0;
222
224
  const t = useBuiltInText();
223
225
  const { spec, loading } = useOpenApiSpec(void 0, specPath);
224
226
  if (loading) return /* @__PURE__ */ jsx(WarningBox, { children: t("openapi.loading") });
225
227
  if (!spec) return /* @__PURE__ */ jsx(WarningBox, { children: t("openapi.specNotFound", { specPath }) });
226
228
  return /* @__PURE__ */ jsx(OpenApiOperationWithSpec, {
227
229
  spec,
228
- path,
229
- method
230
+ operationId
230
231
  });
231
232
  }
232
233
  function OpenApiRequest(arg0) {
233
- const { specPath, path, method } = arg0;
234
+ const { specPath, operationId, requestExample } = arg0;
234
235
  const t = useBuiltInText();
235
236
  const { spec, loading } = useOpenApiSpec(void 0, specPath);
236
237
  if (loading) return /* @__PURE__ */ jsx(WarningBox, { children: t("openapi.loading") });
237
238
  if (!spec) return /* @__PURE__ */ jsx(WarningBox, { children: t("openapi.specNotFound", { specPath }) });
238
- const entry = getOpenApiOperationEntry(spec, path, method);
239
+ const entry = getOpenApiOperationEntryById(spec, operationId);
239
240
  if (!entry) return /* @__PURE__ */ jsx(WarningBox, {
240
241
  tone: "red",
241
- children: t("openapi.endpointNotFound", { endpoint: `${method.toUpperCase()} ${path}` })
242
+ children: t("openapi.endpointNotFound", { endpoint: operationId })
242
243
  });
243
244
  return /* @__PURE__ */ jsx(OpenApiRequestWorkbench, {
244
245
  spec,
245
- path,
246
+ path: entry.path,
246
247
  method: entry.method.toUpperCase(),
247
248
  operation: entry.operation,
248
- operationSource: entry.source
249
+ operationSource: entry.source,
250
+ requestExample
249
251
  });
250
252
  }
251
253
  function createOpenApiRouteComponent(data) {
@@ -254,6 +256,84 @@ function createOpenApiRouteComponent(data) {
254
256
  };
255
257
  }
256
258
  //#endregion
259
+ //#region source/openapi/components/OpenApiLink.tsx
260
+ function OpenApiLink(arg0) {
261
+ const { specPath, operationId, href: hrefOverride, inline = false, className } = arg0;
262
+ const config = useConfig();
263
+ const locale = useLocale();
264
+ const t = useBuiltInText();
265
+ const { spec, loading } = useOpenApiSpec(void 0, specPath);
266
+ if (loading) return /* @__PURE__ */ jsx("span", {
267
+ className,
268
+ children: t("openapi.loading")
269
+ });
270
+ const entry = spec ? getOpenApiOperationEntryById(spec, operationId) : void 0;
271
+ if (!entry) return /* @__PURE__ */ jsx("span", {
272
+ className,
273
+ children: t("openapi.endpointNotFound", { endpoint: operationId })
274
+ });
275
+ const sectionId = getOpenApiOperationSectionId(entry.operation) || operationId;
276
+ const href = `${prefixHref(localizeHref(hrefOverride ?? specPath, config, locale), config.routePrefix)}#${sectionId}`;
277
+ const method = entry.method.toUpperCase();
278
+ const title = entry.operation.summary?.trim() || "";
279
+ if (inline) return /* @__PURE__ */ jsx(OpenApiLinkInline, {
280
+ href,
281
+ method,
282
+ path: entry.path,
283
+ label: title || entry.path,
284
+ className
285
+ });
286
+ return /* @__PURE__ */ jsx(OpenApiLinkBlock, {
287
+ href,
288
+ method,
289
+ path: entry.path,
290
+ label: title,
291
+ className
292
+ });
293
+ }
294
+ function OpenApiLinkInline(arg0) {
295
+ const { href, method, label, className } = arg0;
296
+ return /* @__PURE__ */ jsxs(LocalizedLink, {
297
+ href,
298
+ className: clsx("clarify-openapi-link clarify-openapi-link-inline not-prose inline-flex max-w-full items-center gap-1.5 rounded-md bg-(--clarify-ui-active-background) py-px pr-1.5 pl-px align-[0.125em] text-(--clarify-theme-tokens-colors-foreground) no-underline transition-colors hover:bg-(--clarify-ui-accent-background) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary) focus-visible:ring-offset-2", className),
299
+ "aria-label": `${method}: ${label}`,
300
+ children: [/* @__PURE__ */ jsx(EndpointMethodBadge, {
301
+ method,
302
+ compact: true
303
+ }), /* @__PURE__ */ jsx("span", {
304
+ className: "truncate text-[0.8125rem]/5 font-medium",
305
+ children: label
306
+ })]
307
+ });
308
+ }
309
+ function OpenApiLinkBlock(arg0) {
310
+ const { href, method, path, label, className } = arg0;
311
+ return /* @__PURE__ */ jsxs(LocalizedLink, {
312
+ href,
313
+ className: clsx("clarify-openapi-link not-prose group flex w-full items-center gap-3 rounded-lg border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) px-3 py-3 no-underline transition-colors hover:border-(--clarify-ui-accent-border) hover:bg-(--clarify-ui-hover-background) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary) focus-visible:ring-offset-2", className),
314
+ children: [
315
+ /* @__PURE__ */ jsx(EndpointMethodBadge, { method }),
316
+ /* @__PURE__ */ jsxs("span", {
317
+ className: "min-w-0 flex-1",
318
+ children: [/* @__PURE__ */ jsx("code", {
319
+ className: "block truncate bg-transparent p-0 font-mono text-sm/6 font-semibold text-(--clarify-theme-tokens-colors-foreground)",
320
+ children: path
321
+ }), label ? /* @__PURE__ */ jsx("span", {
322
+ className: "mt-0.5 block truncate text-xs/5 text-(--clarify-ui-text-faint)",
323
+ children: label
324
+ }) : null]
325
+ }),
326
+ /* @__PURE__ */ jsx("span", {
327
+ className: "flex size-8 shrink-0 items-center justify-center rounded-md text-(--clarify-ui-text-faint) transition-colors group-hover:bg-(--clarify-theme-tokens-colors-surface) group-hover:text-(--clarify-ui-accent-text)",
328
+ children: /* @__PURE__ */ jsx(ArrowRight, {
329
+ "aria-hidden": "true",
330
+ className: "size-4"
331
+ })
332
+ })
333
+ ]
334
+ });
335
+ }
336
+ //#endregion
257
337
  //#region source/mdx/components.ts
258
338
  var builtInMDXComponents = {
259
339
  ...primitives_exports,
@@ -261,6 +341,7 @@ var builtInMDXComponents = {
261
341
  Mermaid
262
342
  };
263
343
  var builtInOpenAPIComponents = {
344
+ OpenApiLink,
264
345
  OpenApiRequest,
265
346
  OpenApiDocument,
266
347
  OpenApiOperation
@@ -294,6 +375,6 @@ function DocShell(arg0) {
294
375
  });
295
376
  }
296
377
  //#endregion
297
- export { AppShell, BuiltWithClarify, Button, Callout, Card, CardGroup, Code, CodeGroup, Collapse, DocShell, Feedback, GridPattern, Heading, HeroPattern, Logo, Mermaid, OpenApiDocument, OpenApiOperation, OpenApiRequest, OpenApiSpecsContext, PageBanner, PageFooter, Pre, Prose, RuntimeSlot, RuntimeSlotsProvider, SectionProvider, SlotProvider, Step, Steps, TabItem as Tab, Tabs, Tag, ThemeEditor, ThemeProvider, ThemeToggle, WebFrame, applyThemeVariables, createContentDiagnosticComponent, createOpenApiRouteComponent, markdownRemarkPlugins, parseCodeMeta, remToPx, render, themeBootstrapScript, themeEditorPresets, themePresets, useMDXComponents, useOpenApiSpecs, useSectionStore, useSlot, useTheme };
378
+ export { AppShell, BuiltWithClarify, Button, Callout, Card, CardGroup, Code, CodeGroup, Collapse, DocShell, Feedback, GridPattern, Heading, HeroPattern, Logo, Mermaid, OpenApiDocument, OpenApiLink, OpenApiOperation, OpenApiRequest, OpenApiSpecsContext, PageBanner, PageFooter, Pre, Prose, RuntimeSlot, RuntimeSlotsProvider, SectionProvider, SlotProvider, Step, Steps, TabItem as Tab, Tabs, Tag, ThemeEditor, ThemeProvider, ThemeToggle, WebFrame, applyThemeVariables, createContentDiagnosticComponent, createOpenApiRouteComponent, markdownRemarkPlugins, parseCodeMeta, remToPx, render, themeBootstrapScript, themeEditorPresets, themePresets, useMDXComponents, useOpenApiSpecs, useSectionStore, useSlot, useTheme };
298
379
 
299
380
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../source/app/ContentDiagnostic.tsx","../source/openapi/lib/spec-path.ts","../source/openapi/entry.tsx","../source/mdx/components.ts","../source/mdx/DocShell.tsx"],"sourcesContent":["import type { ComponentType } from 'react'\n\nimport { RenderErrorPanel } from './RenderErrorPanel'\n\nexport type ContentDiagnosticKind = 'markdown' | 'mdx' | 'openapi' | 'route-load'\n\nexport type ContentDiagnostic = {\n kind: ContentDiagnosticKind\n title: string\n message: string\n details?: string\n filePath?: string\n}\n\ntype ContentDiagnosticPanelProps = {\n data: ContentDiagnostic\n}\n\nfunction ContentDiagnosticPanel(params: ContentDiagnosticPanelProps) {\n const { data } = params\n const typeLabels: Record<ContentDiagnosticKind, string> = {\n markdown: 'Markdown',\n mdx: 'MDX',\n openapi: 'OpenAPI',\n 'route-load': 'Route',\n }\n const typeLabel = typeLabels[data.kind]\n const detailsLabel = data.kind === 'mdx' || data.kind === 'markdown' ? 'Why it happened' : 'Details'\n const pathLabel = 'File'\n\n return (\n <RenderErrorPanel\n title={data.title}\n description={data.message}\n titleId=\"clarify-content-diagnostic-title\"\n metadata={[\n { label: pathLabel, value: data.filePath ?? 'Unknown' },\n { label: 'Type', value: typeLabel },\n ]}\n detailsLabel={detailsLabel}\n detailsContent={data.details ? (\n <pre className=\"max-h-(--clarify-error-details-max-height) overflow-auto whitespace-pre-wrap wrap-break-word font-mono\">\n {data.details}\n </pre>\n ) : null}\n />\n )\n}\n\nexport function createContentDiagnosticComponent(data: ContentDiagnostic): ComponentType {\n return function ContentDiagnosticComponent() {\n return <ContentDiagnosticPanel data={data} />\n }\n}\n","import { useEffect, useState } from 'react'\nimport { useLocation } from 'react-router-dom'\n\nimport { useConfig, useLocale, useOpenApiSpecs } from '../../core/context'\n\nimport type { OpenAPISpec } from './utils'\n\ntype OpenApiSpecResult = {\n spec: OpenAPISpec | null\n loading: boolean\n}\n\ntype OpenApiSpecModule = { default: OpenAPISpec } | OpenAPISpec\n\ntype LoadedSpecState = {\n loader?: () => Promise<OpenApiSpecModule>\n spec: OpenAPISpec | null\n}\n\nfunction isOpenApiSpecLoader(value: unknown): value is () => Promise<OpenApiSpecModule> {\n return typeof value === 'function'\n}\n\nfunction getLoadedSpec(value: OpenApiSpecModule): OpenAPISpec {\n return value && typeof value === 'object' && 'default' in value\n ? value.default\n : value\n}\n\nconst VIRTUAL_PREFIX = 'virtual:clarify-page/'\n\nfunction resolveRelativePath(fromDir: string, to: string): string {\n const parts = (fromDir + '/' + to).split('/').filter(Boolean)\n const stack: string[] = []\n for (const part of parts) {\n if (part === '..') {\n stack.pop()\n } else if (part !== '.') {\n stack.push(part)\n }\n }\n return stack.join('/')\n}\n\nfunction normalizeSpecPath(specPath: string, currentRoutePath?: string, routePrefix = ''): string {\n if (specPath.startsWith(VIRTUAL_PREFIX)) return specPath\n\n const normalizedRoutePrefix = routePrefix.replace(/^\\/+|\\/+$/g, '')\n const normalizedSpecPath = specPath.startsWith('/') && normalizedRoutePrefix && specPath.slice(1).startsWith(`${normalizedRoutePrefix}/`)\n ? '/' + specPath.slice(normalizedRoutePrefix.length + 2)\n : specPath\n\n if (normalizedSpecPath.startsWith('/')) {\n return VIRTUAL_PREFIX + normalizedSpecPath.replace(/^\\//, '')\n }\n const fromDir = currentRoutePath === '/' ? '' : currentRoutePath?.replace(/^\\//, '').replace(/\\/[^/]*$/, '') ?? ''\n const normalizedFromDir = normalizedRoutePrefix && fromDir.startsWith(`${normalizedRoutePrefix}/`)\n ? fromDir.slice(normalizedRoutePrefix.length + 1)\n : fromDir\n return VIRTUAL_PREFIX + resolveRelativePath(normalizedFromDir, normalizedSpecPath)\n}\n\n/**\n * Prefer a locale-qualified registry key for absolute specPath values, then\n * fall back to the normalized key. The CLI registers visible route aliases,\n * while relative paths already resolve through the current localized route.\n */\nfunction specModuleCandidates(moduleId: string, specPath: string, locale: string | undefined): string[] {\n const candidates: string[] = []\n if (locale && specPath.startsWith('/') && !specPath.startsWith(VIRTUAL_PREFIX)) {\n const rest = moduleId.slice(VIRTUAL_PREFIX.length)\n if (!rest.startsWith(`${locale}/`) && rest !== locale) candidates.push(`${VIRTUAL_PREFIX}${locale}/${rest}`)\n }\n candidates.push(moduleId)\n return candidates\n}\n\nexport function useOpenApiSpec(spec?: OpenAPISpec, specPath?: string): OpenApiSpecResult {\n const config = useConfig()\n const locale = useLocale()\n const specs = useOpenApiSpecs()\n const location = useLocation()\n const [loadedSpec, setLoadedSpec] = useState<LoadedSpecState>({ spec: null })\n const normalized = specPath ? normalizeSpecPath(specPath, location.pathname, config.routePrefix) : undefined\n const candidates = specPath && normalized ? specModuleCandidates(normalized, specPath, locale) : []\n const registryValue = candidates.map(candidate => specs[candidate]).find(Boolean)\n\n useEffect(() => {\n let cancelled = false\n\n if (!isOpenApiSpecLoader(registryValue)) return\n\n registryValue().then(module => {\n if (!cancelled) setLoadedSpec({ loader: registryValue, spec: getLoadedSpec(module) })\n }).catch(() => {\n if (!cancelled) setLoadedSpec({ loader: registryValue, spec: null })\n })\n\n return () => {\n cancelled = true\n }\n }, [registryValue])\n\n if (spec) return { spec, loading: false }\n if (!specPath) return { spec: null, loading: false }\n if (isOpenApiSpecLoader(registryValue)) {\n return loadedSpec.loader === registryValue\n ? { spec: loadedSpec.spec, loading: false }\n : { spec: null, loading: true }\n }\n return { spec: registryValue ?? null, loading: false }\n}\n","import type { ReactNode } from 'react'\n\nimport { PageActions } from '../app/PageActions'\nimport { Prose } from '../components/Prose'\nimport { useBuiltInText } from '../core/i18n'\nimport { Markdown } from '../mdx/Markdown'\n\nimport { OpenApiOperation as OpenApiOperationComponent } from './components/OpenApiOperation'\nimport { OpenApiRequestWorkbench } from './components/OpenApiRequest'\nimport { useOpenApiSpec } from './lib/spec-path'\nimport { getOpenApiOperationEntry, listOpenApiOperations } from './lib/utils'\nimport type { OpenAPISpec } from './lib/utils'\n\ntype OpenApiPathsProps = { spec: OpenAPISpec; tagFilter?: string[] }\n\ntype OpenApiHeaderProps = { spec: OpenAPISpec }\n\ntype WarningBoxProps = {\n children: ReactNode\n tone?: 'amber' | 'red'\n}\n\nexport type OpenApiDocumentProps = {\n spec?: OpenAPISpec\n specPath?: string\n tagFilter?: string[]\n}\n\nexport type OpenApiRouteData = {\n spec: OpenAPISpec\n}\n\ntype OpenApiOperationWithSpecProps = {\n spec: OpenAPISpec\n path: string\n method: string\n}\n\nexport type OpenApiOperationProps = {\n specPath: string\n path: string\n method: string\n}\n\nexport type OpenApiRequestProps = OpenApiOperationProps\n\nfunction OpenApiHeader(arg0: OpenApiHeaderProps): ReactNode {\n const { spec } = arg0\n\n const t = useBuiltInText()\n return (\n <header className=\"clarify-openapi-header mb-16 border-b border-(--clarify-theme-tokens-colors-border) pb-8\">\n <p className=\"mb-3 text-xs/6 font-medium tracking-widest text-(--clarify-ui-accent-text) uppercase\">\n {t('openapi.openApiReference')}\n </p>\n <h1 className=\"clarify-page-title\">{spec.info?.title ?? t('openapi.apiDocumentation')}</h1>\n {spec.info?.description ? <Markdown className=\"lead mt-4 *:first:mt-0 *:last:mb-0\">{spec.info.description}</Markdown> : null}\n {spec.info?.version ? <p className=\"mt-4 text-sm text-(--clarify-ui-text-faint)\">{t('openapi.version', { version: spec.info.version })}</p> : null}\n </header>\n )\n}\n\nfunction operationMatchesTags(operationTags: string[] | undefined, filterTags: string[] | undefined): boolean {\n if (!filterTags?.length) return true\n return operationTags?.some(tag => filterTags.includes(tag)) ?? false\n}\n\nfunction OpenApiPaths(arg0: OpenApiPathsProps): ReactNode {\n const { spec, tagFilter } = arg0\n\n const entries = listOpenApiOperations(spec)\n .filter(({ operation }) => operationMatchesTags(operation.tags, tagFilter))\n .map(({ path, method, operation, source }) => ({\n path,\n method: method.toUpperCase(),\n operation,\n source,\n }))\n\n return (\n <div className=\"clarify-openai-endpoints divide-y divide-zinc-200/70 dark:divide-white/10\">\n {entries.map(({ path, method, operation, source }) => (\n <OpenApiOperationComponent key={`${source}-${method}-${path}`} spec={spec} path={path} method={method} operation={operation} operationSource={source} />\n ))}\n </div>\n )\n}\n\nfunction WarningBox(arg0: WarningBoxProps): ReactNode {\n const { children, tone = 'amber' } = arg0\n\n const classes = tone === 'red'\n ? 'rounded-lg border border-red-200 bg-red-50 p-4 text-sm text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-200'\n : 'rounded-lg border border-amber-200 bg-amber-50 p-4 text-sm text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200'\n\n return <div className={`clarify-warning ${classes}`}>{children}</div>\n}\n\nexport function OpenApiDocument(arg0: OpenApiDocumentProps): ReactNode {\n const { spec, specPath, tagFilter } = arg0\n const t = useBuiltInText()\n const { spec: resolved, loading } = useOpenApiSpec(spec, specPath)\n\n if (loading) {\n return <WarningBox>{t('openapi.loading')}</WarningBox>\n }\n if (!resolved) {\n return <WarningBox>{t('openapi.specNotFound', { specPath: specPath ?? t('openapi.specPathMissing') })}</WarningBox>\n }\n\n return (\n <article className=\"clarify-openapi-page relative flex h-full flex-col pt-16 pb-10\">\n <div className=\"clarify-page-actions mb-4 flex justify-end sm:absolute sm:top-16 sm:right-0 sm:mb-0\">\n <PageActions />\n </div>\n <Prose className=\"flex-auto\">\n <OpenApiHeader spec={resolved} />\n <OpenApiPaths spec={resolved} tagFilter={tagFilter} />\n </Prose>\n </article>\n )\n}\n\nfunction OpenApiOperationWithSpec(arg0: OpenApiOperationWithSpecProps): ReactNode {\n const { spec, path, method } = arg0\n const t = useBuiltInText()\n const entry = getOpenApiOperationEntry(spec, path, method)\n\n if (!entry) {\n return <WarningBox tone=\"red\">{t('openapi.endpointNotFound', { endpoint: `${method.toUpperCase()} ${path}` })}</WarningBox>\n }\n\n const normalizedMethod = entry.method.toUpperCase()\n return <OpenApiOperationComponent key={`${entry.source}-${normalizedMethod}-${path}`} spec={spec} path={path} method={normalizedMethod} operation={entry.operation} operationSource={entry.source} />\n}\n\nexport function OpenApiOperation(arg0: OpenApiOperationProps): ReactNode {\n const { specPath, path, method } = arg0\n const t = useBuiltInText()\n const { spec, loading } = useOpenApiSpec(undefined, specPath)\n\n if (loading) {\n return <WarningBox>{t('openapi.loading')}</WarningBox>\n }\n if (!spec) {\n return <WarningBox>{t('openapi.specNotFound', { specPath })}</WarningBox>\n }\n\n return <OpenApiOperationWithSpec spec={spec} path={path} method={method} />\n}\n\nexport function OpenApiRequest(arg0: OpenApiRequestProps): ReactNode {\n const { specPath, path, method } = arg0\n const t = useBuiltInText()\n const { spec, loading } = useOpenApiSpec(undefined, specPath)\n\n if (loading) return <WarningBox>{t('openapi.loading')}</WarningBox>\n if (!spec) return <WarningBox>{t('openapi.specNotFound', { specPath })}</WarningBox>\n\n const entry = getOpenApiOperationEntry(spec, path, method)\n if (!entry) return <WarningBox tone=\"red\">{t('openapi.endpointNotFound', { endpoint: `${method.toUpperCase()} ${path}` })}</WarningBox>\n\n return (\n <OpenApiRequestWorkbench\n spec={spec}\n path={path}\n method={entry.method.toUpperCase()}\n operation={entry.operation}\n operationSource={entry.source}\n />\n )\n}\n\nexport function createOpenApiRouteComponent(data: OpenApiRouteData) {\n return function OpenApiRoutePage() {\n return <OpenApiDocument spec={data.spec} />\n }\n}\n","import { Collapse } from '../components/Collapse'\nimport { Mermaid } from '../components/Mermaid'\nimport { OpenApiRequest, OpenApiDocument, OpenApiOperation } from '../openapi'\n\nimport * as mdxPrimitives from './primitives'\n\nconst builtInMDXComponents = {\n ...mdxPrimitives,\n Collapse,\n Mermaid,\n}\n\nconst builtInOpenAPIComponents = {\n OpenApiRequest,\n OpenApiDocument,\n OpenApiOperation,\n}\n\nexport function useMDXComponents(components: Record<string, unknown> = {}) {\n return {\n ...components,\n ...builtInMDXComponents,\n ...builtInOpenAPIComponents,\n }\n}\n","import type { ReactNode } from 'react'\n\nimport { Prose } from '../components/Prose'\n\nexport type DocShellProps = {\n title: string\n subtitle?: string\n children: ReactNode\n}\n\nexport function DocShell(arg0: DocShellProps) {\n const { title, subtitle, children } = arg0\n\n return (\n <main className=\"clarify-doc-shell min-h-screen bg-(--clarify-theme-tokens-colors-background) px-6 py-10 text-(--clarify-theme-tokens-colors-foreground) md:px-10\">\n <div className=\"mx-auto max-w-6xl\">\n <header className=\"mb-10\">\n <h1 className=\"text-3xl font-bold tracking-tight md:text-5xl\">{title}</h1>\n {subtitle ? <p className=\"mt-3 max-w-2xl text-(--clarify-ui-text-soft)\">{subtitle}</p> : null}\n </header>\n <Prose>{children}</Prose>\n </div>\n </main>\n )\n}\n"],"mappings":";;;;;;;;;;AAkBA,SAAS,uBAAuB,QAAqC;CACnE,MAAM,EAAE,SAAS;CAOjB,MAAM,YAAY;EALhB,UAAU;EACV,KAAK;EACL,SAAS;EACT,cAAc;CAEE,EAAW,KAAK;CAClC,MAAM,eAAe,KAAK,SAAS,SAAS,KAAK,SAAS,aAAa,oBAAoB;CAG3F,OACE,oBAAC,kBAAD;EACE,OAAO,KAAK;EACZ,aAAa,K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AAEA,SAAgB,4BAA4B,MAAwB;CAClE,OAAO,SAAS,mBAAmB;EACjC,OAAO,oBAAC,iBAAD,EAAiB,MAAM,KAAK,KAAO,CAAA;CAC5C;AACF;;;AC3KA,IAAM,uBAAuB;CAC3B,GAAG;CACH;CACA;AACF;AAEA,IAAM,2BAA2B;CAC/B;CACA;CACA;AACF;AAEA,SAAgB,iBAAiB,aAAsC,CAAC,GAAG;CACzE,OAAO;EACL,GAAG;EACH,GAAG;EACH,GAAG;CACL;AACF;;;ACdA,SAAgB,SAAS,MAAqB;CAC5C,MAAM,EAAE,OAAO,UAAU,aAAa;CAEtC,OACE,oBAAC,QAAD;EAAM,WAAU;YACd,qBAAC,OAAD;GAAK,WAAU;aAAf,CACE,qBAAC,UAAD;IAAQ,WAAU;cAAlB,CACE,oBAAC,MAAD;KAAI,WAAU;eAAiD;IAAU,CAAA,GACxE,WAAW,oBAAC,KAAD;KAAG,WAAU;eAAgD;IAAY,CAAA,IAAI,IACnF;OACR,oBAAC,OAAD,EAAQ,SAAgB,CAAA,CACrB;;CACD,CAAA;AAEV"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../source/app/ContentDiagnostic.tsx","../source/openapi/lib/spec-path.ts","../source/openapi/entry.tsx","../source/openapi/components/OpenApiLink.tsx","../source/mdx/components.ts","../source/mdx/DocShell.tsx"],"sourcesContent":["import type { ComponentType } from 'react'\n\nimport { RenderErrorPanel } from './RenderErrorPanel'\n\nexport type ContentDiagnosticKind = 'markdown' | 'markdown+jsx' | 'openapi' | 'route-load'\n\nexport type ContentDiagnostic = {\n kind: ContentDiagnosticKind\n title: string\n message: string\n details?: string\n filePath?: string\n}\n\ntype ContentDiagnosticPanelProps = {\n data: ContentDiagnostic\n}\n\nfunction ContentDiagnosticPanel(params: ContentDiagnosticPanelProps) {\n const { data } = params\n const typeLabels: Record<ContentDiagnosticKind, string> = {\n markdown: 'Markdown',\n 'markdown+jsx': 'MDX',\n openapi: 'OpenAPI',\n 'route-load': 'Route',\n }\n const typeLabel = typeLabels[data.kind]\n const detailsLabel = data.kind === 'markdown+jsx' || data.kind === 'markdown' ? 'Why it happened' : 'Details'\n const pathLabel = 'File'\n\n return (\n <RenderErrorPanel\n title={data.title}\n description={data.message}\n titleId=\"clarify-content-diagnostic-title\"\n metadata={[\n { label: pathLabel, value: data.filePath ?? 'Unknown' },\n { label: 'Type', value: typeLabel },\n ]}\n detailsLabel={detailsLabel}\n detailsContent={data.details ? (\n <pre className=\"max-h-(--clarify-error-details-max-height) overflow-auto whitespace-pre-wrap wrap-break-word font-mono\">\n {data.details}\n </pre>\n ) : null}\n />\n )\n}\n\nexport function createContentDiagnosticComponent(data: ContentDiagnostic): ComponentType {\n return function ContentDiagnosticComponent() {\n return <ContentDiagnosticPanel data={data} />\n }\n}\n","import { useEffect, useState } from 'react'\nimport { useLocation } from 'react-router-dom'\n\nimport { useConfig, useLocale, useOpenApiSpecs } from '../../core/context'\n\nimport type { OpenAPISpec } from './utils'\n\ntype OpenApiSpecResult = {\n spec: OpenAPISpec | null\n loading: boolean\n}\n\ntype OpenApiSpecModule = { default: OpenAPISpec } | OpenAPISpec\n\ntype LoadedSpecState = {\n loader?: () => Promise<OpenApiSpecModule>\n spec: OpenAPISpec | null\n}\n\nfunction isOpenApiSpecLoader(value: unknown): value is () => Promise<OpenApiSpecModule> {\n return typeof value === 'function'\n}\n\nfunction getLoadedSpec(value: OpenApiSpecModule): OpenAPISpec {\n return value && typeof value === 'object' && 'default' in value\n ? value.default\n : value\n}\n\nconst VIRTUAL_PREFIX = 'virtual:clarify-page/'\n\nfunction resolveRelativePath(fromDir: string, to: string): string {\n const parts = (fromDir + '/' + to).split('/').filter(Boolean)\n const stack: string[] = []\n for (const part of parts) {\n if (part === '..') {\n stack.pop()\n } else if (part !== '.') {\n stack.push(part)\n }\n }\n return stack.join('/')\n}\n\nfunction normalizeSpecPath(specPath: string, currentRoutePath?: string, routePrefix = ''): string {\n if (specPath.startsWith(VIRTUAL_PREFIX)) return specPath\n\n const normalizedRoutePrefix = routePrefix.replace(/^\\/+|\\/+$/g, '')\n const normalizedSpecPath = specPath.startsWith('/') && normalizedRoutePrefix && specPath.slice(1).startsWith(`${normalizedRoutePrefix}/`)\n ? '/' + specPath.slice(normalizedRoutePrefix.length + 2)\n : specPath\n\n if (normalizedSpecPath.startsWith('/')) {\n return VIRTUAL_PREFIX + normalizedSpecPath.replace(/^\\//, '')\n }\n const fromDir = currentRoutePath === '/' ? '' : currentRoutePath?.replace(/^\\//, '').replace(/\\/[^/]*$/, '') ?? ''\n const normalizedFromDir = normalizedRoutePrefix && fromDir.startsWith(`${normalizedRoutePrefix}/`)\n ? fromDir.slice(normalizedRoutePrefix.length + 1)\n : fromDir\n return VIRTUAL_PREFIX + resolveRelativePath(normalizedFromDir, normalizedSpecPath)\n}\n\n/**\n * Prefer a locale-qualified registry key for absolute specPath values, then\n * fall back to the normalized key. The CLI registers visible route aliases,\n * while relative paths already resolve through the current localized route.\n */\nfunction specModuleCandidates(moduleId: string, specPath: string, locale: string | undefined): string[] {\n const candidates: string[] = []\n if (locale && specPath.startsWith('/') && !specPath.startsWith(VIRTUAL_PREFIX)) {\n const rest = moduleId.slice(VIRTUAL_PREFIX.length)\n if (!rest.startsWith(`${locale}/`) && rest !== locale) candidates.push(`${VIRTUAL_PREFIX}${locale}/${rest}`)\n }\n candidates.push(moduleId)\n return candidates\n}\n\nexport function useOpenApiSpec(spec?: OpenAPISpec, specPath?: string): OpenApiSpecResult {\n const config = useConfig()\n const locale = useLocale()\n const specs = useOpenApiSpecs()\n const location = useLocation()\n const [loadedSpec, setLoadedSpec] = useState<LoadedSpecState>({ spec: null })\n const normalized = specPath ? normalizeSpecPath(specPath, location.pathname, config.routePrefix) : undefined\n const candidates = specPath && normalized ? specModuleCandidates(normalized, specPath, locale) : []\n const registryValue = candidates.map(candidate => specs[candidate]).find(Boolean)\n\n useEffect(() => {\n let cancelled = false\n\n if (!isOpenApiSpecLoader(registryValue)) return\n\n registryValue().then(module => {\n if (!cancelled) setLoadedSpec({ loader: registryValue, spec: getLoadedSpec(module) })\n }).catch(() => {\n if (!cancelled) setLoadedSpec({ loader: registryValue, spec: null })\n })\n\n return () => {\n cancelled = true\n }\n }, [registryValue])\n\n if (spec) return { spec, loading: false }\n if (!specPath) return { spec: null, loading: false }\n if (isOpenApiSpecLoader(registryValue)) {\n return loadedSpec.loader === registryValue\n ? { spec: loadedSpec.spec, loading: false }\n : { spec: null, loading: true }\n }\n return { spec: registryValue ?? null, loading: false }\n}\n","import type { ReactNode } from 'react'\n\nimport { PageActions } from '../app/PageActions'\nimport { Prose } from '../components/Prose'\nimport { useBuiltInText } from '../core/i18n'\nimport { Markdown } from '../mdx/Markdown'\n\nimport { OpenApiOperation as OpenApiOperationComponent } from './components/OpenApiOperation'\nimport { OpenApiRequestWorkbench } from './components/OpenApiRequest'\nimport { useOpenApiSpec } from './lib/spec-path'\nimport { getOpenApiOperationEntryById, listOpenApiOperations } from './lib/utils'\nimport type { OpenAPISpec } from './lib/utils'\n\ntype OpenApiPathsProps = { spec: OpenAPISpec; tagFilter?: string[] }\n\ntype OpenApiHeaderProps = { spec: OpenAPISpec }\n\ntype WarningBoxProps = {\n children: ReactNode\n tone?: 'amber' | 'red'\n}\n\nexport type OpenApiDocumentProps = {\n spec?: OpenAPISpec\n specPath?: string\n tagFilter?: string[]\n}\n\nexport type OpenApiRouteData = {\n spec: OpenAPISpec\n}\n\ntype OpenApiOperationWithSpecProps = {\n spec: OpenAPISpec\n operationId: string\n}\n\nexport type OpenApiOperationProps = {\n specPath: string\n operationId: string\n}\n\nexport type OpenApiRequestProps = OpenApiOperationProps & {\n requestExample?: string\n}\n\nfunction OpenApiHeader(arg0: OpenApiHeaderProps): ReactNode {\n const { spec } = arg0\n\n const t = useBuiltInText()\n return (\n <header className=\"clarify-openapi-header mb-16 border-b border-(--clarify-theme-tokens-colors-border) pb-8\">\n <p className=\"mb-3 text-xs/6 font-medium tracking-widest text-(--clarify-ui-accent-text) uppercase\">\n {t('openapi.openApiReference')}\n </p>\n <h1 className=\"clarify-page-title\">{spec.info?.title ?? t('openapi.apiDocumentation')}</h1>\n {spec.info?.description ? <Markdown className=\"lead mt-4 *:first:mt-0 *:last:mb-0\">{spec.info.description}</Markdown> : null}\n {spec.info?.version ? <p className=\"mt-4 text-sm text-(--clarify-ui-text-faint)\">{t('openapi.version', { version: spec.info.version })}</p> : null}\n </header>\n )\n}\n\nfunction operationMatchesTags(operationTags: string[] | undefined, filterTags: string[] | undefined): boolean {\n if (!filterTags?.length) return true\n return operationTags?.some(tag => filterTags.includes(tag)) ?? false\n}\n\nfunction OpenApiPaths(arg0: OpenApiPathsProps): ReactNode {\n const { spec, tagFilter } = arg0\n\n const entries = listOpenApiOperations(spec)\n .filter(({ operation }) => operationMatchesTags(operation.tags, tagFilter))\n .map(({ path, method, operation, source }) => ({\n path,\n method: method.toUpperCase(),\n operation,\n source,\n }))\n\n return (\n <div className=\"clarify-openai-endpoints divide-y divide-zinc-200/70 dark:divide-white/10\">\n {entries.map(({ path, method, operation, source }) => (\n <OpenApiOperationComponent key={`${source}-${method}-${path}`} spec={spec} path={path} method={method} operation={operation} operationSource={source} />\n ))}\n </div>\n )\n}\n\nfunction WarningBox(arg0: WarningBoxProps): ReactNode {\n const { children, tone = 'amber' } = arg0\n\n const classes = tone === 'red'\n ? 'rounded-lg border border-red-200 bg-red-50 p-4 text-sm text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-200'\n : 'rounded-lg border border-amber-200 bg-amber-50 p-4 text-sm text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200'\n\n return <div className={`clarify-warning ${classes}`}>{children}</div>\n}\n\nexport function OpenApiDocument(arg0: OpenApiDocumentProps): ReactNode {\n const { spec, specPath, tagFilter } = arg0\n const t = useBuiltInText()\n const { spec: resolved, loading } = useOpenApiSpec(spec, specPath)\n\n if (loading) {\n return <WarningBox>{t('openapi.loading')}</WarningBox>\n }\n if (!resolved) {\n return <WarningBox>{t('openapi.specNotFound', { specPath: specPath ?? t('openapi.specPathMissing') })}</WarningBox>\n }\n\n return (\n <article className=\"clarify-openapi-page relative flex h-full flex-col pt-16 pb-10\">\n <div className=\"clarify-page-actions mb-4 flex justify-end sm:absolute sm:top-16 sm:right-0 sm:mb-0\">\n <PageActions />\n </div>\n <Prose className=\"flex-auto\">\n <OpenApiHeader spec={resolved} />\n <OpenApiPaths spec={resolved} tagFilter={tagFilter} />\n </Prose>\n </article>\n )\n}\n\nfunction OpenApiOperationWithSpec(arg0: OpenApiOperationWithSpecProps): ReactNode {\n const { spec, operationId } = arg0\n const t = useBuiltInText()\n const entry = getOpenApiOperationEntryById(spec, operationId)\n\n if (!entry) {\n return <WarningBox tone=\"red\">{t('openapi.endpointNotFound', { endpoint: operationId })}</WarningBox>\n }\n\n const normalizedMethod = entry.method.toUpperCase()\n return <OpenApiOperationComponent key={`${entry.source}-${normalizedMethod}-${entry.path}`} spec={spec} path={entry.path} method={normalizedMethod} operation={entry.operation} operationSource={entry.source} />\n}\n\nexport function OpenApiOperation(arg0: OpenApiOperationProps): ReactNode {\n const { specPath, operationId } = arg0\n const t = useBuiltInText()\n const { spec, loading } = useOpenApiSpec(undefined, specPath)\n\n if (loading) {\n return <WarningBox>{t('openapi.loading')}</WarningBox>\n }\n if (!spec) {\n return <WarningBox>{t('openapi.specNotFound', { specPath })}</WarningBox>\n }\n\n return <OpenApiOperationWithSpec spec={spec} operationId={operationId} />\n}\n\nexport function OpenApiRequest(arg0: OpenApiRequestProps): ReactNode {\n const { specPath, operationId, requestExample } = arg0\n const t = useBuiltInText()\n const { spec, loading } = useOpenApiSpec(undefined, specPath)\n\n if (loading) return <WarningBox>{t('openapi.loading')}</WarningBox>\n if (!spec) return <WarningBox>{t('openapi.specNotFound', { specPath })}</WarningBox>\n\n const entry = getOpenApiOperationEntryById(spec, operationId)\n if (!entry) return <WarningBox tone=\"red\">{t('openapi.endpointNotFound', { endpoint: operationId })}</WarningBox>\n\n return (\n <OpenApiRequestWorkbench\n spec={spec}\n path={entry.path}\n method={entry.method.toUpperCase()}\n operation={entry.operation}\n operationSource={entry.source}\n requestExample={requestExample}\n />\n )\n}\n\nexport function createOpenApiRouteComponent(data: OpenApiRouteData) {\n return function OpenApiRoutePage() {\n return <OpenApiDocument spec={data.spec} />\n }\n}\n","import clsx from 'clsx'\nimport { ArrowRight } from 'lucide-react'\nimport type { ReactNode } from 'react'\n\nimport { LocalizedLink } from '../../components/LocalizedLink'\nimport { useConfig, useLocale } from '../../core/context'\nimport { useBuiltInText } from '../../core/i18n'\nimport { localizeHref, prefixHref } from '../../utils/href'\nimport { useOpenApiSpec } from '../lib/spec-path'\nimport { getOpenApiOperationEntryById, getOpenApiOperationSectionId } from '../lib/utils'\n\nimport { EndpointMethodBadge } from './EndpointMethodBadge'\n\nexport type OpenApiLinkProps = {\n specPath: string\n operationId: string\n href?: string\n inline?: boolean\n className?: string\n}\n\ntype OpenApiLinkViewProps = {\n href: string\n method: string\n path: string\n label: string\n className?: string\n}\n\nexport function OpenApiLink(arg0: OpenApiLinkProps): ReactNode {\n const { specPath, operationId, href: hrefOverride, inline = false, className } = arg0\n const config = useConfig()\n const locale = useLocale()\n const t = useBuiltInText()\n const { spec, loading } = useOpenApiSpec(undefined, specPath)\n\n if (loading) return <span className={className}>{t('openapi.loading')}</span>\n\n const entry = spec ? getOpenApiOperationEntryById(spec, operationId) : undefined\n if (!entry) return <span className={className}>{t('openapi.endpointNotFound', { endpoint: operationId })}</span>\n\n const sectionId = getOpenApiOperationSectionId(entry.operation) || operationId\n const targetPath = hrefOverride ?? specPath\n const href = `${prefixHref(localizeHref(targetPath, config, locale), config.routePrefix)}#${sectionId}`\n const method = entry.method.toUpperCase()\n const title = entry.operation.summary?.trim() || ''\n\n if (inline) return <OpenApiLinkInline href={href} method={method} path={entry.path} label={title || entry.path} className={className} />\n return <OpenApiLinkBlock href={href} method={method} path={entry.path} label={title} className={className} />\n}\n\nfunction OpenApiLinkInline(arg0: OpenApiLinkViewProps): ReactNode {\n const { href, method, label, className } = arg0\n\n return (\n <LocalizedLink\n href={href}\n className={clsx(\n 'clarify-openapi-link clarify-openapi-link-inline not-prose inline-flex max-w-full items-center gap-1.5 rounded-md bg-(--clarify-ui-active-background) py-px pr-1.5 pl-px align-[0.125em] text-(--clarify-theme-tokens-colors-foreground) no-underline transition-colors hover:bg-(--clarify-ui-accent-background) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary) focus-visible:ring-offset-2',\n className,\n )}\n aria-label={`${method}: ${label}`}\n >\n <EndpointMethodBadge method={method} compact />\n <span className=\"truncate text-[0.8125rem]/5 font-medium\">{label}</span>\n </LocalizedLink>\n )\n}\n\nfunction OpenApiLinkBlock(arg0: OpenApiLinkViewProps): ReactNode {\n const { href, method, path, label, className } = arg0\n\n return (\n <LocalizedLink\n href={href}\n className={clsx(\n 'clarify-openapi-link not-prose group flex w-full items-center gap-3 rounded-lg border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) px-3 py-3 no-underline transition-colors hover:border-(--clarify-ui-accent-border) hover:bg-(--clarify-ui-hover-background) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary) focus-visible:ring-offset-2',\n className,\n )}\n >\n <EndpointMethodBadge method={method} />\n <span className=\"min-w-0 flex-1\">\n <code className=\"block truncate bg-transparent p-0 font-mono text-sm/6 font-semibold text-(--clarify-theme-tokens-colors-foreground)\">{path}</code>\n {label ? <span className=\"mt-0.5 block truncate text-xs/5 text-(--clarify-ui-text-faint)\">{label}</span> : null}\n </span>\n <span className=\"flex size-8 shrink-0 items-center justify-center rounded-md text-(--clarify-ui-text-faint) transition-colors group-hover:bg-(--clarify-theme-tokens-colors-surface) group-hover:text-(--clarify-ui-accent-text)\">\n <ArrowRight aria-hidden=\"true\" className=\"size-4\" />\n </span>\n </LocalizedLink>\n )\n}\n","import { Collapse } from '../components/Collapse'\nimport { Mermaid } from '../components/Mermaid'\nimport { OpenApiRequest, OpenApiDocument, OpenApiLink, OpenApiOperation } from '../openapi'\n\nimport * as mdxPrimitives from './primitives'\n\nconst builtInMDXComponents = {\n ...mdxPrimitives,\n Collapse,\n Mermaid,\n}\n\nconst builtInOpenAPIComponents = {\n OpenApiLink,\n OpenApiRequest,\n OpenApiDocument,\n OpenApiOperation,\n}\n\nexport function useMDXComponents(components: Record<string, unknown> = {}) {\n return {\n ...components,\n ...builtInMDXComponents,\n ...builtInOpenAPIComponents,\n }\n}\n","import type { ReactNode } from 'react'\n\nimport { Prose } from '../components/Prose'\n\nexport type DocShellProps = {\n title: string\n subtitle?: string\n children: ReactNode\n}\n\nexport function DocShell(arg0: DocShellProps) {\n const { title, subtitle, children } = arg0\n\n return (\n <main className=\"clarify-doc-shell min-h-screen bg-(--clarify-theme-tokens-colors-background) px-6 py-10 text-(--clarify-theme-tokens-colors-foreground) md:px-10\">\n <div className=\"mx-auto max-w-6xl\">\n <header className=\"mb-10\">\n <h1 className=\"text-3xl font-bold tracking-tight md:text-5xl\">{title}</h1>\n {subtitle ? <p className=\"mt-3 max-w-2xl text-(--clarify-ui-text-soft)\">{subtitle}</p> : null}\n </header>\n <Prose>{children}</Prose>\n </div>\n </main>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,SAAS,uBAAuB,QAAqC;CACnE,MAAM,EAAE,SAAS;CAOjB,MAAM,YAAY;EALhB,UAAU;EACV,gBAAgB;EAChB,SAAS;EACT,cAAc;CAEE,EAAW,KAAK;CAClC,MAAM,eAAe,KAAK,SAAS,kBAAkB,KAAK,SAAS,aAAa,oBAAoB;CAGpG,OACE,oBAAC,kBAAD;EACE,OAAO,KAAK;EACZ,aAAa,KAAK;EAClB,SAAQ;EACR,UAAU,CACR;GAAE,OAAO;GAAW,OAAO,KAAK,YAAY;EAAU,GACtD;GAAE,OAAO;GAAQ,OAAO;EAAU,CACpC;EACc;EACd,gBAAgB,KAAK,UACnB,oBAAC,OAAD;GAA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bACA,SACF;YALF;GAOE,oBAAC,qBAAD,EAA6B,OAAS,CAAA;GACtC,qBAAC,QAAD;IAAM,WAAU;cAAhB,CACE,oBAAC,QAAD;KAAM,WAAU;eAAuH;IAAW,CAAA,GACjJ,QAAQ,oBAAC,QAAD;KAAM,WAAU;eAAkE;IAAY,CAAA,IAAI,IACvG;;GACN,oBAAC,QAAD;IAAM,WAAU;cACd,oBAAC,YAAD;KAAY,eAAY;KAAO,WAAU;IAAU,CAAA;GAC/C,CAAA;EACO;;AAEnB;;;ACpFA,IAAM,uBAAuB;CAC3B,GAAG;CACH;CACA;AACF;AAEA,IAAM,2BAA2B;CAC/B;CACA;CACA;CACA;AACF;AAEA,SAAgB,iBAAiB,aAAsC,CAAC,GAAG;CACzE,OAAO;EACL,GAAG;EACH,GAAG;EACH,GAAG;CACL;AACF;;;ACfA,SAAgB,SAAS,MAAqB;CAC5C,MAAM,EAAE,OAAO,UAAU,aAAa;CAEtC,OACE,oBAAC,QAAD;EAAM,WAAU;YACd,qBAAC,OAAD;GAAK,WAAU;aAAf,CACE,qBAAC,UAAD;IAAQ,WAAU;cAAlB,CACE,oBAAC,MAAD;KAAI,WAAU;eAAiD;IAAU,CAAA,GACxE,WAAW,oBAAC,KAAD;KAAG,WAAU;eAAgD;IAAY,CAAA,IAAI,IACnF;OACR,oBAAC,OAAD,EAAQ,SAAgB,CAAA,CACrB;;CACD,CAAA;AAEV"}
@@ -1,8 +1,9 @@
1
1
  import { Collapse } from '../components/Collapse';
2
2
  import { Mermaid } from '../components/Mermaid';
3
- import { OpenApiRequest, OpenApiDocument, OpenApiOperation } from '../openapi';
3
+ import { OpenApiRequest, OpenApiDocument, OpenApiLink, OpenApiOperation } from '../openapi';
4
4
  import * as mdxPrimitives from './primitives';
5
5
  export declare function useMDXComponents(components?: Record<string, unknown>): {
6
+ OpenApiLink: typeof OpenApiLink;
6
7
  OpenApiRequest: typeof OpenApiRequest;
7
8
  OpenApiDocument: typeof OpenApiDocument;
8
9
  OpenApiOperation: typeof OpenApiOperation;
@@ -1,6 +1,7 @@
1
1
  import { ReactNode } from 'react';
2
2
  type EndpointMethodBadgeProps = {
3
3
  method: string;
4
+ compact?: boolean;
4
5
  };
5
6
  export declare function EndpointMethodBadge(arg0: EndpointMethodBadgeProps): ReactNode;
6
7
  export {};
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ export type OpenApiLinkProps = {
3
+ specPath: string;
4
+ operationId: string;
5
+ href?: string;
6
+ inline?: boolean;
7
+ className?: string;
8
+ };
9
+ export declare function OpenApiLink(arg0: OpenApiLinkProps): ReactNode;
@@ -6,6 +6,7 @@ type OpenApiRequestWorkbenchProps = {
6
6
  method: string;
7
7
  operation: OpenAPIOperation;
8
8
  operationSource?: OpenAPIOperationSource;
9
+ requestExample?: string;
9
10
  compact?: boolean;
10
11
  onClose?: () => void;
11
12
  };
@@ -4,7 +4,7 @@ import { OpenAPIOperation, OpenAPIOperationSource, OpenAPISpec } from '../lib/ut
4
4
  import { OpenApiMediaType, OpenApiParameter } from '../types';
5
5
  export declare function initialRequestBody(spec: OpenAPISpec, content?: OpenApiMediaType): string;
6
6
  export declare function requestBodyForExample(spec: OpenAPISpec, content: OpenApiMediaType | undefined, exampleKey: string): string;
7
- export declare function useOpenApiRequestTarget(spec: OpenAPISpec, path: string, operation: OpenAPIOperation, operationSource: OpenAPIOperationSource): {
7
+ export declare function useOpenApiRequestTarget(spec: OpenAPISpec, path: string, operation: OpenAPIOperation, operationSource: OpenAPIOperationSource, requestExample?: string): {
8
8
  servers: import('../types').OpenApiServer[];
9
9
  selectedServer: import('../types').OpenApiServer;
10
10
  selectedServerKey: string;
@@ -10,10 +10,11 @@ export type OpenApiRouteData = {
10
10
  };
11
11
  export type OpenApiOperationProps = {
12
12
  specPath: string;
13
- path: string;
14
- method: string;
13
+ operationId: string;
14
+ };
15
+ export type OpenApiRequestProps = OpenApiOperationProps & {
16
+ requestExample?: string;
15
17
  };
16
- export type OpenApiRequestProps = OpenApiOperationProps;
17
18
  export declare function OpenApiDocument(arg0: OpenApiDocumentProps): ReactNode;
18
19
  export declare function OpenApiOperation(arg0: OpenApiOperationProps): ReactNode;
19
20
  export declare function OpenApiRequest(arg0: OpenApiRequestProps): ReactNode;
@@ -1,3 +1,4 @@
1
1
  export { OpenApiRequest, OpenApiOperation, OpenApiDocument, createOpenApiRouteComponent } from './entry';
2
+ export { OpenApiLink, type OpenApiLinkProps } from './components/OpenApiLink';
2
3
  export type { OpenApiRequestProps, OpenApiOperationProps, OpenApiDocumentProps, OpenApiRouteData } from './entry';
3
4
  export type { OpenAPIOperation, OpenAPISpec } from './lib/utils';
@@ -15,4 +15,5 @@ export declare function getOpenApiOperationSectionId(operation: OpenAPIOperation
15
15
  export declare function isOpenAPIHttpMethod(method: string): method is OpenAPIHttpMethod;
16
16
  export declare function getOpenApiOperation(spec: OpenAPISpec, path: string, method: string): OpenAPIOperation | undefined;
17
17
  export declare function getOpenApiOperationEntry(spec: OpenAPISpec, path: string, method: string, source?: OpenAPIOperationSource): OpenAPIOperationEntry | undefined;
18
+ export declare function getOpenApiOperationEntryById(spec: OpenAPISpec, operationId: string): OpenAPIOperationEntry | undefined;
18
19
  export declare function listOpenApiOperations(spec: OpenAPISpec): OpenAPIOperationEntry[];
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_i18n = require("./i18n-Ds-f-qlT.cjs");
3
- const require_PageActions = require("./PageActions-ypH6U0Vc.cjs");
4
- const require_OpenApiOperation = require("./OpenApiOperation-QqYCuqve.cjs");
2
+ const require_i18n = require("./i18n-Cjfk1N7i.cjs");
3
+ const require_PageActions = require("./PageActions-ob2OJusG.cjs");
4
+ const require_OpenApiOperation = require("./OpenApiOperation-c-I6Nw9j.cjs");
5
5
  let react = require("react");
6
6
  let lucide_react = require("lucide-react");
7
7
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -276,7 +276,7 @@ var embeddedGuide = {
276
276
  label: "source/en-US/openapi/embedding.mdx",
277
277
  title: "Embed OpenAPI in MDX",
278
278
  body: "Use MDX for workflow context, then render the exact operation from the spec.",
279
- embed: "<OpenApiOperation specPath=\"/api\" path=\"/examples/basic-request\" method=\"get\" />",
279
+ embed: "<OpenApiOperation specPath=\"/api\" operationId=\"demoBasicRequest\" />",
280
280
  outputs: [
281
281
  "/openapi/embedding",
282
282
  "/api",