@clarify-labs/renderer 0.10.2 → 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 (90) hide show
  1. package/output/{ClarifyShell-C6li72Ce.cjs → ClarifyShell-BAjq876Z.cjs} +113 -90
  2. package/output/ClarifyShell-BAjq876Z.cjs.map +1 -0
  3. package/output/{ClarifyShell-1LuBliwt.js → ClarifyShell-GoSXvgMg.js} +114 -91
  4. package/output/ClarifyShell-GoSXvgMg.js.map +1 -0
  5. package/output/{MermaidViewer-B6-BMCJG.cjs → MermaidViewer-BZ8ghcFP.cjs} +2 -2
  6. package/output/{MermaidViewer-B6-BMCJG.cjs.map → MermaidViewer-BZ8ghcFP.cjs.map} +1 -1
  7. package/output/{MermaidViewer-dXsomvM7.js → MermaidViewer-CkIxyqtf.js} +2 -2
  8. package/output/{MermaidViewer-dXsomvM7.js.map → MermaidViewer-CkIxyqtf.js.map} +1 -1
  9. package/output/{OpenApiOperation-DgrqzeiS.js → OpenApiOperation-C2vJztWZ.js} +1983 -365
  10. package/output/OpenApiOperation-C2vJztWZ.js.map +1 -0
  11. package/output/{OpenApiOperation-B52IWlKb.cjs → OpenApiOperation-D-5uE5v7.cjs} +2009 -361
  12. package/output/OpenApiOperation-D-5uE5v7.cjs.map +1 -0
  13. package/output/{PageActions-BjB6PYmL.cjs → PageActions-DJRXlGhz.cjs} +532 -358
  14. package/output/PageActions-DJRXlGhz.cjs.map +1 -0
  15. package/output/{PageActions-D7K9LDGf.js → PageActions-bugd7GZh.js} +535 -361
  16. package/output/PageActions-bugd7GZh.js.map +1 -0
  17. package/output/{SearchDialog-CIPvXMT3.cjs → SearchDialog-8AdCRp6K.cjs} +3 -3
  18. package/output/{SearchDialog-CIPvXMT3.cjs.map → SearchDialog-8AdCRp6K.cjs.map} +1 -1
  19. package/output/{SearchDialog-CxYLjRi5.js → SearchDialog-CBJjDs_9.js} +3 -3
  20. package/output/{SearchDialog-CxYLjRi5.js.map → SearchDialog-CBJjDs_9.js.map} +1 -1
  21. package/output/app/ContentDiagnostic.d.ts +2 -1
  22. package/output/app/PageFooter.d.ts +1 -1
  23. package/output/client.cjs +3 -3
  24. package/output/client.js +3 -3
  25. package/output/components/AccordionGroup.d.ts +7 -0
  26. package/output/components/Collapse.d.ts +2 -0
  27. package/output/components/FileTree.d.ts +10 -0
  28. package/output/components/Image.d.ts +6 -0
  29. package/output/components/Steps.d.ts +12 -0
  30. package/output/components/Tabs.d.ts +12 -5
  31. package/output/components/Tooltip.d.ts +8 -0
  32. package/output/components/index.d.ts +10 -1
  33. package/output/core/i18n.d.ts +1 -1
  34. package/output/core/types.d.ts +37 -19
  35. package/output/{i18n-DnqZHFT7.js → i18n-BPrC45nD.js} +102 -2
  36. package/output/i18n-BPrC45nD.js.map +1 -0
  37. package/output/{i18n-b4iTLeia.cjs → i18n-wXINKKV0.cjs} +102 -2
  38. package/output/i18n-wXINKKV0.cjs.map +1 -0
  39. package/output/index.cjs +38 -8
  40. package/output/index.cjs.map +1 -1
  41. package/output/index.d.ts +8 -7
  42. package/output/index.js +34 -9
  43. package/output/index.js.map +1 -1
  44. package/output/mdx/components.d.ts +11 -1
  45. package/output/mdx/primitives.d.ts +4 -2
  46. package/output/openapi/components/CodeDisplay.d.ts +1 -0
  47. package/output/openapi/components/EndpointMethodBadge.d.ts +6 -0
  48. package/output/openapi/components/EndpointSections.d.ts +2 -2
  49. package/output/openapi/components/ExamplePanels.d.ts +2 -2
  50. package/output/openapi/components/InlineListbox.d.ts +31 -0
  51. package/output/openapi/components/OpenApiAuthPanel.d.ts +12 -0
  52. package/output/openapi/components/OpenApiOperation.d.ts +1 -9
  53. package/output/openapi/components/OpenApiOperation.state.d.ts +4 -2
  54. package/output/openapi/components/OpenApiRequest.d.ts +18 -0
  55. package/output/openapi/components/OpenApiRequestFields.d.ts +25 -0
  56. package/output/openapi/components/OpenApiResponseViewer.d.ts +8 -0
  57. package/output/openapi/components/SendRequestButton.d.ts +9 -0
  58. package/output/openapi/components/helpers.d.ts +6 -1
  59. package/output/openapi/components/useOpenApiRequestState.d.ts +41 -0
  60. package/output/openapi/entry.d.ts +2 -0
  61. package/output/openapi/index.d.ts +2 -2
  62. package/output/openapi/lib/api-exchange-code.d.ts +8 -0
  63. package/output/openapi/lib/api-exchange.d.ts +30 -0
  64. package/output/openapi/lib/api-request.d.ts +24 -0
  65. package/output/openapi/lib/request-code.d.ts +2 -2
  66. package/output/openapi/lib/request-parameters.d.ts +5 -0
  67. package/output/openapi/store.d.ts +10 -0
  68. package/output/openapi/types.d.ts +4 -0
  69. package/output/preview.cjs +37 -27
  70. package/output/preview.cjs.map +1 -1
  71. package/output/preview.js +37 -27
  72. package/output/preview.js.map +1 -1
  73. package/output/{render-Di5B6Zc0.cjs → render-FICIzeXz.cjs} +2 -2
  74. package/output/{render-Di5B6Zc0.cjs.map → render-FICIzeXz.cjs.map} +1 -1
  75. package/output/{render-DKj24Jqw.js → render-XQiw_48i.js} +2 -2
  76. package/output/{render-DKj24Jqw.js.map → render-XQiw_48i.js.map} +1 -1
  77. package/output/renderer.css +1310 -318
  78. package/output/server.cjs +2 -2
  79. package/output/server.js +2 -2
  80. package/output/theme/ThemeEditor.d.ts +8 -4
  81. package/output/theme/variables.d.ts +8 -4
  82. package/package.json +1 -1
  83. package/output/ClarifyShell-1LuBliwt.js.map +0 -1
  84. package/output/ClarifyShell-C6li72Ce.cjs.map +0 -1
  85. package/output/OpenApiOperation-B52IWlKb.cjs.map +0 -1
  86. package/output/OpenApiOperation-DgrqzeiS.js.map +0 -1
  87. package/output/PageActions-BjB6PYmL.cjs.map +0 -1
  88. package/output/PageActions-D7K9LDGf.js.map +0 -1
  89. package/output/i18n-DnqZHFT7.js.map +0 -1
  90. package/output/i18n-b4iTLeia.cjs.map +0 -1
package/output/index.js CHANGED
@@ -1,17 +1,22 @@
1
- import { A as CardGroup, C as Feedback, D as Pre, E as CodeGroup, M as Button, O as Mermaid, S as Tag, T as Code, _ as Prose, b as Logo, d as listOpenApiOperations, g as WebFrame, h as primitives_exports, j as Callout, k as Card, m as Markdown, n as OpenApiOperation$1, u as getOpenApiOperationEntry, v as GridPattern, w as Collapse, x as Heading, y as HeroPattern } from "./OpenApiOperation-DgrqzeiS.js";
2
- import { a as useConfig, c as useOpenApiSpecs, i as OpenApiSpecsContext, s as useLocale, t as useBuiltInText } from "./i18n-DnqZHFT7.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-1LuBliwt.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-D7K9LDGf.js";
1
+ import { A as Code, C as GridPattern, D as Tag, E as Heading, F as CardGroup, I as Callout, L as Button, M as Pre, N as Mermaid, O as Feedback, P as Card, S as Prose, T as Logo, _ as WebFrame, b as Step, d as getOpenApiOperationEntry, f as listOpenApiOperations, g as primitives_exports, h as Markdown, j as CodeGroup, k as Collapse, n as OpenApiOperation$1, r as OpenApiRequestWorkbench, v as TabItem, w as HeroPattern, x as Steps, y as Tabs } from "./OpenApiOperation-C2vJztWZ.js";
2
+ import { a as useConfig, c as useOpenApiSpecs, i as OpenApiSpecsContext, s as useLocale, t as useBuiltInText } from "./i18n-BPrC45nD.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-GoSXvgMg.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-bugd7GZh.js";
5
5
  import { n as parseCodeMeta, t as markdownRemarkPlugins } from "./remark-C9iRQM0R.js";
6
- import { t as render } from "./render-DKj24Jqw.js";
6
+ import { t as render } from "./render-XQiw_48i.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 = data.kind === "mdx" ? "MDX" : data.kind === "openapi" ? "OpenAPI" : "Route";
14
- const detailsLabel = data.kind === "mdx" ? "Why it happened" : "Details";
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,
@@ -156,7 +161,7 @@ function operationMatchesTags(operationTags, filterTags) {
156
161
  function OpenApiPaths(arg0) {
157
162
  const { spec, tagFilter } = arg0;
158
163
  return /* @__PURE__ */ jsx("div", {
159
- className: "clarify-api-endpoints divide-y divide-zinc-200/70 dark:divide-white/10",
164
+ className: "clarify-openai-endpoints divide-y divide-zinc-200/70 dark:divide-white/10",
160
165
  children: listOpenApiOperations(spec).filter(({ operation }) => operationMatchesTags(operation.tags, tagFilter)).map(({ path, method, operation, source }) => ({
161
166
  path,
162
167
  method: method.toUpperCase(),
@@ -224,6 +229,25 @@ function OpenApiOperation(arg0) {
224
229
  method
225
230
  });
226
231
  }
232
+ function OpenApiRequest(arg0) {
233
+ const { specPath, path, method } = arg0;
234
+ const t = useBuiltInText();
235
+ const { spec, loading } = useOpenApiSpec(void 0, specPath);
236
+ if (loading) return /* @__PURE__ */ jsx(WarningBox, { children: t("openapi.loading") });
237
+ if (!spec) return /* @__PURE__ */ jsx(WarningBox, { children: t("openapi.specNotFound", { specPath }) });
238
+ const entry = getOpenApiOperationEntry(spec, path, method);
239
+ if (!entry) return /* @__PURE__ */ jsx(WarningBox, {
240
+ tone: "red",
241
+ children: t("openapi.endpointNotFound", { endpoint: `${method.toUpperCase()} ${path}` })
242
+ });
243
+ return /* @__PURE__ */ jsx(OpenApiRequestWorkbench, {
244
+ spec,
245
+ path,
246
+ method: entry.method.toUpperCase(),
247
+ operation: entry.operation,
248
+ operationSource: entry.source
249
+ });
250
+ }
227
251
  function createOpenApiRouteComponent(data) {
228
252
  return function OpenApiRoutePage() {
229
253
  return /* @__PURE__ */ jsx(OpenApiDocument, { spec: data.spec });
@@ -238,6 +262,7 @@ var builtInMDXComponents = {
238
262
  Mermaid
239
263
  };
240
264
  var builtInOpenAPIComponents = {
265
+ OpenApiRequest,
241
266
  OpenApiDocument,
242
267
  OpenApiOperation
243
268
  };
@@ -270,6 +295,6 @@ function DocShell(arg0) {
270
295
  });
271
296
  }
272
297
  //#endregion
273
- 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, parseCodeMeta, remToPx, render, themeBootstrapScript, themeEditorPresets, themePresets, useMDXComponents, useOpenApiSpecs, useSectionStore, useSlot, useTheme };
298
+ export { AppShell, BuiltWithClarify, Button, Callout, Card, CardGroup, Code, CodeGroup, Collapse, DocShell, Feedback, GridPattern, Heading, HeroPattern, Logo, Markdown, Mermaid, OpenApiDocument, OpenApiOperation, OpenApiRequest, OpenApiSpecsContext, PageBanner, PageFooter, Pre, Prose, RuntimeSlot, RuntimeSlotsProvider, SectionProvider, SlotProvider, Step, Steps, TabItem as Tab, Tabs, Tag, ThemeEditor, ThemeProvider, ThemeToggle, WebFrame, applyThemeVariables, createContentDiagnosticComponent, createOpenApiRouteComponent, markdownRemarkPlugins, parseCodeMeta, remToPx, render, themeBootstrapScript, themeEditorPresets, themePresets, useMDXComponents, useOpenApiSpecs, useSectionStore, useSlot, useTheme };
274
299
 
275
300
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../source/app/ContentDiagnostic.tsx","../source/openapi/lib/spec-path.ts","../source/openapi/entry.tsx","../source/mdx/components.ts","../source/mdx/DocShell.tsx"],"sourcesContent":["import type { ComponentType } from 'react'\n\nimport { RenderErrorPanel } from './RenderErrorPanel'\n\nexport type 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 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-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,M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AAK,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>{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,cAA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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;
@@ -50,10 +51,19 @@ export declare function useMDXComponents(components?: Record<string, unknown>):
50
51
  }): import("react").JSX.Element;
51
52
  code: typeof import('..').Code;
52
53
  pre: typeof import('..').Pre;
54
+ img: typeof import('../components/Image').Image;
55
+ AccordionGroup: typeof mdxPrimitives.AccordionGroup;
53
56
  Button: typeof mdxPrimitives.Button;
54
57
  Callout: typeof mdxPrimitives.Callout;
55
58
  Card: typeof mdxPrimitives.Card;
56
59
  CardGroup: typeof mdxPrimitives.CardGroup;
57
60
  CodeGroup: typeof mdxPrimitives.CodeGroup;
61
+ FileTree: typeof mdxPrimitives.FileTree;
62
+ FileTreeItem: typeof mdxPrimitives.FileTreeItem;
63
+ Step: typeof mdxPrimitives.Step;
64
+ Steps: typeof mdxPrimitives.Steps;
65
+ Tab: typeof mdxPrimitives.Tab;
66
+ Tabs: typeof mdxPrimitives.Tabs;
67
+ Tooltip: typeof mdxPrimitives.Tooltip;
58
68
  WebFrame: typeof mdxPrimitives.WebFrame;
59
69
  };
@@ -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 { Button, Callout, Card, CardGroup, CodeGroup, WebFrame };
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;
@@ -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;
@@ -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;
@@ -0,0 +1,31 @@
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
+ 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;
28
+ };
29
+ export declare function InlineListbox(arg0: InlineListboxProps): ReactNode;
30
+ export declare function MultiInlineListbox(arg0: MultiInlineListboxProps): ReactNode;
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 {};