@clarify-labs/renderer 0.10.3 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/output/{ClarifyShell-UsefuuLS.cjs → ClarifyShell-BAjq876Z.cjs} +85 -82
  2. package/output/ClarifyShell-BAjq876Z.cjs.map +1 -0
  3. package/output/{ClarifyShell-Cq5Af46F.js → ClarifyShell-GoSXvgMg.js} +85 -82
  4. package/output/ClarifyShell-GoSXvgMg.js.map +1 -0
  5. package/output/{MermaidViewer-Db7qsyVk.cjs → MermaidViewer-BZ8ghcFP.cjs} +2 -2
  6. package/output/{MermaidViewer-Db7qsyVk.cjs.map → MermaidViewer-BZ8ghcFP.cjs.map} +1 -1
  7. package/output/{MermaidViewer-Bc9H25yK.js → MermaidViewer-CkIxyqtf.js} +2 -2
  8. package/output/{MermaidViewer-Bc9H25yK.js.map → MermaidViewer-CkIxyqtf.js.map} +1 -1
  9. package/output/{OpenApiOperation-BZWeCbvy.js → OpenApiOperation-C2vJztWZ.js} +1536 -211
  10. package/output/OpenApiOperation-C2vJztWZ.js.map +1 -0
  11. package/output/{OpenApiOperation-DbZjxIuj.cjs → OpenApiOperation-D-5uE5v7.cjs} +1539 -208
  12. package/output/OpenApiOperation-D-5uE5v7.cjs.map +1 -0
  13. package/output/{PageActions-Dg1l9KB1.cjs → PageActions-DJRXlGhz.cjs} +16 -16
  14. package/output/PageActions-DJRXlGhz.cjs.map +1 -0
  15. package/output/{PageActions-BQeEmXbT.js → PageActions-bugd7GZh.js} +16 -16
  16. package/output/PageActions-bugd7GZh.js.map +1 -0
  17. package/output/{SearchDialog-DjKvqN7p.cjs → SearchDialog-8AdCRp6K.cjs} +3 -3
  18. package/output/{SearchDialog-DjKvqN7p.cjs.map → SearchDialog-8AdCRp6K.cjs.map} +1 -1
  19. package/output/{SearchDialog-B67VA0Ut.js → SearchDialog-CBJjDs_9.js} +3 -3
  20. package/output/{SearchDialog-B67VA0Ut.js.map → SearchDialog-CBJjDs_9.js.map} +1 -1
  21. package/output/app/PageFooter.d.ts +1 -1
  22. package/output/client.cjs +3 -3
  23. package/output/client.js +3 -3
  24. package/output/components/Tooltip.d.ts +1 -0
  25. package/output/core/i18n.d.ts +1 -1
  26. package/output/core/types.d.ts +37 -19
  27. package/output/{i18n-Bqth9d6Q.js → i18n-BPrC45nD.js} +98 -2
  28. package/output/i18n-BPrC45nD.js.map +1 -0
  29. package/output/{i18n-C-fReCj-.cjs → i18n-wXINKKV0.cjs} +98 -2
  30. package/output/i18n-wXINKKV0.cjs.map +1 -0
  31. package/output/index.cjs +26 -5
  32. package/output/index.cjs.map +1 -1
  33. package/output/index.d.ts +3 -3
  34. package/output/index.js +26 -6
  35. package/output/index.js.map +1 -1
  36. package/output/mdx/components.d.ts +2 -1
  37. package/output/openapi/components/EndpointMethodBadge.d.ts +6 -0
  38. package/output/openapi/components/EndpointSections.d.ts +2 -2
  39. package/output/openapi/components/ExamplePanels.d.ts +2 -2
  40. package/output/openapi/components/InlineListbox.d.ts +13 -0
  41. package/output/openapi/components/OpenApiAuthPanel.d.ts +12 -0
  42. package/output/openapi/components/OpenApiOperation.d.ts +1 -9
  43. package/output/openapi/components/OpenApiOperation.state.d.ts +4 -2
  44. package/output/openapi/components/OpenApiRequest.d.ts +18 -0
  45. package/output/openapi/components/OpenApiRequestFields.d.ts +25 -0
  46. package/output/openapi/components/OpenApiResponseViewer.d.ts +8 -0
  47. package/output/openapi/components/SendRequestButton.d.ts +9 -0
  48. package/output/openapi/components/helpers.d.ts +6 -1
  49. package/output/openapi/components/useOpenApiRequestState.d.ts +41 -0
  50. package/output/openapi/entry.d.ts +2 -0
  51. package/output/openapi/index.d.ts +2 -2
  52. package/output/openapi/lib/api-exchange-code.d.ts +8 -0
  53. package/output/openapi/lib/api-exchange.d.ts +30 -0
  54. package/output/openapi/lib/api-request.d.ts +24 -0
  55. package/output/openapi/lib/request-code.d.ts +2 -2
  56. package/output/openapi/lib/request-parameters.d.ts +5 -0
  57. package/output/openapi/store.d.ts +10 -0
  58. package/output/openapi/types.d.ts +4 -0
  59. package/output/preview.cjs +37 -27
  60. package/output/preview.cjs.map +1 -1
  61. package/output/preview.js +37 -27
  62. package/output/preview.js.map +1 -1
  63. package/output/{render-Dc9wxg_r.cjs → render-FICIzeXz.cjs} +2 -2
  64. package/output/{render-Dc9wxg_r.cjs.map → render-FICIzeXz.cjs.map} +1 -1
  65. package/output/{render-aS-w4fK4.js → render-XQiw_48i.js} +2 -2
  66. package/output/{render-aS-w4fK4.js.map → render-XQiw_48i.js.map} +1 -1
  67. package/output/renderer.css +547 -150
  68. package/output/server.cjs +2 -2
  69. package/output/server.js +2 -2
  70. package/output/theme/ThemeEditor.d.ts +8 -4
  71. package/output/theme/variables.d.ts +8 -4
  72. package/package.json +1 -1
  73. package/output/ClarifyShell-Cq5Af46F.js.map +0 -1
  74. package/output/ClarifyShell-UsefuuLS.cjs.map +0 -1
  75. package/output/OpenApiOperation-BZWeCbvy.js.map +0 -1
  76. package/output/OpenApiOperation-DbZjxIuj.cjs.map +0 -1
  77. package/output/PageActions-BQeEmXbT.js.map +0 -1
  78. package/output/PageActions-Dg1l9KB1.cjs.map +0 -1
  79. package/output/i18n-Bqth9d6Q.js.map +0 -1
  80. package/output/i18n-C-fReCj-.cjs.map +0 -1
@@ -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 { 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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MAAM,YAAY,eAAe,KAAA,GAAW,QAAQ;CAE5D,IAAI,SACF,OAAO,oBAAC,YAAD,EAAA,UAAa,EAAE,iBAAiB,EAAc,CAAA;CAEvD,IAAI,CAAC,MACH,OAAO,oBAAC,YAAD,EAAA,UAAa,EAAE,wBAAwB,EAAE,SAAS,CAAC,EAAc,CAAA;CAG1E,OAAO,oBAAC,0BAAD;EAAgC;EAAY;EAAc;CAAS,CAAA;AAC5E;AAEA,SAAgB,4BAA4B,MAAwB;CAClE,OAAO,SAAS,mBAAmB;EACjC,OAAO,oBAAC,iBAAD,EAAiB,MAAM,KAAK,KAAO,CAAA;CAC5C;AACF;;;ACjJA,IAAM,uBAAuB;CAC3B,GAAG;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"}
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 { 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 <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 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 { Markdown } from './Markdown'\nimport * as mdxPrimitives from './primitives'\n\nconst builtInMDXComponents = {\n ...mdxPrimitives,\n Markdown,\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>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AEnF,MAAM,QAAQ,yBAAyB,MAAM,MAAM,MAAM;CACzD,IAAI,CAAC,OAAO,OAAO,oBAAC,YAAD;EAAY,MAAK;YAAO,EAAE,4BAA4B,EAAE,UAAU,GAAG,OAAO,YAAY,EAAE,GAAG,OAAO,CAAC;CAAc,CAAA;CAEtI,OACE,oBAAC,yBAAD;EACQ;EACA;EACN,QAAQ,MAAM,OAAO,YAAY;EACjC,WAAW,MAAM;EACjB,iBAAiB,MAAM;CACxB,CAAA;AAEL;AAEA,SAAgB,4BAA4B,MAAwB;CAClE,OAAO,SAAS,mBAAmB;EACjC,OAAO,oBAAC,iBAAD,EAAiB,MAAM,KAAK,KAAO,CAAA;CAC5C;AACF;;;AC1KA,IAAM,uBAAuB;CAC3B,GAAG;CACH;CACA;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;;;AChBA,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,9 +1,10 @@
1
1
  import { Collapse } from '../components/Collapse';
2
2
  import { Mermaid } from '../components/Mermaid';
3
- import { OpenApiDocument, OpenApiOperation } from '../openapi';
3
+ import { OpenApiRequest, OpenApiDocument, OpenApiOperation } from '../openapi';
4
4
  import { Markdown } from './Markdown';
5
5
  import * as mdxPrimitives from './primitives';
6
6
  export declare function useMDXComponents(components?: Record<string, unknown>): {
7
+ OpenApiRequest: typeof OpenApiRequest;
7
8
  OpenApiDocument: typeof OpenApiDocument;
8
9
  OpenApiOperation: typeof OpenApiOperation;
9
10
  Markdown: typeof Markdown;
@@ -0,0 +1,6 @@
1
+ import { ReactNode } from 'react';
2
+ type EndpointMethodBadgeProps = {
3
+ method: string;
4
+ };
5
+ export declare function EndpointMethodBadge(arg0: EndpointMethodBadgeProps): ReactNode;
6
+ export {};
@@ -1,6 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { OpenAPIOperation, OpenAPIOperationSource, OpenAPISpec } from '../lib/utils';
3
- import { MediaTypeEntry, OpenApiParameter, OpenApiRecord, OpenApiServer, RequestAuthInput } from '../types';
3
+ import { MediaTypeEntry, OpenApiParameter, OpenApiRecord, OpenApiServer, RequestAuthInputs } from '../types';
4
4
  type EndpointRequestProps = {
5
5
  spec: OpenAPISpec;
6
6
  path: string;
@@ -20,7 +20,7 @@ type EndpointRequestProps = {
20
20
  onSelectRequestMediaType: (value: string) => void;
21
21
  selectedServer: OpenApiServer;
22
22
  serverVariables: Record<string, string>;
23
- auth?: RequestAuthInput;
23
+ auth?: RequestAuthInputs;
24
24
  sharedExampleKey?: string;
25
25
  onSelectExampleKey?: (value: string) => void;
26
26
  };
@@ -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 { ExampleEntry, MediaTypeEntry, OpenApiParameter, RequestAuthInput } from '../types';
4
+ import { ExampleEntry, MediaTypeEntry, OpenApiParameter, RequestAuthInputs } from '../types';
5
5
  type RequestExamplesPanelProps = {
6
6
  spec: OpenAPISpec;
7
7
  path: string;
@@ -12,7 +12,7 @@ type RequestExamplesPanelProps = {
12
12
  onSelectMediaType: (value: string) => void;
13
13
  selectedServer: Parameters<typeof buildRequestCodeExamples>[0]['server'];
14
14
  serverVariables: Record<string, string>;
15
- auth?: RequestAuthInput;
15
+ auth?: RequestAuthInputs;
16
16
  operationSource?: OpenAPIOperationSource;
17
17
  sharedExampleKey?: string;
18
18
  onSelectExampleKey?: (value: string) => void;
@@ -13,6 +13,19 @@ type InlineListboxProps = {
13
13
  buttonContent?: ReactNode;
14
14
  buttonClassName?: string;
15
15
  className?: string;
16
+ invalid?: boolean;
17
+ describedBy?: string;
18
+ disabled?: boolean;
19
+ };
20
+ type MultiInlineListboxProps = {
21
+ label: string;
22
+ value: string[];
23
+ options: UiOption[];
24
+ onChange: (value: string[]) => void;
25
+ disabled?: boolean;
26
+ invalid?: boolean;
27
+ describedBy?: string;
16
28
  };
17
29
  export declare function InlineListbox(arg0: InlineListboxProps): ReactNode;
30
+ export declare function MultiInlineListbox(arg0: MultiInlineListboxProps): ReactNode;
18
31
  export {};
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from 'react';
2
+ import { AuthOption } from './ExamplePanels';
3
+ export type OpenApiAuthPanelProps = {
4
+ authOptions: AuthOption[];
5
+ selectedAuthName: string;
6
+ selectedAuth?: AuthOption;
7
+ authValues: Record<string, string>;
8
+ onSelectAuth: (name: string) => void;
9
+ onChangeAuthValue: (name: string, value: string) => void;
10
+ onClearAuthValue: (name: string) => void;
11
+ };
12
+ export declare function OpenApiAuthPanel(arg0: OpenApiAuthPanelProps): ReactNode;
@@ -1,7 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { OpenAPIOperation, OpenAPIOperationSource, OpenAPISpec } from '../lib/utils';
3
3
  import { OpenApiServer } from '../types';
4
- import { AuthOption } from './ExamplePanels';
5
4
  export type OpenApiOperationProps = {
6
5
  spec: OpenAPISpec;
7
6
  path: string;
@@ -24,17 +23,10 @@ type EndpointIdentityProps = {
24
23
  selectedServer: OpenApiServer;
25
24
  serverVariables: Record<string, string>;
26
25
  serverOpen: boolean;
27
- authOptions: AuthOption[];
28
- selectedAuthName: string;
29
- selectedAuth?: AuthOption;
30
- authValues: Record<string, string>;
31
- authOpen: boolean;
32
26
  onSelectServer: (key: string) => void;
33
27
  onChangeServerVariable: (name: string, value: string) => void;
34
28
  onToggleServer: () => void;
35
- onToggleAuth: () => void;
36
- onSelectAuth: (name: string) => void;
37
- onChangeAuthValue: (name: string, value: string) => void;
29
+ onTryRequest?: () => void;
38
30
  };
39
31
  export declare function EndpointIdentity(arg0: EndpointIdentityProps): ReactNode;
40
32
  export declare function OpenApiOperation(arg0: OpenApiOperationProps): ReactNode;
@@ -1,6 +1,6 @@
1
1
  import { getMediaTypeEntries, getRequestBody } from '../lib/helpers';
2
2
  import { OpenAPIOperation, OpenAPIOperationSource, OpenAPISpec } from '../lib/utils';
3
- import { OpenApiParameter, OpenApiServer, RequestAuthInput } from '../types';
3
+ import { OpenApiParameter, OpenApiServer, RequestAuthInputs } from '../types';
4
4
  import { AuthOption } from './ExamplePanels';
5
5
  export type OperationRequestState = {
6
6
  parameters: OpenApiParameter[];
@@ -34,9 +34,11 @@ export type OperationAuthState = {
34
34
  selectedAuth?: AuthOption;
35
35
  authValues: Record<string, string>;
36
36
  authOpen: boolean;
37
- authInput?: RequestAuthInput;
37
+ authInput?: RequestAuthInputs;
38
38
  onSelectAuth: (name: string) => void;
39
39
  onChangeAuthValue: (name: string, value: string) => void;
40
+ onClearAuthValue: (name: string) => void;
41
+ onClearAuthValues: () => void;
40
42
  onToggleAuth: () => void;
41
43
  closeAuth: () => void;
42
44
  };
@@ -0,0 +1,18 @@
1
+ import { ReactNode } from 'react';
2
+ import { OpenAPIOperation, OpenAPIOperationSource, OpenAPISpec } from '../lib/utils';
3
+ type OpenApiRequestWorkbenchProps = {
4
+ spec: OpenAPISpec;
5
+ path: string;
6
+ method: string;
7
+ operation: OpenAPIOperation;
8
+ operationSource?: OpenAPIOperationSource;
9
+ compact?: boolean;
10
+ onClose?: () => void;
11
+ };
12
+ type OpenApiRequestDialogProps = OpenApiRequestWorkbenchProps & {
13
+ open: boolean;
14
+ onClose: () => void;
15
+ };
16
+ export declare function OpenApiRequestWorkbench(arg0: OpenApiRequestWorkbenchProps): ReactNode;
17
+ export declare function OpenApiRequestDialog(arg0: OpenApiRequestDialogProps): ReactNode;
18
+ export {};
@@ -0,0 +1,25 @@
1
+ import { ReactNode } from 'react';
2
+ import { RequestParameterIssue } from '../lib/request-parameters';
3
+ import { OpenAPISpec } from '../lib/utils';
4
+ import { OpenApiParameter } from '../types';
5
+ type RequestFieldProps = {
6
+ spec: OpenAPISpec;
7
+ parameter: OpenApiParameter;
8
+ value: string;
9
+ enabled: boolean;
10
+ onChange: (value: string) => void;
11
+ onEnabledChange: (enabled: boolean) => void;
12
+ issue?: RequestParameterIssue;
13
+ };
14
+ type RequestSectionProps = {
15
+ title: string;
16
+ count?: number;
17
+ defaultOpen?: boolean;
18
+ actions?: ReactNode;
19
+ className?: string;
20
+ contentClassName?: string;
21
+ children: ReactNode;
22
+ };
23
+ export declare function RequestField(arg0: RequestFieldProps): ReactNode;
24
+ export declare function RequestSection(arg0: RequestSectionProps): ReactNode;
25
+ export {};
@@ -0,0 +1,8 @@
1
+ import { ReactNode } from 'react';
2
+ import { ApiResponseExchange } from '../lib/api-exchange';
3
+ type OpenApiResponseViewerProps = {
4
+ exchange?: ApiResponseExchange;
5
+ error?: string;
6
+ };
7
+ export declare function OpenApiResponseViewer(arg0: OpenApiResponseViewerProps): ReactNode;
8
+ export {};
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ type SendRequestButtonProps = {
3
+ label: string;
4
+ busy?: boolean;
5
+ text?: string;
6
+ onClick: () => void;
7
+ };
8
+ export declare function SendRequestButton(arg0: SendRequestButtonProps): ReactNode;
9
+ export {};
@@ -9,10 +9,15 @@ export declare function getServers(spec: OpenAPISpec, operation: OpenAPIOperatio
9
9
  export declare function getServerKey(server: OpenApiServer, index: number): string;
10
10
  export declare function getServerLabel(server: OpenApiServer, index: number): string;
11
11
  export declare function defaultServerVariables(server?: OpenApiServer): Record<string, string>;
12
- export type AuthOption = {
12
+ export type AuthSchemeOption = {
13
13
  name: string;
14
14
  scheme: OpenApiSecurityScheme;
15
15
  };
16
+ export type AuthOption = {
17
+ key: string;
18
+ label: string;
19
+ schemes: AuthSchemeOption[];
20
+ };
16
21
  export declare function getAuthOptions(spec: OpenAPISpec, operation: OpenAPIOperation): AuthOption[];
17
22
  export declare function authPlaceholder(auth?: AuthPlaceholderArg): string;
18
23
  export declare function authLabel(name: string, scheme: OpenApiSecurityScheme): string;
@@ -0,0 +1,41 @@
1
+ import { executeApiRequest, ApiResponseExchange } from '../lib/api-exchange';
2
+ import { RequestParameterIssue } from '../lib/request-parameters';
3
+ import { OpenAPIOperation, OpenAPIOperationSource, OpenAPISpec } from '../lib/utils';
4
+ import { OpenApiParameter } from '../types';
5
+ export declare function useOpenApiRequestTarget(spec: OpenAPISpec, path: string, operation: OpenAPIOperation, operationSource: OpenAPIOperationSource): {
6
+ servers: import('../types').OpenApiServer[];
7
+ selectedServer: import('../types').OpenApiServer;
8
+ selectedServerKey: string;
9
+ serverVariables: Record<string, string>;
10
+ setServerVariables: import('react').Dispatch<import('react').SetStateAction<Record<string, string>>>;
11
+ serverVariableEntries: [string, import('../types').OpenApiServerVariable][];
12
+ selectServer: (value: string) => void;
13
+ authOptions: import('./helpers').AuthOption[];
14
+ selectedAuthName: string;
15
+ setSelectedAuthName: import('react').Dispatch<import('react').SetStateAction<string>>;
16
+ selectedAuth: import('./helpers').AuthOption | undefined;
17
+ credentialScope: string;
18
+ credentials: Record<string, string>;
19
+ setCredential: (scope: string, name: string, value: string) => void;
20
+ clearCredential: (scope: string, name: string) => void;
21
+ requestContents: import('../types').MediaTypeEntry[];
22
+ mediaType: string;
23
+ body: string;
24
+ setBody: import('react').Dispatch<import('react').SetStateAction<string>>;
25
+ selectMediaType: (value: string) => void;
26
+ };
27
+ export declare function useOpenApiParameterState(spec: OpenAPISpec, parameters: OpenApiParameter[], initialParameterValue: (parameter: OpenApiParameter) => string): {
28
+ parameterValues: Record<string, string>;
29
+ parameterEnabled: Record<string, boolean>;
30
+ parameterIssues: Record<string, RequestParameterIssue>;
31
+ setParameterGroupValues: (grouped: OpenApiParameter[], mode: "reset" | "clear") => void;
32
+ setParameterIncluded: (parameter: OpenApiParameter, enabled: boolean) => void;
33
+ updateParameterValue: (parameter: OpenApiParameter, value: string) => void;
34
+ validate: (parametersToValidate: OpenApiParameter[]) => Record<string, RequestParameterIssue>;
35
+ };
36
+ export declare function useOpenApiRequestExecution(): {
37
+ exchange: ApiResponseExchange | undefined;
38
+ error: string;
39
+ sending: boolean;
40
+ execute: (request: Parameters<typeof executeApiRequest>[0], corsHint: string) => Promise<void>;
41
+ };
@@ -13,6 +13,8 @@ export type OpenApiOperationProps = {
13
13
  path: string;
14
14
  method: string;
15
15
  };
16
+ export type OpenApiRequestProps = OpenApiOperationProps;
16
17
  export declare function OpenApiDocument(arg0: OpenApiDocumentProps): ReactNode;
17
18
  export declare function OpenApiOperation(arg0: OpenApiOperationProps): ReactNode;
19
+ export declare function OpenApiRequest(arg0: OpenApiRequestProps): ReactNode;
18
20
  export declare function createOpenApiRouteComponent(data: OpenApiRouteData): () => import("react").JSX.Element;
@@ -1,3 +1,3 @@
1
- export { OpenApiOperation, OpenApiDocument, createOpenApiRouteComponent } from './entry';
2
- export type { OpenApiOperationProps, OpenApiDocumentProps, OpenApiRouteData } from './entry';
1
+ export { OpenApiRequest, OpenApiOperation, OpenApiDocument, createOpenApiRouteComponent } from './entry';
2
+ export type { OpenApiRequestProps, OpenApiOperationProps, OpenApiDocumentProps, OpenApiRouteData } from './entry';
3
3
  export type { OpenAPIOperation, OpenAPISpec } from './lib/utils';
@@ -0,0 +1,8 @@
1
+ import { ApiRequestSnapshot } from './api-exchange';
2
+ export type ApiExchangeCodeExample = {
3
+ id: 'curl' | 'fetch';
4
+ label: string;
5
+ language: 'bash' | 'javascript';
6
+ code: string;
7
+ };
8
+ export declare function buildApiExchangeCodeExamples(snapshot: ApiRequestSnapshot): ApiExchangeCodeExample[];
@@ -0,0 +1,30 @@
1
+ import { BuiltApiRequest } from './api-request';
2
+ export type ApiRequestSnapshot = {
3
+ url: string;
4
+ method: string;
5
+ headers: Array<[string, string]>;
6
+ body?: string;
7
+ };
8
+ export type ApiResponseExchange = {
9
+ request: ApiRequestSnapshot;
10
+ status: number;
11
+ statusText: string;
12
+ url: string;
13
+ redirected: boolean;
14
+ duration: number;
15
+ size: number;
16
+ headers: Array<[string, string]>;
17
+ contentType: string;
18
+ body: string;
19
+ blob: Blob;
20
+ };
21
+ export type ExecuteApiRequestOptions = {
22
+ signal?: AbortSignal;
23
+ fetch?: typeof fetch;
24
+ now?: () => number;
25
+ };
26
+ export declare class ApiRequestError extends Error {
27
+ readonly category: 'network';
28
+ constructor(message: string, options?: ErrorOptions);
29
+ }
30
+ export declare function executeApiRequest(request: BuiltApiRequest, options?: ExecuteApiRequestOptions): Promise<ApiResponseExchange>;
@@ -0,0 +1,24 @@
1
+ import { OpenApiParameter, OpenApiSecurityScheme, OpenApiServer } from '../types';
2
+ export type ApiRequestAuth = {
3
+ scheme: OpenApiSecurityScheme;
4
+ value: string;
5
+ };
6
+ export type ApiRequestInput = {
7
+ method: string;
8
+ path: string;
9
+ server: OpenApiServer;
10
+ serverVariables?: Record<string, string>;
11
+ parameters: OpenApiParameter[];
12
+ parameterValues: Record<string, string>;
13
+ parameterEnabled?: Record<string, boolean>;
14
+ auth?: ApiRequestAuth[];
15
+ mediaType?: string;
16
+ body?: string;
17
+ baseUrl?: string;
18
+ };
19
+ export type BuiltApiRequest = {
20
+ url: string;
21
+ init: RequestInit;
22
+ };
23
+ export declare function parameterKey(parameter: OpenApiParameter): string;
24
+ export declare function buildApiRequest(input: ApiRequestInput): BuiltApiRequest;
@@ -1,4 +1,4 @@
1
- import { OpenApiMediaType, OpenApiParameter, OpenApiServer, RequestAuthInput, RequestCodeExample } from '../types';
1
+ import { OpenApiMediaType, OpenApiParameter, OpenApiServer, RequestAuthInputs, RequestCodeExample } from '../types';
2
2
  import { OpenAPIOperationSource, OpenAPISpec } from './utils';
3
3
  type RequestContent = {
4
4
  mediaType: string;
@@ -12,7 +12,7 @@ export type RequestCodeInput = {
12
12
  requestContent?: RequestContent;
13
13
  server?: OpenApiServer;
14
14
  serverVariables?: Record<string, string>;
15
- auth?: RequestAuthInput;
15
+ auth?: RequestAuthInputs;
16
16
  operationSource?: OpenAPIOperationSource;
17
17
  };
18
18
  export declare function buildRequestCodeExamples(input: RequestCodeInput): RequestCodeExample[];
@@ -0,0 +1,5 @@
1
+ import { OpenApiParameter } from '../types';
2
+ import { OpenAPISpec } from './utils';
3
+ export type RequestParameterIssue = 'required' | 'invalidArray' | 'invalidObject' | 'invalidNumber' | 'invalidInteger' | 'invalidDate' | 'invalidDateTime' | 'invalidEnum';
4
+ export declare function validateRequestParameter(spec: OpenAPISpec, parameter: OpenApiParameter, value: string): RequestParameterIssue | undefined;
5
+ export declare function validateRequestParameters(spec: OpenAPISpec, parameters: OpenApiParameter[], values: Record<string, string>): Record<string, RequestParameterIssue>;
@@ -0,0 +1,10 @@
1
+ type OpenApiState = {
2
+ credentials: Record<string, Record<string, string>>;
3
+ setCredential: (scope: string, name: string, value: string) => void;
4
+ clearCredential: (scope: string, name: string) => void;
5
+ clearCredentials: (scope: string) => void;
6
+ };
7
+ export declare const emptyOpenApiCredentials: Readonly<Record<string, string>>;
8
+ export declare function getOpenApiCredentialScope(spec: object): string;
9
+ export declare const useOpenApiStore: import('zustand').UseBoundStore<import('zustand').StoreApi<OpenApiState>>;
10
+ export {};
@@ -5,6 +5,9 @@ export type OpenApiParameter = {
5
5
  in?: string;
6
6
  required?: boolean;
7
7
  description?: string;
8
+ style?: string;
9
+ explode?: boolean;
10
+ allowEmptyValue?: boolean;
8
11
  schema?: unknown;
9
12
  };
10
13
  export type OpenApiMediaType = {
@@ -48,6 +51,7 @@ export type RequestAuthInput = {
48
51
  value: string;
49
52
  scheme: OpenApiSecurityScheme;
50
53
  };
54
+ export type RequestAuthInputs = RequestAuthInput[];
51
55
  export type MediaTypeEntry = {
52
56
  mediaType: string;
53
57
  value: OpenApiMediaType;
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
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");
2
+ const require_i18n = require("./i18n-wXINKKV0.cjs");
3
+ const require_PageActions = require("./PageActions-DJRXlGhz.cjs");
4
+ const require_OpenApiOperation = require("./OpenApiOperation-D-5uE5v7.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");
@@ -25,8 +25,8 @@ function usePreviewIdentityState(arg0) {
25
25
  const [serverVariables, setServerVariables] = (0, react.useState)(require_OpenApiOperation.defaultServerVariables(selectedServer));
26
26
  const [serverOpen, setServerOpen] = (0, react.useState)(false);
27
27
  const authOptions = require_OpenApiOperation.getAuthOptions(spec, operation);
28
- const [selectedAuthName, setSelectedAuthName] = (0, react.useState)(authOptions[0]?.name ?? "");
29
- const selectedAuth = authOptions.find((option) => option.name === selectedAuthName);
28
+ const [selectedAuthName, setSelectedAuthName] = (0, react.useState)(authOptions[0]?.key ?? "");
29
+ const selectedAuth = authOptions.find((option) => option.key === selectedAuthName);
30
30
  const [authValues, setAuthValues] = (0, react.useState)({});
31
31
  const [authOpen, setAuthOpen] = (0, react.useState)(false);
32
32
  return {
@@ -40,11 +40,11 @@ function usePreviewIdentityState(arg0) {
40
40
  selectedAuth,
41
41
  authValues,
42
42
  authOpen,
43
- authInput: selectedAuth ? {
44
- name: selectedAuth.name,
45
- scheme: selectedAuth.scheme,
46
- value: authValues[selectedAuth.name] ?? require_OpenApiOperation.authPlaceholder(selectedAuth)
47
- } : void 0,
43
+ authInput: selectedAuth ? selectedAuth.schemes.map((option) => ({
44
+ name: option.name,
45
+ scheme: option.scheme,
46
+ value: authValues[option.name] ?? require_OpenApiOperation.authPlaceholder(option)
47
+ })) : void 0,
48
48
  onSelectServer: (value) => {
49
49
  const nextServer = servers.find((server, index) => require_OpenApiOperation.getServerKey(server, index) === value) ?? servers[0];
50
50
  setSelectedServerKey(value);
@@ -70,7 +70,15 @@ function usePreviewIdentityState(arg0) {
70
70
  ...current,
71
71
  [name]: value
72
72
  }));
73
- }
73
+ },
74
+ onClearAuthValue: (name) => {
75
+ setAuthValues((current) => {
76
+ const values = { ...current };
77
+ delete values[name];
78
+ return values;
79
+ });
80
+ },
81
+ onClearAuthValues: () => setAuthValues({})
74
82
  };
75
83
  }
76
84
  function schemaFromType(type) {
@@ -191,17 +199,9 @@ function OpenApiExamplesPreview(arg0) {
191
199
  selectedServer: identityState.selectedServer,
192
200
  serverVariables: identityState.serverVariables,
193
201
  serverOpen: identityState.serverOpen,
194
- authOptions: identityState.authOptions,
195
- selectedAuthName: identityState.selectedAuthName,
196
- selectedAuth: identityState.selectedAuth,
197
- authValues: identityState.authValues,
198
- authOpen: identityState.authOpen,
199
202
  onSelectServer: identityState.onSelectServer,
200
203
  onChangeServerVariable: identityState.onChangeServerVariable,
201
- onToggleServer: identityState.onToggleServer,
202
- onToggleAuth: identityState.onToggleAuth,
203
- onSelectAuth: identityState.onSelectAuth,
204
- onChangeAuthValue: identityState.onChangeAuthValue
204
+ onToggleServer: identityState.onToggleServer
205
205
  });
206
206
  }
207
207
  function renderExamples() {
@@ -387,10 +387,8 @@ var staticOutputEndpoint = {
387
387
  var previewConfig = {
388
388
  title: "Clarify preview",
389
389
  description: "Renderer preview environment",
390
- rootDirectory: "source",
391
390
  routePrefix: "/",
392
391
  assetPrefix: "/",
393
- outputDirectory: "output",
394
392
  theme: {
395
393
  preset: "default",
396
394
  tokens: {
@@ -411,16 +409,28 @@ var previewConfig = {
411
409
  xl: "1rem"
412
410
  }
413
411
  },
414
- layout: { maxWidth: "88rem" },
415
- editor: false
412
+ layout: { maxWidth: "88rem" }
416
413
  },
417
- i18n: {
418
- defaultLocale: "en",
414
+ locales: {
415
+ default: "en",
419
416
  missing: "fallback",
420
417
  locales: [{
421
418
  code: "en",
422
419
  label: "English"
423
420
  }]
421
+ },
422
+ variables: {},
423
+ features: {
424
+ search: {
425
+ enabled: true,
426
+ provider: "pagefind"
427
+ },
428
+ repository: { enabled: true },
429
+ themeEditor: { enabled: true },
430
+ openapi: {
431
+ enabled: true,
432
+ playground: true
433
+ }
424
434
  }
425
435
  };
426
436
  var methodStyleVars = {
@@ -445,7 +455,7 @@ function PreviewEnvironment(arg0) {
445
455
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_i18n.ConfigContext.Provider, {
446
456
  value: previewConfig,
447
457
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_i18n.LocaleContext.Provider, {
448
- value: previewConfig.i18n.defaultLocale,
458
+ value: previewConfig.locales.default,
449
459
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_i18n.OpenApiSpecsContext.Provider, {
450
460
  value: {},
451
461
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PageActions.SectionProvider, {