@clarify-labs/renderer 0.10.1 → 0.10.3
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/{ClarifyShell-1LuBliwt.js → ClarifyShell-Cq5Af46F.js} +32 -12
- package/output/ClarifyShell-Cq5Af46F.js.map +1 -0
- package/output/{ClarifyShell-C6li72Ce.cjs → ClarifyShell-UsefuuLS.cjs} +31 -11
- package/output/ClarifyShell-UsefuuLS.cjs.map +1 -0
- package/output/{MermaidViewer-dXsomvM7.js → MermaidViewer-Bc9H25yK.js} +2 -2
- package/output/{MermaidViewer-dXsomvM7.js.map → MermaidViewer-Bc9H25yK.js.map} +1 -1
- package/output/{MermaidViewer-B6-BMCJG.cjs → MermaidViewer-Db7qsyVk.cjs} +2 -2
- package/output/{MermaidViewer-B6-BMCJG.cjs.map → MermaidViewer-Db7qsyVk.cjs.map} +1 -1
- package/output/{OpenApiOperation-CqNM-no4.js → OpenApiOperation-BZWeCbvy.js} +584 -204
- package/output/OpenApiOperation-BZWeCbvy.js.map +1 -0
- package/output/{OpenApiOperation-DK46w2dq.cjs → OpenApiOperation-DbZjxIuj.cjs} +605 -200
- package/output/OpenApiOperation-DbZjxIuj.cjs.map +1 -0
- package/output/{PageActions-D7K9LDGf.js → PageActions-BQeEmXbT.js} +524 -350
- package/output/PageActions-BQeEmXbT.js.map +1 -0
- package/output/{PageActions-BjB6PYmL.cjs → PageActions-Dg1l9KB1.cjs} +521 -347
- package/output/PageActions-Dg1l9KB1.cjs.map +1 -0
- package/output/{SearchDialog-CxYLjRi5.js → SearchDialog-B67VA0Ut.js} +3 -3
- package/output/{SearchDialog-CxYLjRi5.js.map → SearchDialog-B67VA0Ut.js.map} +1 -1
- package/output/{SearchDialog-CIPvXMT3.cjs → SearchDialog-DjKvqN7p.cjs} +3 -3
- package/output/{SearchDialog-CIPvXMT3.cjs.map → SearchDialog-DjKvqN7p.cjs.map} +1 -1
- package/output/app/ContentDiagnostic.d.ts +2 -1
- package/output/client.cjs +3 -3
- package/output/client.js +3 -3
- package/output/components/AccordionGroup.d.ts +7 -0
- package/output/components/Collapse.d.ts +2 -0
- package/output/components/FileTree.d.ts +10 -0
- package/output/components/HighlightedCode.d.ts +7 -0
- package/output/components/Image.d.ts +6 -0
- package/output/components/Steps.d.ts +12 -0
- package/output/components/Tabs.d.ts +12 -5
- package/output/components/Tooltip.d.ts +7 -0
- package/output/components/index.d.ts +10 -1
- package/output/core/i18n.d.ts +1 -1
- package/output/{i18n-DnqZHFT7.js → i18n-Bqth9d6Q.js} +5 -1
- package/output/i18n-Bqth9d6Q.js.map +1 -0
- package/output/{i18n-b4iTLeia.cjs → i18n-C-fReCj-.cjs} +5 -1
- package/output/i18n-C-fReCj-.cjs.map +1 -0
- package/output/index.cjs +31 -22
- package/output/index.cjs.map +1 -1
- package/output/index.d.ts +7 -6
- package/output/index.js +27 -23
- package/output/index.js.map +1 -1
- package/output/markdown.cjs +2 -1
- package/output/markdown.d.ts +1 -1
- package/output/markdown.js +2 -2
- package/output/mdx/components.d.ts +9 -0
- package/output/mdx/primitives.d.ts +4 -2
- package/output/mdx/remark.d.ts +1 -0
- package/output/openapi/components/CodeDisplay.d.ts +1 -0
- package/output/openapi/components/ExamplePanels.d.ts +2 -1
- package/output/openapi/components/InlineListbox.d.ts +18 -0
- package/output/preview.cjs +3 -3
- package/output/preview.js +3 -3
- package/output/{remark-Dd2WU50s.js → remark-C9iRQM0R.js} +4 -3
- package/output/remark-C9iRQM0R.js.map +1 -0
- package/output/{remark-zSQT0MBv.cjs → remark-DTLbG8PK.cjs} +9 -2
- package/output/remark-DTLbG8PK.cjs.map +1 -0
- package/output/{render-Di5B6Zc0.cjs → render-Dc9wxg_r.cjs} +2 -2
- package/output/{render-Di5B6Zc0.cjs.map → render-Dc9wxg_r.cjs.map} +1 -1
- package/output/{render-DKj24Jqw.js → render-aS-w4fK4.js} +2 -2
- package/output/{render-DKj24Jqw.js.map → render-aS-w4fK4.js.map} +1 -1
- package/output/renderer.css +930 -175
- package/output/server.cjs +2 -2
- package/output/server.js +2 -2
- package/package.json +3 -1
- package/output/ClarifyShell-1LuBliwt.js.map +0 -1
- package/output/ClarifyShell-C6li72Ce.cjs.map +0 -1
- package/output/OpenApiOperation-CqNM-no4.js.map +0 -1
- package/output/OpenApiOperation-DK46w2dq.cjs.map +0 -1
- package/output/PageActions-BjB6PYmL.cjs.map +0 -1
- package/output/PageActions-D7K9LDGf.js.map +0 -1
- package/output/i18n-DnqZHFT7.js.map +0 -1
- package/output/i18n-b4iTLeia.cjs.map +0 -1
- package/output/remark-Dd2WU50s.js.map +0 -1
- package/output/remark-zSQT0MBv.cjs.map +0 -1
package/output/index.cjs.map
CHANGED
|
@@ -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 ContentDiagnostic = {\n kind: string\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 typeLabel = data.kind === 'mdx' ? 'MDX' : data.kind === 'openapi' ? 'OpenAPI' : 'Route'\n const detailsLabel = data.kind === 'mdx' ? '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 spec: OpenAPISpec | null\n loading: boolean\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, loading: false })\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 setLoadedSpec({ spec: null, loading: true })\n registryValue().then(module => {\n if (!cancelled) setLoadedSpec({ spec: getLoadedSpec(module), loading: false })\n }).catch(() => {\n if (!cancelled) setLoadedSpec({ spec: null, loading: false })\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\n }\n return { spec: registryValue ?? null, loading: false }\n}\n","import type { ReactNode } from 'react'\n\nimport { PageTitleActions } 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 { 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\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 <div className=\"clarify-page-title-row flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between\">\n <h1 className=\"clarify-page-title min-w-0 flex-1\">{spec.info?.title ?? t('openapi.apiDocumentation')}</h1>\n <PageTitleActions />\n </div>\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-api-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 flex h-full flex-col pt-16 pb-10\">\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 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 { OpenApiDocument, OpenApiOperation } from '../openapi'\n\nimport { Markdown } from './Markdown'\nimport * as mdxPrimitives from './primitives'\n\nconst builtInMDXComponents = {\n ...mdxPrimitives,\n Markdown,\n Collapse,\n Mermaid,\n}\n\nconst builtInOpenAPIComponents = {\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-(--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AI,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/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 { PageTitleActions } 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 { 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\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 <div className=\"clarify-page-title-row flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between\">\n <h1 className=\"clarify-page-title min-w-0 flex-1\">{spec.info?.title ?? t('openapi.apiDocumentation')}</h1>\n <PageTitleActions />\n </div>\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 flex h-full flex-col pt-16 pb-10\">\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 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 { OpenApiDocument, OpenApiOperation } from '../openapi'\n\nimport { Markdown } from './Markdown'\nimport * as mdxPrimitives from './primitives'\n\nconst builtInMDXComponents = {\n ...mdxPrimitives,\n Markdown,\n Collapse,\n Mermaid,\n}\n\nconst builtInOpenAPIComponents = {\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;EALh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index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { AppShell } from './app/AppShell';
|
|
2
2
|
import { BuiltWithClarify } from './app/BuiltWithClarify';
|
|
3
|
-
import { createContentDiagnosticComponent, ContentDiagnostic } from './app/ContentDiagnostic';
|
|
3
|
+
import { createContentDiagnosticComponent, ContentDiagnostic, ContentDiagnosticKind } from './app/ContentDiagnostic';
|
|
4
4
|
import { PageBanner } from './app/PageBanner';
|
|
5
5
|
import { PageFooter } from './app/PageFooter';
|
|
6
6
|
import { SectionProvider, useSectionStore, Section } from './app/SectionProvider';
|
|
7
|
-
import { Button, Callout, Card, CardGroup, Code, CodeGroup, Collapse, Feedback, GridPattern, Heading, HeroPattern, Logo, Mermaid, Pre, Prose, Tag, WebFrame } from './components';
|
|
7
|
+
import { Button, Callout, Card, CardGroup, Code, CodeGroup, Collapse, Feedback, GridPattern, Heading, HeroPattern, Logo, Mermaid, Pre, Prose, Step, Steps, Tab, Tabs, Tag, WebFrame } from './components';
|
|
8
8
|
import { OpenApiSpecsContext, useOpenApiSpecs } from './context';
|
|
9
9
|
import { useMDXComponents } from './mdx/components';
|
|
10
10
|
import { DocShell } from './mdx/DocShell';
|
|
11
11
|
import { Markdown } from './mdx/Markdown';
|
|
12
|
-
import { markdownRemarkPlugins } from './mdx/remark';
|
|
12
|
+
import { markdownRemarkPlugins, parseCodeMeta } from './mdx/remark';
|
|
13
13
|
import { OpenApiDocument, OpenApiOperation, createOpenApiRouteComponent } from './openapi';
|
|
14
14
|
import { render } from './runtime/render';
|
|
15
15
|
import { SlotProvider, RuntimeSlot, RuntimeSlotsProvider, useSlot } from './slots';
|
|
@@ -21,11 +21,12 @@ import { Config, RouteItem, RouteSection, RenderOptions, ServerRenderOptions } f
|
|
|
21
21
|
import { remToPx } from './utils/remToPx';
|
|
22
22
|
export type { OpenApiOperationProps, OpenApiDocumentProps, OpenAPIOperation, OpenAPISpec, OpenApiRouteData } from './openapi';
|
|
23
23
|
export type { ThemeEditorProps } from './theme/ThemeEditor';
|
|
24
|
-
export type {
|
|
24
|
+
export type { StepProps, StepsProps, TabItem, TabProps, TabsProps } from './components';
|
|
25
|
+
export type { ContentDiagnostic, ContentDiagnosticKind };
|
|
25
26
|
export type { Config, RouteItem, RouteSection, RenderOptions, ServerRenderOptions, Section };
|
|
26
27
|
export type { RuntimeSlotEntry, RuntimeSlotRegistry, UISlotRegistration, UISlotName, UISlotContext } from './slots';
|
|
27
28
|
export { AppShell, render, OpenApiSpecsContext, useOpenApiSpecs, BuiltWithClarify, PageBanner, PageFooter, ThemeProvider, ThemeToggle, ThemeEditor, useTheme, SectionProvider, useSectionStore, remToPx, applyThemeVariables, themeEditorPresets, themePresets, themeBootstrapScript, createContentDiagnosticComponent, createOpenApiRouteComponent };
|
|
28
|
-
export { Button, Callout, Card, CardGroup, Code, CodeGroup, Collapse, Pre, Prose, Heading, Logo, Mermaid, GridPattern, HeroPattern, Feedback, Tag, WebFrame };
|
|
29
|
-
export { DocShell, Markdown, useMDXComponents, markdownRemarkPlugins };
|
|
29
|
+
export { Button, Callout, Card, CardGroup, Code, CodeGroup, Collapse, Pre, Prose, Heading, Logo, Mermaid, GridPattern, HeroPattern, Feedback, Step, Steps, Tab, Tabs, Tag, WebFrame };
|
|
30
|
+
export { DocShell, Markdown, useMDXComponents, markdownRemarkPlugins, parseCodeMeta };
|
|
30
31
|
export { SlotProvider, RuntimeSlot, RuntimeSlotsProvider, useSlot };
|
|
31
32
|
export { OpenApiDocument, OpenApiOperation };
|
package/output/index.js
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { a as useConfig, c as useOpenApiSpecs, i as OpenApiSpecsContext, s as useLocale, t as useBuiltInText } from "./i18n-
|
|
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-
|
|
4
|
-
import { a as SectionProvider, h as useTheme, m as ThemeProvider, n as PageTitleActions, o as useSectionStore, p as ThemeToggle, s as remToPx } from "./PageActions-
|
|
5
|
-
import { t as markdownRemarkPlugins } from "./remark-
|
|
6
|
-
import { t as render } from "./render-
|
|
1
|
+
import { A as CodeGroup, C as HeroPattern, D as Feedback, E as Tag, F as Callout, I as Button, M as Mermaid, N as Card, O as Collapse, P as CardGroup, S as GridPattern, T as Heading, _ as TabItem, b as Steps, d as listOpenApiOperations, g as WebFrame, h as primitives_exports, j as Pre, k as Code, m as Markdown, n as OpenApiOperation$1, u as getOpenApiOperationEntry, v as Tabs, w as Logo, x as Prose, y as Step } from "./OpenApiOperation-BZWeCbvy.js";
|
|
2
|
+
import { a as useConfig, c as useOpenApiSpecs, i as OpenApiSpecsContext, s as useLocale, t as useBuiltInText } from "./i18n-Bqth9d6Q.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-Cq5Af46F.js";
|
|
4
|
+
import { a as SectionProvider, h as useTheme, m as ThemeProvider, n as PageTitleActions, o as useSectionStore, p as ThemeToggle, s as remToPx } from "./PageActions-BQeEmXbT.js";
|
|
5
|
+
import { n as parseCodeMeta, t as markdownRemarkPlugins } from "./remark-C9iRQM0R.js";
|
|
6
|
+
import { t as render } from "./render-aS-w4fK4.js";
|
|
7
7
|
import { useEffect, useState } from "react";
|
|
8
8
|
import { useLocation } from "react-router-dom";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
//#region source/app/ContentDiagnostic.tsx
|
|
11
11
|
function ContentDiagnosticPanel(params) {
|
|
12
12
|
const { data } = params;
|
|
13
|
-
const typeLabel =
|
|
14
|
-
|
|
13
|
+
const typeLabel = {
|
|
14
|
+
markdown: "Markdown",
|
|
15
|
+
mdx: "MDX",
|
|
16
|
+
openapi: "OpenAPI",
|
|
17
|
+
"route-load": "Route"
|
|
18
|
+
}[data.kind];
|
|
19
|
+
const detailsLabel = data.kind === "mdx" || data.kind === "markdown" ? "Why it happened" : "Details";
|
|
15
20
|
return /* @__PURE__ */ jsx(RenderErrorPanel, {
|
|
16
21
|
title: data.title,
|
|
17
22
|
description: data.message,
|
|
@@ -78,28 +83,21 @@ function useOpenApiSpec(spec, specPath) {
|
|
|
78
83
|
const locale = useLocale();
|
|
79
84
|
const specs = useOpenApiSpecs();
|
|
80
85
|
const location = useLocation();
|
|
81
|
-
const [loadedSpec, setLoadedSpec] = useState({
|
|
82
|
-
spec: null,
|
|
83
|
-
loading: false
|
|
84
|
-
});
|
|
86
|
+
const [loadedSpec, setLoadedSpec] = useState({ spec: null });
|
|
85
87
|
const normalized = specPath ? normalizeSpecPath(specPath, location.pathname, config.routePrefix) : void 0;
|
|
86
88
|
const registryValue = (specPath && normalized ? specModuleCandidates(normalized, specPath, locale) : []).map((candidate) => specs[candidate]).find(Boolean);
|
|
87
89
|
useEffect(() => {
|
|
88
90
|
let cancelled = false;
|
|
89
91
|
if (!isOpenApiSpecLoader(registryValue)) return;
|
|
90
|
-
setLoadedSpec({
|
|
91
|
-
spec: null,
|
|
92
|
-
loading: true
|
|
93
|
-
});
|
|
94
92
|
registryValue().then((module) => {
|
|
95
93
|
if (!cancelled) setLoadedSpec({
|
|
96
|
-
|
|
97
|
-
|
|
94
|
+
loader: registryValue,
|
|
95
|
+
spec: getLoadedSpec(module)
|
|
98
96
|
});
|
|
99
97
|
}).catch(() => {
|
|
100
98
|
if (!cancelled) setLoadedSpec({
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
loader: registryValue,
|
|
100
|
+
spec: null
|
|
103
101
|
});
|
|
104
102
|
});
|
|
105
103
|
return () => {
|
|
@@ -114,7 +112,13 @@ function useOpenApiSpec(spec, specPath) {
|
|
|
114
112
|
spec: null,
|
|
115
113
|
loading: false
|
|
116
114
|
};
|
|
117
|
-
if (isOpenApiSpecLoader(registryValue)) return loadedSpec
|
|
115
|
+
if (isOpenApiSpecLoader(registryValue)) return loadedSpec.loader === registryValue ? {
|
|
116
|
+
spec: loadedSpec.spec,
|
|
117
|
+
loading: false
|
|
118
|
+
} : {
|
|
119
|
+
spec: null,
|
|
120
|
+
loading: true
|
|
121
|
+
};
|
|
118
122
|
return {
|
|
119
123
|
spec: registryValue ?? null,
|
|
120
124
|
loading: false
|
|
@@ -157,7 +161,7 @@ function operationMatchesTags(operationTags, filterTags) {
|
|
|
157
161
|
function OpenApiPaths(arg0) {
|
|
158
162
|
const { spec, tagFilter } = arg0;
|
|
159
163
|
return /* @__PURE__ */ jsx("div", {
|
|
160
|
-
className: "clarify-
|
|
164
|
+
className: "clarify-openai-endpoints divide-y divide-zinc-200/70 dark:divide-white/10",
|
|
161
165
|
children: listOpenApiOperations(spec).filter(({ operation }) => operationMatchesTags(operation.tags, tagFilter)).map(({ path, method, operation, source }) => ({
|
|
162
166
|
path,
|
|
163
167
|
method: method.toUpperCase(),
|
|
@@ -271,6 +275,6 @@ function DocShell(arg0) {
|
|
|
271
275
|
});
|
|
272
276
|
}
|
|
273
277
|
//#endregion
|
|
274
|
-
export { AppShell, BuiltWithClarify, Button, Callout, Card, CardGroup, Code, CodeGroup, Collapse, DocShell, Feedback, GridPattern, Heading, HeroPattern, Logo, Markdown, Mermaid, OpenApiDocument, OpenApiOperation, OpenApiSpecsContext, PageBanner, PageFooter, Pre, Prose, RuntimeSlot, RuntimeSlotsProvider, SectionProvider, SlotProvider, Tag, ThemeEditor, ThemeProvider, ThemeToggle, WebFrame, applyThemeVariables, createContentDiagnosticComponent, createOpenApiRouteComponent, markdownRemarkPlugins, remToPx, render, themeBootstrapScript, themeEditorPresets, themePresets, useMDXComponents, useOpenApiSpecs, useSectionStore, useSlot, useTheme };
|
|
278
|
+
export { AppShell, BuiltWithClarify, Button, Callout, Card, CardGroup, Code, CodeGroup, Collapse, DocShell, Feedback, GridPattern, Heading, HeroPattern, Logo, Markdown, Mermaid, OpenApiDocument, OpenApiOperation, 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 };
|
|
275
279
|
|
|
276
280
|
//# sourceMappingURL=index.js.map
|
package/output/index.js.map
CHANGED
|
@@ -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 ContentDiagnostic = {\n kind: string\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 typeLabel = data.kind === 'mdx' ? 'MDX' : data.kind === 'openapi' ? 'OpenAPI' : 'Route'\n const detailsLabel = data.kind === 'mdx' ? '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 spec: OpenAPISpec | null\n loading: boolean\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, loading: false })\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 setLoadedSpec({ spec: null, loading: true })\n registryValue().then(module => {\n if (!cancelled) setLoadedSpec({ spec: getLoadedSpec(module), loading: false })\n }).catch(() => {\n if (!cancelled) setLoadedSpec({ spec: null, loading: false })\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\n }\n return { spec: registryValue ?? null, loading: false }\n}\n","import type { ReactNode } from 'react'\n\nimport { PageTitleActions } 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 { 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\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 <div className=\"clarify-page-title-row flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between\">\n <h1 className=\"clarify-page-title min-w-0 flex-1\">{spec.info?.title ?? t('openapi.apiDocumentation')}</h1>\n <PageTitleActions />\n </div>\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-api-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 flex h-full flex-col pt-16 pb-10\">\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 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 { OpenApiDocument, OpenApiOperation } from '../openapi'\n\nimport { Markdown } from './Markdown'\nimport * as mdxPrimitives from './primitives'\n\nconst builtInMDXComponents = {\n ...mdxPrimitives,\n Markdown,\n Collapse,\n Mermaid,\n}\n\nconst builtInOpenAPIComponents = {\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":";;;;;;;;;;AAgBA,SAAS,uBAAuB,QAAqC;CACnE,MAAM,EAAE,SAAS;CACjB,MAAM,YAAY,KAAK,SAAS,QAAQ,QAAQ,KAAK,SAAS,YAAY,YAAY;CACtF,MAAM,eAAe,KAAK,SAAS,QAAQ,oBAAoB;CAG/D,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;GAAK,WAAU;aACZ,KAAK;EACH,CAAA,IACH;CACL,CAAA;AAEL;AAEA,SAAgB,iCAAiC,MAAwC;CACvF,OAAO,SAAS,6BAA6B;EAC3C,OAAO,oBAAC,wBAAD,EAA8B,KAAO,CAAA;CAC9C;AACF;;;AC1BA,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;CACzB,KAAK,MAAM,QAAQ,OACjB,IAAI,SAAS,MACX,MAAM,IAAI;MACL,IAAI,SAAS,KAClB,MAAM,KAAK,IAAI;CAGnB,OAAO,MAAM,KAAK,GAAG;AACvB;AAEA,SAAS,kBAAkB,UAAkB,kBAA2B,cAAc,IAAY;CAChG,IAAI,SAAS,W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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
|
+
{"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 { PageTitleActions } 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 { 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\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 <div className=\"clarify-page-title-row flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between\">\n <h1 className=\"clarify-page-title min-w-0 flex-1\">{spec.info?.title ?? t('openapi.apiDocumentation')}</h1>\n <PageTitleActions />\n </div>\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 flex h-full flex-col pt-16 pb-10\">\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 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 { OpenApiDocument, OpenApiOperation } from '../openapi'\n\nimport { Markdown } from './Markdown'\nimport * as mdxPrimitives from './primitives'\n\nconst builtInMDXComponents = {\n ...mdxPrimitives,\n Markdown,\n Collapse,\n Mermaid,\n}\n\nconst builtInOpenAPIComponents = {\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,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;GAAK,WAAU;aACZ,KAAK;EACH,CAAA,IACH;CACL,CAAA;AAEL;AAEA,SAAgB,iCAAiC,MAAwC;CACvF,OAAO,SAAS,6BAA6B;EAC3C,OAAO,oBAAC,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;CACzB,KAAK,MAAM,QAAQ,OACjB,IAAI,SAAS,MACX,MAAM,IAAI;MACL,IAAI,SAAS,KAClB,MAAM,KAAK,IAAI;CAGnB,OAAO,MAAM,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G;CACH;CACA;CACA;AACF;AAEA,IAAM,2BAA2B;CAC/B;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"}
|
package/output/markdown.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_remark = require("./remark-
|
|
2
|
+
const require_remark = require("./remark-DTLbG8PK.cjs");
|
|
3
3
|
exports.markdownRemarkPlugins = require_remark.markdownRemarkPlugins;
|
|
4
|
+
exports.parseCodeMeta = require_remark.parseCodeMeta;
|
package/output/markdown.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { markdownRemarkPlugins } from './mdx/remark';
|
|
1
|
+
export { markdownRemarkPlugins, parseCodeMeta } from './mdx/remark';
|
package/output/markdown.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as markdownRemarkPlugins } from "./remark-
|
|
2
|
-
export { markdownRemarkPlugins };
|
|
1
|
+
import { n as parseCodeMeta, t as markdownRemarkPlugins } from "./remark-C9iRQM0R.js";
|
|
2
|
+
export { markdownRemarkPlugins, parseCodeMeta };
|
|
@@ -50,10 +50,19 @@ export declare function useMDXComponents(components?: Record<string, unknown>):
|
|
|
50
50
|
}): import("react").JSX.Element;
|
|
51
51
|
code: typeof import('..').Code;
|
|
52
52
|
pre: typeof import('..').Pre;
|
|
53
|
+
img: typeof import('../components/Image').Image;
|
|
54
|
+
AccordionGroup: typeof mdxPrimitives.AccordionGroup;
|
|
53
55
|
Button: typeof mdxPrimitives.Button;
|
|
54
56
|
Callout: typeof mdxPrimitives.Callout;
|
|
55
57
|
Card: typeof mdxPrimitives.Card;
|
|
56
58
|
CardGroup: typeof mdxPrimitives.CardGroup;
|
|
57
59
|
CodeGroup: typeof mdxPrimitives.CodeGroup;
|
|
60
|
+
FileTree: typeof mdxPrimitives.FileTree;
|
|
61
|
+
FileTreeItem: typeof mdxPrimitives.FileTreeItem;
|
|
62
|
+
Step: typeof mdxPrimitives.Step;
|
|
63
|
+
Steps: typeof mdxPrimitives.Steps;
|
|
64
|
+
Tab: typeof mdxPrimitives.Tab;
|
|
65
|
+
Tabs: typeof mdxPrimitives.Tabs;
|
|
66
|
+
Tooltip: typeof mdxPrimitives.Tooltip;
|
|
58
67
|
WebFrame: typeof mdxPrimitives.WebFrame;
|
|
59
68
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
-
import { Button, Callout, Card, CardGroup, Heading, WebFrame } from '../components';
|
|
2
|
+
import { AccordionGroup, Button, Callout, Card, CardGroup, FileTree, FileTreeItem, Heading, Step, Steps, Tab, Tabs, Tooltip, WebFrame } from '../components';
|
|
3
3
|
import { Code, CodeGroup, Pre } from '../components/Code';
|
|
4
|
+
import { Image } from '../components/Image';
|
|
4
5
|
type WrapperProps = {
|
|
5
6
|
children: ReactNode;
|
|
6
7
|
};
|
|
@@ -10,7 +11,8 @@ export declare function a(arg0: ComponentPropsWithoutRef<'a'>): import("react").
|
|
|
10
11
|
export declare function h1(arg0: ComponentPropsWithoutRef<'h1'>): import("react").JSX.Element;
|
|
11
12
|
export declare const code: typeof Code;
|
|
12
13
|
export declare const pre: typeof Pre;
|
|
13
|
-
export
|
|
14
|
+
export declare const img: typeof Image;
|
|
15
|
+
export { AccordionGroup, Button, Callout, Card, CardGroup, CodeGroup, FileTree, FileTreeItem, Step, Steps, Tab, Tabs, Tooltip, WebFrame };
|
|
14
16
|
export declare function h2(props: Omit<ComponentPropsWithoutRef<typeof Heading>, 'level'>): import('react').FunctionComponentElement<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref"> & {
|
|
15
17
|
id: string;
|
|
16
18
|
tag?: string;
|
package/output/mdx/remark.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export type MarkdownNode = {
|
|
|
7
7
|
};
|
|
8
8
|
children?: MarkdownNode[];
|
|
9
9
|
};
|
|
10
|
+
export declare function parseCodeMeta(meta: string | null | undefined): Record<string, string>;
|
|
10
11
|
declare function remarkCodeMeta(): (tree: MarkdownNode) => void;
|
|
11
12
|
export declare const markdownRemarkPlugins: (typeof remarkGfm | typeof remarkCodeMeta)[];
|
|
12
13
|
export {};
|
|
@@ -14,6 +14,7 @@ type ExampleMetaValueProps = {
|
|
|
14
14
|
export declare function ExampleMetaValue(arg0: ExampleMetaValueProps): ReactNode;
|
|
15
15
|
type CodeToolbarProps = {
|
|
16
16
|
code: string;
|
|
17
|
+
leadingControls?: ReactNode;
|
|
17
18
|
languageOptions?: SelectOption[];
|
|
18
19
|
selectedLanguageKey?: string;
|
|
19
20
|
onSelectLanguage?: (key: string) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { buildRequestCodeExamples } from '../lib/request-code';
|
|
3
3
|
import { OpenAPIOperation, OpenAPIOperationSource, OpenAPISpec } from '../lib/utils';
|
|
4
|
-
import { MediaTypeEntry, OpenApiParameter, RequestAuthInput } from '../types';
|
|
4
|
+
import { ExampleEntry, MediaTypeEntry, OpenApiParameter, RequestAuthInput } from '../types';
|
|
5
5
|
type RequestExamplesPanelProps = {
|
|
6
6
|
spec: OpenAPISpec;
|
|
7
7
|
path: string;
|
|
@@ -27,5 +27,6 @@ type ResponseExamplesPanelProps = {
|
|
|
27
27
|
selectedStatus?: string;
|
|
28
28
|
onSelectStatus?: (value: string) => void;
|
|
29
29
|
};
|
|
30
|
+
export declare function getResponseExampleBody(content: MediaTypeEntry | undefined, example: ExampleEntry | undefined): string;
|
|
30
31
|
export declare function ResponseExamplesPanel(arg0: ResponseExamplesPanelProps): ReactNode;
|
|
31
32
|
export { getServers, getServerKey, getServerLabel, defaultServerVariables, authPlaceholder, authLabel, getAuthOptions, type AuthOption, } from './helpers';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
type UiOption = {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
};
|
|
7
|
+
type InlineListboxProps = {
|
|
8
|
+
label: string;
|
|
9
|
+
value: string;
|
|
10
|
+
options: UiOption[];
|
|
11
|
+
onChange: (value: string) => void;
|
|
12
|
+
compact?: boolean;
|
|
13
|
+
buttonContent?: ReactNode;
|
|
14
|
+
buttonClassName?: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function InlineListbox(arg0: InlineListboxProps): ReactNode;
|
|
18
|
+
export {};
|
package/output/preview.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_i18n = require("./i18n-
|
|
3
|
-
const require_PageActions = require("./PageActions-
|
|
4
|
-
const require_OpenApiOperation = require("./OpenApiOperation-
|
|
2
|
+
const require_i18n = require("./i18n-C-fReCj-.cjs");
|
|
3
|
+
const require_PageActions = require("./PageActions-Dg1l9KB1.cjs");
|
|
4
|
+
const require_OpenApiOperation = require("./OpenApiOperation-DbZjxIuj.cjs");
|
|
5
5
|
let react = require("react");
|
|
6
6
|
let react_router_dom = require("react-router-dom");
|
|
7
7
|
let lucide_react = require("lucide-react");
|
package/output/preview.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as authPlaceholder, c as getServerKey, f as getMediaTypeEntries, i as ResponseExamplesPanel, l as getServers, o as defaultServerVariables, p as getRequestBody, r as RequestExamplesPanel, s as getAuthOptions, t as EndpointIdentity } from "./OpenApiOperation-
|
|
2
|
-
import { i as OpenApiSpecsContext, n as ConfigContext, r as LocaleContext } from "./i18n-
|
|
3
|
-
import { a as SectionProvider, i as Navigation } from "./PageActions-
|
|
1
|
+
import { a as authPlaceholder, c as getServerKey, f as getMediaTypeEntries, i as ResponseExamplesPanel, l as getServers, o as defaultServerVariables, p as getRequestBody, r as RequestExamplesPanel, s as getAuthOptions, t as EndpointIdentity } from "./OpenApiOperation-BZWeCbvy.js";
|
|
2
|
+
import { i as OpenApiSpecsContext, n as ConfigContext, r as LocaleContext } from "./i18n-Bqth9d6Q.js";
|
|
3
|
+
import { a as SectionProvider, i as Navigation } from "./PageActions-BQeEmXbT.js";
|
|
4
4
|
import { useState } from "react";
|
|
5
5
|
import { MemoryRouter } from "react-router-dom";
|
|
6
6
|
import { Menu, X } from "lucide-react";
|
|
@@ -19,7 +19,8 @@ function addCodeMetaAttributes(node) {
|
|
|
19
19
|
node.data = node.data ?? {};
|
|
20
20
|
node.data.hProperties = {
|
|
21
21
|
...node.data.hProperties,
|
|
22
|
-
...props
|
|
22
|
+
...props,
|
|
23
|
+
metastring: node.meta
|
|
23
24
|
};
|
|
24
25
|
}
|
|
25
26
|
}
|
|
@@ -30,6 +31,6 @@ function remarkCodeMeta() {
|
|
|
30
31
|
}
|
|
31
32
|
var markdownRemarkPlugins = [remarkGfm, remarkCodeMeta];
|
|
32
33
|
//#endregion
|
|
33
|
-
export { markdownRemarkPlugins as t };
|
|
34
|
+
export { parseCodeMeta as n, markdownRemarkPlugins as t };
|
|
34
35
|
|
|
35
|
-
//# sourceMappingURL=remark-
|
|
36
|
+
//# sourceMappingURL=remark-C9iRQM0R.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remark-C9iRQM0R.js","names":[],"sources":["../source/mdx/remark.ts"],"sourcesContent":["import remarkGfm from 'remark-gfm'\n\nexport type MarkdownNode = {\n type?: string\n meta?: string | null\n data?: {\n hProperties?: Record<string, unknown>\n }\n children?: MarkdownNode[]\n}\n\nexport function parseCodeMeta(meta: string | null | undefined): Record<string, string> {\n if (!meta) return {}\n\n const props: Record<string, string> = {}\n const pattern = /([\\w-]+)(?:=(\"([^\"]*)\"|'([^']*)'|([^\\s\"']+)))?/g\n let match: RegExpExecArray | null\n\n while ((match = pattern.exec(meta))) {\n const [, key, , doubleQuotedValue, singleQuotedValue, bareValue] = match\n if (!key) continue\n props[key] = doubleQuotedValue ?? singleQuotedValue ?? bareValue ?? 'true'\n }\n\n return props\n}\n\nfunction addCodeMetaAttributes(node: MarkdownNode) {\n if (node.type === 'code') {\n const props = parseCodeMeta(node.meta)\n if (Object.keys(props).length) {\n node.data = node.data ?? {}\n node.data.hProperties = {\n ...node.data.hProperties,\n ...props,\n metastring: node.meta,\n }\n }\n }\n\n for (const child of node.children ?? []) addCodeMetaAttributes(child)\n}\n\nfunction remarkCodeMeta() {\n return (tree: MarkdownNode) => addCodeMetaAttributes(tree)\n}\n\nexport const markdownRemarkPlugins = [remarkGfm, remarkCodeMeta]\n"],"mappings":";;AAWA,SAAgB,cAAc,MAAyD;CACrF,IAAI,CAAC,MAAM,OAAO,CAAC;CAEnB,MAAM,QAAgC,CAAC;CACvC,MAAM,UAAU;CAChB,IAAI;CAEJ,OAAQ,QAAQ,QAAQ,KAAK,IAAI,GAAI;EACnC,MAAM,GAAG,OAAO,mBAAmB,mBAAmB,aAAa;EACnE,IAAI,CAAC,KAAK;EACV,MAAM,OAAO,qBAAqB,qBAAqB,aAAa;CACtE;CAEA,OAAO;AACT;AAEA,SAAS,sBAAsB,MAAoB;CACjD,IAAI,KAAK,SAAS,QAAQ;EACxB,MAAM,QAAQ,cAAc,KAAK,IAAI;EACrC,IAAI,OAAO,KAAK,KAAK,CAAC,CAAC,QAAQ;GAC7B,KAAK,OAAO,KAAK,QAAQ,CAAC;GAC1B,KAAK,KAAK,cAAc;IACtB,GAAG,KAAK,KAAK;IACb,GAAG;IACH,YAAY,KAAK;GACnB;EACF;CACF;CAEA,KAAK,MAAM,SAAS,KAAK,YAAY,CAAC,GAAG,sBAAsB,KAAK;AACtE;AAEA,SAAS,iBAAiB;CACxB,QAAQ,SAAuB,sBAAsB,IAAI;AAC3D;AAEA,IAAa,wBAAwB,CAAC,WAAW,cAAc"}
|
|
@@ -21,7 +21,8 @@ function addCodeMetaAttributes(node) {
|
|
|
21
21
|
node.data = node.data ?? {};
|
|
22
22
|
node.data.hProperties = {
|
|
23
23
|
...node.data.hProperties,
|
|
24
|
-
...props
|
|
24
|
+
...props,
|
|
25
|
+
metastring: node.meta
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
28
|
}
|
|
@@ -38,5 +39,11 @@ Object.defineProperty(exports, "markdownRemarkPlugins", {
|
|
|
38
39
|
return markdownRemarkPlugins;
|
|
39
40
|
}
|
|
40
41
|
});
|
|
42
|
+
Object.defineProperty(exports, "parseCodeMeta", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function() {
|
|
45
|
+
return parseCodeMeta;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
41
48
|
|
|
42
|
-
//# sourceMappingURL=remark-
|
|
49
|
+
//# sourceMappingURL=remark-DTLbG8PK.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remark-DTLbG8PK.cjs","names":[],"sources":["../source/mdx/remark.ts"],"sourcesContent":["import remarkGfm from 'remark-gfm'\n\nexport type MarkdownNode = {\n type?: string\n meta?: string | null\n data?: {\n hProperties?: Record<string, unknown>\n }\n children?: MarkdownNode[]\n}\n\nexport function parseCodeMeta(meta: string | null | undefined): Record<string, string> {\n if (!meta) return {}\n\n const props: Record<string, string> = {}\n const pattern = /([\\w-]+)(?:=(\"([^\"]*)\"|'([^']*)'|([^\\s\"']+)))?/g\n let match: RegExpExecArray | null\n\n while ((match = pattern.exec(meta))) {\n const [, key, , doubleQuotedValue, singleQuotedValue, bareValue] = match\n if (!key) continue\n props[key] = doubleQuotedValue ?? singleQuotedValue ?? bareValue ?? 'true'\n }\n\n return props\n}\n\nfunction addCodeMetaAttributes(node: MarkdownNode) {\n if (node.type === 'code') {\n const props = parseCodeMeta(node.meta)\n if (Object.keys(props).length) {\n node.data = node.data ?? {}\n node.data.hProperties = {\n ...node.data.hProperties,\n ...props,\n metastring: node.meta,\n }\n }\n }\n\n for (const child of node.children ?? []) addCodeMetaAttributes(child)\n}\n\nfunction remarkCodeMeta() {\n return (tree: MarkdownNode) => addCodeMetaAttributes(tree)\n}\n\nexport const markdownRemarkPlugins = [remarkGfm, remarkCodeMeta]\n"],"mappings":";;;;AAWA,SAAgB,cAAc,MAAyD;CACrF,IAAI,CAAC,MAAM,OAAO,CAAC;CAEnB,MAAM,QAAgC,CAAC;CACvC,MAAM,UAAU;CAChB,IAAI;CAEJ,OAAQ,QAAQ,QAAQ,KAAK,IAAI,GAAI;EACnC,MAAM,GAAG,OAAO,mBAAmB,mBAAmB,aAAa;EACnE,IAAI,CAAC,KAAK;EACV,MAAM,OAAO,qBAAqB,qBAAqB,aAAa;CACtE;CAEA,OAAO;AACT;AAEA,SAAS,sBAAsB,MAAoB;CACjD,IAAI,KAAK,SAAS,QAAQ;EACxB,MAAM,QAAQ,cAAc,KAAK,IAAI;EACrC,IAAI,OAAO,KAAK,KAAK,CAAC,CAAC,QAAQ;GAC7B,KAAK,OAAO,KAAK,QAAQ,CAAC;GAC1B,KAAK,KAAK,cAAc;IACtB,GAAG,KAAK,KAAK;IACb,GAAG;IACH,YAAY,KAAK;GACnB;EACF;CACF;CAEA,KAAK,MAAM,SAAS,KAAK,YAAY,CAAC,GAAG,sBAAsB,KAAK;AACtE;AAEA,SAAS,iBAAiB;CACxB,QAAQ,SAAuB,sBAAsB,IAAI;AAC3D;AAEA,IAAa,wBAAwB,CAAC,WAAA,SAAW,cAAc"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_ClarifyShell = require("./ClarifyShell-
|
|
1
|
+
const require_ClarifyShell = require("./ClarifyShell-UsefuuLS.cjs");
|
|
2
2
|
let react = require("react");
|
|
3
3
|
let react_router_dom = require("react-router-dom");
|
|
4
4
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -61,4 +61,4 @@ Object.defineProperty(exports, "render", {
|
|
|
61
61
|
}
|
|
62
62
|
});
|
|
63
63
|
|
|
64
|
-
//# sourceMappingURL=render-
|
|
64
|
+
//# sourceMappingURL=render-Dc9wxg_r.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-
|
|
1
|
+
{"version":3,"file":"render-Dc9wxg_r.cjs","names":[],"sources":["../source/runtime/render.tsx"],"sourcesContent":["import { StrictMode } from 'react'\nimport { hydrateRoot, createRoot, type Root } from 'react-dom/client'\nimport { BrowserRouter } from 'react-router-dom'\n\nimport type { RenderOptions } from '../types'\n\nimport { ClarifyShell } from './ClarifyShell'\n\nlet root: Root | undefined\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 if (typeof window === 'undefined') return false\n\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, openApiSpecs = {}, runtimeSlots, 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 <ClarifyShell\n config={config}\n routes={routes}\n navigation={navigation}\n openApiSpecs={openApiSpecs}\n runtimeSlots={runtimeSlots}\n themeEditor={themeEditor}\n />\n </BrowserRouter>\n </StrictMode>\n )\n\n const hydrationDebug = isHydrationDebugEnabled()\n\n if (root) {\n root.render(app)\n return\n }\n\n try {\n root = 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 root = createRoot(target as Element)\n root.render(app)\n }\n}\n"],"mappings":";;;;;;AAQA,IAAI;;;;;;;;;;;AAYJ,SAAS,0BAAmC;CAC1C,IAAI,OAAO,WAAW,aAAa,OAAO;CAE1C,IAAI;EAEF,OAAO,IADY,gBAAgB,OAAO,SAAS,MAC5C,CAAA,CAAO,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,eAAe,CAAC,GAAG,cAAc,WAAW,cAAc,UAAU;CAExG,MAAM,SAAS,aAAa,SAAS,eAAe,MAAM;CAC1D,IAAI,CAAC,QACH,MAAM,IAAI,MAAM,qDAAmD;CAGrE,MAAM,MACJ,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAA,YAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,iBAAA,eAAD;EAAe,UAAU,OAAO;YAC9B,iBAAA,GAAA,kBAAA,IAAA,CAAC,qBAAA,cAAD;GACU;GACA;GACI;GACE;GACA;GACD;EACd,CAAA;CACY,CAAA,EACL,CAAA;CAGd,MAAM,iBAAiB,wBAAwB;CAE/C,IAAI,MAAM;EACR,KAAK,OAAO,GAAG;EACf;CACF;CAEA,IAAI;EACF,QAAA,GAAA,iBAAA,YAAA,CAAmB,QAAmB,KAAK,EACzC,mBAAmB,OAAO,WAAW;GAGnC,IAAI,gBACF,QAAQ,KAAK,0CAA0C,OAAO,SAAS;EAE3E,EACF,CAAC;CACH,SAAS,KAAK;EACZ,QAAQ,KAAK,8DAA8D,GAAG;EAC9E,QAAA,GAAA,iBAAA,WAAA,CAAkB,MAAiB;EACnC,KAAK,OAAO,GAAG;CACjB;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as ClarifyShell } from "./ClarifyShell-
|
|
1
|
+
import { t as ClarifyShell } from "./ClarifyShell-Cq5Af46F.js";
|
|
2
2
|
import { StrictMode } from "react";
|
|
3
3
|
import { BrowserRouter } from "react-router-dom";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -56,4 +56,4 @@ function render(options) {
|
|
|
56
56
|
//#endregion
|
|
57
57
|
export { render as t };
|
|
58
58
|
|
|
59
|
-
//# sourceMappingURL=render-
|
|
59
|
+
//# sourceMappingURL=render-aS-w4fK4.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-
|
|
1
|
+
{"version":3,"file":"render-aS-w4fK4.js","names":[],"sources":["../source/runtime/render.tsx"],"sourcesContent":["import { StrictMode } from 'react'\nimport { hydrateRoot, createRoot, type Root } from 'react-dom/client'\nimport { BrowserRouter } from 'react-router-dom'\n\nimport type { RenderOptions } from '../types'\n\nimport { ClarifyShell } from './ClarifyShell'\n\nlet root: Root | undefined\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 if (typeof window === 'undefined') return false\n\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, openApiSpecs = {}, runtimeSlots, 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 <ClarifyShell\n config={config}\n routes={routes}\n navigation={navigation}\n openApiSpecs={openApiSpecs}\n runtimeSlots={runtimeSlots}\n themeEditor={themeEditor}\n />\n </BrowserRouter>\n </StrictMode>\n )\n\n const hydrationDebug = isHydrationDebugEnabled()\n\n if (root) {\n root.render(app)\n return\n }\n\n try {\n root = 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 root = createRoot(target as Element)\n root.render(app)\n }\n}\n"],"mappings":";;;;;;AAQA,IAAI;;;;;;;;;;;AAYJ,SAAS,0BAAmC;CAC1C,IAAI,OAAO,WAAW,aAAa,OAAO;CAE1C,IAAI;EAEF,OAAO,IADY,gBAAgB,OAAO,SAAS,MAC5C,CAAA,CAAO,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,eAAe,CAAC,GAAG,cAAc,WAAW,cAAc,UAAU;CAExG,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,cAAD;GACU;GACA;GACI;GACE;GACA;GACD;EACd,CAAA;CACY,CAAA,EACL,CAAA;CAGd,MAAM,iBAAiB,wBAAwB;CAE/C,IAAI,MAAM;EACR,KAAK,OAAO,GAAG;EACf;CACF;CAEA,IAAI;EACF,OAAO,YAAY,QAAmB,KAAK,EACzC,mBAAmB,OAAO,WAAW;GAGnC,IAAI,gBACF,QAAQ,KAAK,0CAA0C,OAAO,SAAS;EAE3E,EACF,CAAC;CACH,SAAS,KAAK;EACZ,QAAQ,KAAK,8DAA8D,GAAG;EAC9E,OAAO,WAAW,MAAiB;EACnC,KAAK,OAAO,GAAG;CACjB;AACF"}
|