@clarify-labs/renderer 0.11.5 → 0.11.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/output/{ClarifyShell-BwqLbTI-.js → ClarifyShell-CKvXZj0f.js} +71 -20
- package/output/ClarifyShell-CKvXZj0f.js.map +1 -0
- package/output/{ClarifyShell-BbD82nrc.cjs → ClarifyShell-CukbPOAd.cjs} +71 -20
- package/output/ClarifyShell-CukbPOAd.cjs.map +1 -0
- package/output/{MermaidViewer-CO1rhB6A.cjs → MermaidViewer-FOg263MO.cjs} +5 -6
- package/output/MermaidViewer-FOg263MO.cjs.map +1 -0
- package/output/{MermaidViewer-D1wiX_T9.js → MermaidViewer-_tpH0JNn.js} +5 -6
- package/output/MermaidViewer-_tpH0JNn.js.map +1 -0
- package/output/{OpenApiOperation-CbdKZMO1.js → OpenApiOperation-Dv9u2GEJ.js} +5 -5
- package/output/OpenApiOperation-Dv9u2GEJ.js.map +1 -0
- package/output/{OpenApiOperation-C77uiDjW.cjs → OpenApiOperation-c-I6Nw9j.cjs} +22 -4
- package/output/OpenApiOperation-c-I6Nw9j.cjs.map +1 -0
- package/output/app/BuiltWithClarify.d.ts +5 -1
- package/output/client.cjs +2 -2
- package/output/client.js +2 -2
- package/output/index.cjs +87 -3
- package/output/index.cjs.map +1 -1
- package/output/index.d.ts +3 -3
- package/output/index.js +86 -5
- package/output/index.js.map +1 -1
- package/output/mdx/components.d.ts +2 -1
- package/output/openapi/components/EndpointMethodBadge.d.ts +1 -0
- package/output/openapi/components/OpenApiLink.d.ts +9 -0
- package/output/openapi/index.d.ts +1 -0
- package/output/preview.cjs +1 -1
- package/output/preview.js +1 -1
- package/output/{render-PDmRKKJm.js → render-B41PHjt8.js} +2 -2
- package/output/{render-PDmRKKJm.js.map → render-B41PHjt8.js.map} +1 -1
- package/output/{render-BhVJVa1q.cjs → render-BxiVlY6q.cjs} +2 -2
- package/output/{render-BhVJVa1q.cjs.map → render-BxiVlY6q.cjs.map} +1 -1
- package/output/renderer.css +34 -0
- package/output/server.cjs +1 -1
- package/output/server.js +1 -1
- package/package.json +1 -1
- package/output/ClarifyShell-BbD82nrc.cjs.map +0 -1
- package/output/ClarifyShell-BwqLbTI-.js.map +0 -1
- package/output/MermaidViewer-CO1rhB6A.cjs.map +0 -1
- package/output/MermaidViewer-D1wiX_T9.js.map +0 -1
- package/output/OpenApiOperation-C77uiDjW.cjs.map +0 -1
- package/output/OpenApiOperation-CbdKZMO1.js.map +0 -1
package/output/client.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_ClarifyShell = require("./ClarifyShell-
|
|
2
|
+
const require_ClarifyShell = require("./ClarifyShell-CukbPOAd.cjs");
|
|
3
3
|
const require_PageActions = require("./PageActions-ob2OJusG.cjs");
|
|
4
|
-
const require_render = require("./render-
|
|
4
|
+
const require_render = require("./render-BxiVlY6q.cjs");
|
|
5
5
|
exports.ThemeEditor = require_ClarifyShell.ThemeEditor;
|
|
6
6
|
exports.applyThemeVariables = require_ClarifyShell.applyThemeVariables;
|
|
7
7
|
exports.getStoredLocalePreference = require_PageActions.getStoredLocalePreference;
|
package/output/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as themeBootstrapScript, i as themeEditorPresets, n as ThemeEditor, r as applyThemeVariables, s as themeStorageKey } from "./ClarifyShell-
|
|
1
|
+
import { a as themeBootstrapScript, i as themeEditorPresets, n as ThemeEditor, r as applyThemeVariables, s as themeStorageKey } from "./ClarifyShell-CKvXZj0f.js";
|
|
2
2
|
import { S as themeCookieName, _ as getStoredThemePreference, b as storeLocalePreference, g as getStoredLocalePreference, v as localeCookieName, x as storeThemePreference, y as readLocaleCookie } from "./PageActions-DviEypf6.js";
|
|
3
|
-
import { t as render } from "./render-
|
|
3
|
+
import { t as render } from "./render-B41PHjt8.js";
|
|
4
4
|
export { ThemeEditor, applyThemeVariables, getStoredLocalePreference, getStoredThemePreference, localeCookieName, readLocaleCookie, render, storeLocalePreference, storeThemePreference, themeBootstrapScript, themeCookieName, themeEditorPresets, themeStorageKey };
|
package/output/index.cjs
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_rolldown_runtime = require("./rolldown-runtime-DakpK96I.cjs");
|
|
2
3
|
const require_i18n = require("./i18n-Cjfk1N7i.cjs");
|
|
3
|
-
const require_ClarifyShell = require("./ClarifyShell-
|
|
4
|
+
const require_ClarifyShell = require("./ClarifyShell-CukbPOAd.cjs");
|
|
4
5
|
const require_PageActions = require("./PageActions-ob2OJusG.cjs");
|
|
5
|
-
const require_OpenApiOperation = require("./OpenApiOperation-
|
|
6
|
+
const require_OpenApiOperation = require("./OpenApiOperation-c-I6Nw9j.cjs");
|
|
6
7
|
const require_remark = require("./remark-DTLbG8PK.cjs");
|
|
7
|
-
const require_render = require("./render-
|
|
8
|
+
const require_render = require("./render-BxiVlY6q.cjs");
|
|
9
|
+
let clsx = require("clsx");
|
|
10
|
+
clsx = require_rolldown_runtime.__toESM(clsx, 1);
|
|
8
11
|
let react = require("react");
|
|
9
12
|
let react_router_dom = require("react-router-dom");
|
|
13
|
+
let lucide_react = require("lucide-react");
|
|
10
14
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
15
|
//#region source/app/ContentDiagnostic.tsx
|
|
12
16
|
function ContentDiagnosticPanel(params) {
|
|
@@ -255,6 +259,84 @@ function createOpenApiRouteComponent(data) {
|
|
|
255
259
|
};
|
|
256
260
|
}
|
|
257
261
|
//#endregion
|
|
262
|
+
//#region source/openapi/components/OpenApiLink.tsx
|
|
263
|
+
function OpenApiLink(arg0) {
|
|
264
|
+
const { specPath, operationId, href: hrefOverride, inline = false, className } = arg0;
|
|
265
|
+
const config = require_i18n.useConfig();
|
|
266
|
+
const locale = require_i18n.useLocale();
|
|
267
|
+
const t = require_i18n.useBuiltInText();
|
|
268
|
+
const { spec, loading } = useOpenApiSpec(void 0, specPath);
|
|
269
|
+
if (loading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
270
|
+
className,
|
|
271
|
+
children: t("openapi.loading")
|
|
272
|
+
});
|
|
273
|
+
const entry = spec ? require_OpenApiOperation.getOpenApiOperationEntryById(spec, operationId) : void 0;
|
|
274
|
+
if (!entry) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
275
|
+
className,
|
|
276
|
+
children: t("openapi.endpointNotFound", { endpoint: operationId })
|
|
277
|
+
});
|
|
278
|
+
const sectionId = require_OpenApiOperation.getOpenApiOperationSectionId(entry.operation) || operationId;
|
|
279
|
+
const href = `${require_PageActions.prefixHref(require_PageActions.localizeHref(hrefOverride ?? specPath, config, locale), config.routePrefix)}#${sectionId}`;
|
|
280
|
+
const method = entry.method.toUpperCase();
|
|
281
|
+
const title = entry.operation.summary?.trim() || "";
|
|
282
|
+
if (inline) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OpenApiLinkInline, {
|
|
283
|
+
href,
|
|
284
|
+
method,
|
|
285
|
+
path: entry.path,
|
|
286
|
+
label: title || entry.path,
|
|
287
|
+
className
|
|
288
|
+
});
|
|
289
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OpenApiLinkBlock, {
|
|
290
|
+
href,
|
|
291
|
+
method,
|
|
292
|
+
path: entry.path,
|
|
293
|
+
label: title,
|
|
294
|
+
className
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
function OpenApiLinkInline(arg0) {
|
|
298
|
+
const { href, method, label, className } = arg0;
|
|
299
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_OpenApiOperation.LocalizedLink, {
|
|
300
|
+
href,
|
|
301
|
+
className: (0, clsx.default)("clarify-openapi-link clarify-openapi-link-inline not-prose inline-flex max-w-full items-center gap-1.5 rounded-md bg-(--clarify-ui-active-background) py-px pr-1.5 pl-px align-[0.125em] text-(--clarify-theme-tokens-colors-foreground) no-underline transition-colors hover:bg-(--clarify-ui-accent-background) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary) focus-visible:ring-offset-2", className),
|
|
302
|
+
"aria-label": `${method}: ${label}`,
|
|
303
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_OpenApiOperation.EndpointMethodBadge, {
|
|
304
|
+
method,
|
|
305
|
+
compact: true
|
|
306
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
307
|
+
className: "truncate text-[0.8125rem]/5 font-medium",
|
|
308
|
+
children: label
|
|
309
|
+
})]
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
function OpenApiLinkBlock(arg0) {
|
|
313
|
+
const { href, method, path, label, className } = arg0;
|
|
314
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_OpenApiOperation.LocalizedLink, {
|
|
315
|
+
href,
|
|
316
|
+
className: (0, clsx.default)("clarify-openapi-link not-prose group flex w-full items-center gap-3 rounded-lg border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) px-3 py-3 no-underline transition-colors hover:border-(--clarify-ui-accent-border) hover:bg-(--clarify-ui-hover-background) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary) focus-visible:ring-offset-2", className),
|
|
317
|
+
children: [
|
|
318
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_OpenApiOperation.EndpointMethodBadge, { method }),
|
|
319
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
320
|
+
className: "min-w-0 flex-1",
|
|
321
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
|
|
322
|
+
className: "block truncate bg-transparent p-0 font-mono text-sm/6 font-semibold text-(--clarify-theme-tokens-colors-foreground)",
|
|
323
|
+
children: path
|
|
324
|
+
}), label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
325
|
+
className: "mt-0.5 block truncate text-xs/5 text-(--clarify-ui-text-faint)",
|
|
326
|
+
children: label
|
|
327
|
+
}) : null]
|
|
328
|
+
}),
|
|
329
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
330
|
+
className: "flex size-8 shrink-0 items-center justify-center rounded-md text-(--clarify-ui-text-faint) transition-colors group-hover:bg-(--clarify-theme-tokens-colors-surface) group-hover:text-(--clarify-ui-accent-text)",
|
|
331
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ArrowRight, {
|
|
332
|
+
"aria-hidden": "true",
|
|
333
|
+
className: "size-4"
|
|
334
|
+
})
|
|
335
|
+
})
|
|
336
|
+
]
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
//#endregion
|
|
258
340
|
//#region source/mdx/components.ts
|
|
259
341
|
var builtInMDXComponents = {
|
|
260
342
|
...require_OpenApiOperation.primitives_exports,
|
|
@@ -262,6 +344,7 @@ var builtInMDXComponents = {
|
|
|
262
344
|
Mermaid: require_OpenApiOperation.Mermaid
|
|
263
345
|
};
|
|
264
346
|
var builtInOpenAPIComponents = {
|
|
347
|
+
OpenApiLink,
|
|
265
348
|
OpenApiRequest,
|
|
266
349
|
OpenApiDocument,
|
|
267
350
|
OpenApiOperation
|
|
@@ -312,6 +395,7 @@ exports.HeroPattern = require_OpenApiOperation.HeroPattern;
|
|
|
312
395
|
exports.Logo = require_OpenApiOperation.Logo;
|
|
313
396
|
exports.Mermaid = require_OpenApiOperation.Mermaid;
|
|
314
397
|
exports.OpenApiDocument = OpenApiDocument;
|
|
398
|
+
exports.OpenApiLink = OpenApiLink;
|
|
315
399
|
exports.OpenApiOperation = OpenApiOperation;
|
|
316
400
|
exports.OpenApiRequest = OpenApiRequest;
|
|
317
401
|
exports.OpenApiSpecsContext = require_i18n.OpenApiSpecsContext;
|
package/output/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../source/app/ContentDiagnostic.tsx","../source/openapi/lib/spec-path.ts","../source/openapi/entry.tsx","../source/mdx/components.ts","../source/mdx/DocShell.tsx"],"sourcesContent":["import type { ComponentType } from 'react'\n\nimport { RenderErrorPanel } from './RenderErrorPanel'\n\nexport type ContentDiagnosticKind = 'markdown' | 'markdown+jsx' | 'openapi' | 'route-load'\n\nexport type ContentDiagnostic = {\n kind: ContentDiagnosticKind\n title: string\n message: string\n details?: string\n filePath?: string\n}\n\ntype ContentDiagnosticPanelProps = {\n data: ContentDiagnostic\n}\n\nfunction ContentDiagnosticPanel(params: ContentDiagnosticPanelProps) {\n const { data } = params\n const typeLabels: Record<ContentDiagnosticKind, string> = {\n markdown: 'Markdown',\n 'markdown+jsx': 'MDX',\n openapi: 'OpenAPI',\n 'route-load': 'Route',\n }\n const typeLabel = typeLabels[data.kind]\n const detailsLabel = data.kind === 'markdown+jsx' || data.kind === 'markdown' ? 'Why it happened' : 'Details'\n const pathLabel = 'File'\n\n return (\n <RenderErrorPanel\n title={data.title}\n description={data.message}\n titleId=\"clarify-content-diagnostic-title\"\n metadata={[\n { label: pathLabel, value: data.filePath ?? 'Unknown' },\n { label: 'Type', value: typeLabel },\n ]}\n detailsLabel={detailsLabel}\n detailsContent={data.details ? (\n <pre className=\"max-h-(--clarify-error-details-max-height) overflow-auto whitespace-pre-wrap wrap-break-word font-mono\">\n {data.details}\n </pre>\n ) : null}\n />\n )\n}\n\nexport function createContentDiagnosticComponent(data: ContentDiagnostic): ComponentType {\n return function ContentDiagnosticComponent() {\n return <ContentDiagnosticPanel data={data} />\n }\n}\n","import { useEffect, useState } from 'react'\nimport { useLocation } from 'react-router-dom'\n\nimport { useConfig, useLocale, useOpenApiSpecs } from '../../core/context'\n\nimport type { OpenAPISpec } from './utils'\n\ntype OpenApiSpecResult = {\n spec: OpenAPISpec | null\n loading: boolean\n}\n\ntype OpenApiSpecModule = { default: OpenAPISpec } | OpenAPISpec\n\ntype LoadedSpecState = {\n loader?: () => Promise<OpenApiSpecModule>\n spec: OpenAPISpec | null\n}\n\nfunction isOpenApiSpecLoader(value: unknown): value is () => Promise<OpenApiSpecModule> {\n return typeof value === 'function'\n}\n\nfunction getLoadedSpec(value: OpenApiSpecModule): OpenAPISpec {\n return value && typeof value === 'object' && 'default' in value\n ? value.default\n : value\n}\n\nconst VIRTUAL_PREFIX = 'virtual:clarify-page/'\n\nfunction resolveRelativePath(fromDir: string, to: string): string {\n const parts = (fromDir + '/' + to).split('/').filter(Boolean)\n const stack: string[] = []\n for (const part of parts) {\n if (part === '..') {\n stack.pop()\n } else if (part !== '.') {\n stack.push(part)\n }\n }\n return stack.join('/')\n}\n\nfunction normalizeSpecPath(specPath: string, currentRoutePath?: string, routePrefix = ''): string {\n if (specPath.startsWith(VIRTUAL_PREFIX)) return specPath\n\n const normalizedRoutePrefix = routePrefix.replace(/^\\/+|\\/+$/g, '')\n const normalizedSpecPath = specPath.startsWith('/') && normalizedRoutePrefix && specPath.slice(1).startsWith(`${normalizedRoutePrefix}/`)\n ? '/' + specPath.slice(normalizedRoutePrefix.length + 2)\n : specPath\n\n if (normalizedSpecPath.startsWith('/')) {\n return VIRTUAL_PREFIX + normalizedSpecPath.replace(/^\\//, '')\n }\n const fromDir = currentRoutePath === '/' ? '' : currentRoutePath?.replace(/^\\//, '').replace(/\\/[^/]*$/, '') ?? ''\n const normalizedFromDir = normalizedRoutePrefix && fromDir.startsWith(`${normalizedRoutePrefix}/`)\n ? fromDir.slice(normalizedRoutePrefix.length + 1)\n : fromDir\n return VIRTUAL_PREFIX + resolveRelativePath(normalizedFromDir, normalizedSpecPath)\n}\n\n/**\n * Prefer a locale-qualified registry key for absolute specPath values, then\n * fall back to the normalized key. The CLI registers visible route aliases,\n * while relative paths already resolve through the current localized route.\n */\nfunction specModuleCandidates(moduleId: string, specPath: string, locale: string | undefined): string[] {\n const candidates: string[] = []\n if (locale && specPath.startsWith('/') && !specPath.startsWith(VIRTUAL_PREFIX)) {\n const rest = moduleId.slice(VIRTUAL_PREFIX.length)\n if (!rest.startsWith(`${locale}/`) && rest !== locale) candidates.push(`${VIRTUAL_PREFIX}${locale}/${rest}`)\n }\n candidates.push(moduleId)\n return candidates\n}\n\nexport function useOpenApiSpec(spec?: OpenAPISpec, specPath?: string): OpenApiSpecResult {\n const config = useConfig()\n const locale = useLocale()\n const specs = useOpenApiSpecs()\n const location = useLocation()\n const [loadedSpec, setLoadedSpec] = useState<LoadedSpecState>({ spec: null })\n const normalized = specPath ? normalizeSpecPath(specPath, location.pathname, config.routePrefix) : undefined\n const candidates = specPath && normalized ? specModuleCandidates(normalized, specPath, locale) : []\n const registryValue = candidates.map(candidate => specs[candidate]).find(Boolean)\n\n useEffect(() => {\n let cancelled = false\n\n if (!isOpenApiSpecLoader(registryValue)) return\n\n registryValue().then(module => {\n if (!cancelled) setLoadedSpec({ loader: registryValue, spec: getLoadedSpec(module) })\n }).catch(() => {\n if (!cancelled) setLoadedSpec({ loader: registryValue, spec: null })\n })\n\n return () => {\n cancelled = true\n }\n }, [registryValue])\n\n if (spec) return { spec, loading: false }\n if (!specPath) return { spec: null, loading: false }\n if (isOpenApiSpecLoader(registryValue)) {\n return loadedSpec.loader === registryValue\n ? { spec: loadedSpec.spec, loading: false }\n : { spec: null, loading: true }\n }\n return { spec: registryValue ?? null, loading: false }\n}\n","import type { ReactNode } from 'react'\n\nimport { PageActions } from '../app/PageActions'\nimport { Prose } from '../components/Prose'\nimport { useBuiltInText } from '../core/i18n'\nimport { Markdown } from '../mdx/Markdown'\n\nimport { OpenApiOperation as OpenApiOperationComponent } from './components/OpenApiOperation'\nimport { OpenApiRequestWorkbench } from './components/OpenApiRequest'\nimport { useOpenApiSpec } from './lib/spec-path'\nimport { getOpenApiOperationEntryById, listOpenApiOperations } from './lib/utils'\nimport type { OpenAPISpec } from './lib/utils'\n\ntype OpenApiPathsProps = { spec: OpenAPISpec; tagFilter?: string[] }\n\ntype OpenApiHeaderProps = { spec: OpenAPISpec }\n\ntype WarningBoxProps = {\n children: ReactNode\n tone?: 'amber' | 'red'\n}\n\nexport type OpenApiDocumentProps = {\n spec?: OpenAPISpec\n specPath?: string\n tagFilter?: string[]\n}\n\nexport type OpenApiRouteData = {\n spec: OpenAPISpec\n}\n\ntype OpenApiOperationWithSpecProps = {\n spec: OpenAPISpec\n operationId: string\n}\n\nexport type OpenApiOperationProps = {\n specPath: string\n operationId: string\n}\n\nexport type OpenApiRequestProps = OpenApiOperationProps & {\n requestExample?: string\n}\n\nfunction OpenApiHeader(arg0: OpenApiHeaderProps): ReactNode {\n const { spec } = arg0\n\n const t = useBuiltInText()\n return (\n <header className=\"clarify-openapi-header mb-16 border-b border-(--clarify-theme-tokens-colors-border) pb-8\">\n <p className=\"mb-3 text-xs/6 font-medium tracking-widest text-(--clarify-ui-accent-text) uppercase\">\n {t('openapi.openApiReference')}\n </p>\n <h1 className=\"clarify-page-title\">{spec.info?.title ?? t('openapi.apiDocumentation')}</h1>\n {spec.info?.description ? <Markdown className=\"lead mt-4 *:first:mt-0 *:last:mb-0\">{spec.info.description}</Markdown> : null}\n {spec.info?.version ? <p className=\"mt-4 text-sm text-(--clarify-ui-text-faint)\">{t('openapi.version', { version: spec.info.version })}</p> : null}\n </header>\n )\n}\n\nfunction operationMatchesTags(operationTags: string[] | undefined, filterTags: string[] | undefined): boolean {\n if (!filterTags?.length) return true\n return operationTags?.some(tag => filterTags.includes(tag)) ?? false\n}\n\nfunction OpenApiPaths(arg0: OpenApiPathsProps): ReactNode {\n const { spec, tagFilter } = arg0\n\n const entries = listOpenApiOperations(spec)\n .filter(({ operation }) => operationMatchesTags(operation.tags, tagFilter))\n .map(({ path, method, operation, source }) => ({\n path,\n method: method.toUpperCase(),\n operation,\n source,\n }))\n\n return (\n <div className=\"clarify-openai-endpoints divide-y divide-zinc-200/70 dark:divide-white/10\">\n {entries.map(({ path, method, operation, source }) => (\n <OpenApiOperationComponent key={`${source}-${method}-${path}`} spec={spec} path={path} method={method} operation={operation} operationSource={source} />\n ))}\n </div>\n )\n}\n\nfunction WarningBox(arg0: WarningBoxProps): ReactNode {\n const { children, tone = 'amber' } = arg0\n\n const classes = tone === 'red'\n ? 'rounded-lg border border-red-200 bg-red-50 p-4 text-sm text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-200'\n : 'rounded-lg border border-amber-200 bg-amber-50 p-4 text-sm text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200'\n\n return <div className={`clarify-warning ${classes}`}>{children}</div>\n}\n\nexport function OpenApiDocument(arg0: OpenApiDocumentProps): ReactNode {\n const { spec, specPath, tagFilter } = arg0\n const t = useBuiltInText()\n const { spec: resolved, loading } = useOpenApiSpec(spec, specPath)\n\n if (loading) {\n return <WarningBox>{t('openapi.loading')}</WarningBox>\n }\n if (!resolved) {\n return <WarningBox>{t('openapi.specNotFound', { specPath: specPath ?? t('openapi.specPathMissing') })}</WarningBox>\n }\n\n return (\n <article className=\"clarify-openapi-page relative flex h-full flex-col pt-16 pb-10\">\n <div className=\"clarify-page-actions mb-4 flex justify-end sm:absolute sm:top-16 sm:right-0 sm:mb-0\">\n <PageActions />\n </div>\n <Prose className=\"flex-auto\">\n <OpenApiHeader spec={resolved} />\n <OpenApiPaths spec={resolved} tagFilter={tagFilter} />\n </Prose>\n </article>\n )\n}\n\nfunction OpenApiOperationWithSpec(arg0: OpenApiOperationWithSpecProps): ReactNode {\n const { spec, operationId } = arg0\n const t = useBuiltInText()\n const entry = getOpenApiOperationEntryById(spec, operationId)\n\n if (!entry) {\n return <WarningBox tone=\"red\">{t('openapi.endpointNotFound', { endpoint: operationId })}</WarningBox>\n }\n\n const normalizedMethod = entry.method.toUpperCase()\n return <OpenApiOperationComponent key={`${entry.source}-${normalizedMethod}-${entry.path}`} spec={spec} path={entry.path} method={normalizedMethod} operation={entry.operation} operationSource={entry.source} />\n}\n\nexport function OpenApiOperation(arg0: OpenApiOperationProps): ReactNode {\n const { specPath, operationId } = arg0\n const t = useBuiltInText()\n const { spec, loading } = useOpenApiSpec(undefined, specPath)\n\n if (loading) {\n return <WarningBox>{t('openapi.loading')}</WarningBox>\n }\n if (!spec) {\n return <WarningBox>{t('openapi.specNotFound', { specPath })}</WarningBox>\n }\n\n return <OpenApiOperationWithSpec spec={spec} operationId={operationId} />\n}\n\nexport function OpenApiRequest(arg0: OpenApiRequestProps): ReactNode {\n const { specPath, operationId, requestExample } = arg0\n const t = useBuiltInText()\n const { spec, loading } = useOpenApiSpec(undefined, specPath)\n\n if (loading) return <WarningBox>{t('openapi.loading')}</WarningBox>\n if (!spec) return <WarningBox>{t('openapi.specNotFound', { specPath })}</WarningBox>\n\n const entry = getOpenApiOperationEntryById(spec, operationId)\n if (!entry) return <WarningBox tone=\"red\">{t('openapi.endpointNotFound', { endpoint: operationId })}</WarningBox>\n\n return (\n <OpenApiRequestWorkbench\n spec={spec}\n path={entry.path}\n method={entry.method.toUpperCase()}\n operation={entry.operation}\n operationSource={entry.source}\n requestExample={requestExample}\n />\n )\n}\n\nexport function createOpenApiRouteComponent(data: OpenApiRouteData) {\n return function OpenApiRoutePage() {\n return <OpenApiDocument spec={data.spec} />\n }\n}\n","import { Collapse } from '../components/Collapse'\nimport { Mermaid } from '../components/Mermaid'\nimport { OpenApiRequest, OpenApiDocument, OpenApiOperation } from '../openapi'\n\nimport * as mdxPrimitives from './primitives'\n\nconst builtInMDXComponents = {\n ...mdxPrimitives,\n Collapse,\n Mermaid,\n}\n\nconst builtInOpenAPIComponents = {\n OpenApiRequest,\n OpenApiDocument,\n OpenApiOperation,\n}\n\nexport function useMDXComponents(components: Record<string, unknown> = {}) {\n return {\n ...components,\n ...builtInMDXComponents,\n ...builtInOpenAPIComponents,\n }\n}\n","import type { ReactNode } from 'react'\n\nimport { Prose } from '../components/Prose'\n\nexport type DocShellProps = {\n title: string\n subtitle?: string\n children: ReactNode\n}\n\nexport function DocShell(arg0: DocShellProps) {\n const { title, subtitle, children } = arg0\n\n return (\n <main className=\"clarify-doc-shell min-h-screen bg-(--clarify-theme-tokens-colors-background) px-6 py-10 text-(--clarify-theme-tokens-colors-foreground) md:px-10\">\n <div className=\"mx-auto max-w-6xl\">\n <header className=\"mb-10\">\n <h1 className=\"text-3xl font-bold tracking-tight md:text-5xl\">{title}</h1>\n {subtitle ? <p className=\"mt-3 max-w-2xl text-(--clarify-ui-text-soft)\">{subtitle}</p> : null}\n </header>\n <Prose>{children}</Prose>\n </div>\n </main>\n )\n}\n"],"mappings":";;;;;;;;;;;AAkBA,SAAS,uBAAuB,QAAqC;CACnE,MAAM,EAAE,SAAS;CAOjB,MAAM,YAAY;EALhB,UAAU;EACV,gBAAgB;EAChB,SAAS;EACT,cAAc;CAEE,EAAW,KAAK;CAClC,MAAM,eAAe,KAAK,SAAS,kBAAkB,KAAK,SAAS,aAAa,oBAAoB;CAGpG,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,qBAAA,kBAAD;EACE,OAAO,KAAK;EACZ,aAAa,KAAK;EAClB,SAAQ;EACR,UAAU,CACR;GAAE,OAAO;GAAW,OAAO,KAAK,YAAY;EAAU,GACtD;GAAE,OAAO;GAAQ,OAAO;EAAU,CACpC;EACc;EACd,gBAAgB,KAAK,UACnB,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;GAAK,WAAU;aACZ,KAAK;EACH,CAAA,IACH;CACL,CAAA;AAEL;AAEA,SAAgB,iCAAiC,MAAwC;CACvF,OAAO,SAAS,6BAA6B;EAC3C,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,wBAAD,EAA8B,KAAO,CAAA;CAC9C;AACF;;;AClCA,SAAS,oBAAoB,OAA2D;CACtF,OAAO,OAAO,UAAU;AAC1B;AAEA,SAAS,cAAc,OAAuC;CAC5D,OAAO,SAAS,OAAO,UAAU,YAAY,aAAa,QACtD,MAAM,UACN;AACN;AAEA,IAAM,iBAAiB;AAEvB,SAAS,oBAAoB,SAAiB,IA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AAE,4BAA4B,EAAE,UAAU,YAAY,CAAC;CAAc,CAAA;CAEhH,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,yBAAA,yBAAD;EACQ;EACN,MAAM,MAAM;EACZ,QAAQ,MAAM,OAAO,YAAY;EACjC,WAAW,MAAM;EACjB,iBAAiB,MAAM;EACP;CACjB,CAAA;AAEL;AAEA,SAAgB,4BAA4B,MAAwB;CAClE,OAAO,SAAS,mBAAmB;EACjC,OAAO,iBAAA,GAAA,kBAAA,IAAA,CAAC,iBAAD,EAAiB,MAAM,KAAK,KAAO,CAAA;CAC5C;AACF;;;AC5KA,IAAM,uBAAuB;CAC3B,GAAG,yBAAA;CACH,UAAA,yBAAA;CACA,SAAA,yBAAA;AACF;AAEA,IAAM,2BAA2B;CAC/B;CACA;CACA;AACF;AAEA,SAAgB,iBAAiB,aAAsC,CAAC,GAAG;CACzE,OAAO;EACL,GAAG;EACH,GAAG;EACH,GAAG;CACL;AACF;;;ACdA,SAAgB,SAAS,MAAqB;CAC5C,MAAM,EAAE,OAAO,UAAU,aAAa;CAEtC,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;EAAM,WAAU;YACd,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;GAAK,WAAU;aAAf,CACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,UAAD;IAAQ,WAAU;cAAlB,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD;KAAI,WAAU;eAAiD;IAAU,CAAA,GACxE,WAAW,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;KAAG,WAAU;eAAgD;IAAY,CAAA,IAAI,IACnF;OACR,iBAAA,GAAA,kBAAA,IAAA,CAAC,yBAAA,OAAD,EAAQ,SAAgB,CAAA,CACrB;;CACD,CAAA;AAEV"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../source/app/ContentDiagnostic.tsx","../source/openapi/lib/spec-path.ts","../source/openapi/entry.tsx","../source/openapi/components/OpenApiLink.tsx","../source/mdx/components.ts","../source/mdx/DocShell.tsx"],"sourcesContent":["import type { ComponentType } from 'react'\n\nimport { RenderErrorPanel } from './RenderErrorPanel'\n\nexport type ContentDiagnosticKind = 'markdown' | 'markdown+jsx' | 'openapi' | 'route-load'\n\nexport type ContentDiagnostic = {\n kind: ContentDiagnosticKind\n title: string\n message: string\n details?: string\n filePath?: string\n}\n\ntype ContentDiagnosticPanelProps = {\n data: ContentDiagnostic\n}\n\nfunction ContentDiagnosticPanel(params: ContentDiagnosticPanelProps) {\n const { data } = params\n const typeLabels: Record<ContentDiagnosticKind, string> = {\n markdown: 'Markdown',\n 'markdown+jsx': 'MDX',\n openapi: 'OpenAPI',\n 'route-load': 'Route',\n }\n const typeLabel = typeLabels[data.kind]\n const detailsLabel = data.kind === 'markdown+jsx' || data.kind === 'markdown' ? 'Why it happened' : 'Details'\n const pathLabel = 'File'\n\n return (\n <RenderErrorPanel\n title={data.title}\n description={data.message}\n titleId=\"clarify-content-diagnostic-title\"\n metadata={[\n { label: pathLabel, value: data.filePath ?? 'Unknown' },\n { label: 'Type', value: typeLabel },\n ]}\n detailsLabel={detailsLabel}\n detailsContent={data.details ? (\n <pre className=\"max-h-(--clarify-error-details-max-height) overflow-auto whitespace-pre-wrap wrap-break-word font-mono\">\n {data.details}\n </pre>\n ) : null}\n />\n )\n}\n\nexport function createContentDiagnosticComponent(data: ContentDiagnostic): ComponentType {\n return function ContentDiagnosticComponent() {\n return <ContentDiagnosticPanel data={data} />\n }\n}\n","import { useEffect, useState } from 'react'\nimport { useLocation } from 'react-router-dom'\n\nimport { useConfig, useLocale, useOpenApiSpecs } from '../../core/context'\n\nimport type { OpenAPISpec } from './utils'\n\ntype OpenApiSpecResult = {\n spec: OpenAPISpec | null\n loading: boolean\n}\n\ntype OpenApiSpecModule = { default: OpenAPISpec } | OpenAPISpec\n\ntype LoadedSpecState = {\n loader?: () => Promise<OpenApiSpecModule>\n spec: OpenAPISpec | null\n}\n\nfunction isOpenApiSpecLoader(value: unknown): value is () => Promise<OpenApiSpecModule> {\n return typeof value === 'function'\n}\n\nfunction getLoadedSpec(value: OpenApiSpecModule): OpenAPISpec {\n return value && typeof value === 'object' && 'default' in value\n ? value.default\n : value\n}\n\nconst VIRTUAL_PREFIX = 'virtual:clarify-page/'\n\nfunction resolveRelativePath(fromDir: string, to: string): string {\n const parts = (fromDir + '/' + to).split('/').filter(Boolean)\n const stack: string[] = []\n for (const part of parts) {\n if (part === '..') {\n stack.pop()\n } else if (part !== '.') {\n stack.push(part)\n }\n }\n return stack.join('/')\n}\n\nfunction normalizeSpecPath(specPath: string, currentRoutePath?: string, routePrefix = ''): string {\n if (specPath.startsWith(VIRTUAL_PREFIX)) return specPath\n\n const normalizedRoutePrefix = routePrefix.replace(/^\\/+|\\/+$/g, '')\n const normalizedSpecPath = specPath.startsWith('/') && normalizedRoutePrefix && specPath.slice(1).startsWith(`${normalizedRoutePrefix}/`)\n ? '/' + specPath.slice(normalizedRoutePrefix.length + 2)\n : specPath\n\n if (normalizedSpecPath.startsWith('/')) {\n return VIRTUAL_PREFIX + normalizedSpecPath.replace(/^\\//, '')\n }\n const fromDir = currentRoutePath === '/' ? '' : currentRoutePath?.replace(/^\\//, '').replace(/\\/[^/]*$/, '') ?? ''\n const normalizedFromDir = normalizedRoutePrefix && fromDir.startsWith(`${normalizedRoutePrefix}/`)\n ? fromDir.slice(normalizedRoutePrefix.length + 1)\n : fromDir\n return VIRTUAL_PREFIX + resolveRelativePath(normalizedFromDir, normalizedSpecPath)\n}\n\n/**\n * Prefer a locale-qualified registry key for absolute specPath values, then\n * fall back to the normalized key. The CLI registers visible route aliases,\n * while relative paths already resolve through the current localized route.\n */\nfunction specModuleCandidates(moduleId: string, specPath: string, locale: string | undefined): string[] {\n const candidates: string[] = []\n if (locale && specPath.startsWith('/') && !specPath.startsWith(VIRTUAL_PREFIX)) {\n const rest = moduleId.slice(VIRTUAL_PREFIX.length)\n if (!rest.startsWith(`${locale}/`) && rest !== locale) candidates.push(`${VIRTUAL_PREFIX}${locale}/${rest}`)\n }\n candidates.push(moduleId)\n return candidates\n}\n\nexport function useOpenApiSpec(spec?: OpenAPISpec, specPath?: string): OpenApiSpecResult {\n const config = useConfig()\n const locale = useLocale()\n const specs = useOpenApiSpecs()\n const location = useLocation()\n const [loadedSpec, setLoadedSpec] = useState<LoadedSpecState>({ spec: null })\n const normalized = specPath ? normalizeSpecPath(specPath, location.pathname, config.routePrefix) : undefined\n const candidates = specPath && normalized ? specModuleCandidates(normalized, specPath, locale) : []\n const registryValue = candidates.map(candidate => specs[candidate]).find(Boolean)\n\n useEffect(() => {\n let cancelled = false\n\n if (!isOpenApiSpecLoader(registryValue)) return\n\n registryValue().then(module => {\n if (!cancelled) setLoadedSpec({ loader: registryValue, spec: getLoadedSpec(module) })\n }).catch(() => {\n if (!cancelled) setLoadedSpec({ loader: registryValue, spec: null })\n })\n\n return () => {\n cancelled = true\n }\n }, [registryValue])\n\n if (spec) return { spec, loading: false }\n if (!specPath) return { spec: null, loading: false }\n if (isOpenApiSpecLoader(registryValue)) {\n return loadedSpec.loader === registryValue\n ? { spec: loadedSpec.spec, loading: false }\n : { spec: null, loading: true }\n }\n return { spec: registryValue ?? null, loading: false }\n}\n","import type { ReactNode } from 'react'\n\nimport { PageActions } from '../app/PageActions'\nimport { Prose } from '../components/Prose'\nimport { useBuiltInText } from '../core/i18n'\nimport { Markdown } from '../mdx/Markdown'\n\nimport { OpenApiOperation as OpenApiOperationComponent } from './components/OpenApiOperation'\nimport { OpenApiRequestWorkbench } from './components/OpenApiRequest'\nimport { useOpenApiSpec } from './lib/spec-path'\nimport { getOpenApiOperationEntryById, listOpenApiOperations } from './lib/utils'\nimport type { OpenAPISpec } from './lib/utils'\n\ntype OpenApiPathsProps = { spec: OpenAPISpec; tagFilter?: string[] }\n\ntype OpenApiHeaderProps = { spec: OpenAPISpec }\n\ntype WarningBoxProps = {\n children: ReactNode\n tone?: 'amber' | 'red'\n}\n\nexport type OpenApiDocumentProps = {\n spec?: OpenAPISpec\n specPath?: string\n tagFilter?: string[]\n}\n\nexport type OpenApiRouteData = {\n spec: OpenAPISpec\n}\n\ntype OpenApiOperationWithSpecProps = {\n spec: OpenAPISpec\n operationId: string\n}\n\nexport type OpenApiOperationProps = {\n specPath: string\n operationId: string\n}\n\nexport type OpenApiRequestProps = OpenApiOperationProps & {\n requestExample?: string\n}\n\nfunction OpenApiHeader(arg0: OpenApiHeaderProps): ReactNode {\n const { spec } = arg0\n\n const t = useBuiltInText()\n return (\n <header className=\"clarify-openapi-header mb-16 border-b border-(--clarify-theme-tokens-colors-border) pb-8\">\n <p className=\"mb-3 text-xs/6 font-medium tracking-widest text-(--clarify-ui-accent-text) uppercase\">\n {t('openapi.openApiReference')}\n </p>\n <h1 className=\"clarify-page-title\">{spec.info?.title ?? t('openapi.apiDocumentation')}</h1>\n {spec.info?.description ? <Markdown className=\"lead mt-4 *:first:mt-0 *:last:mb-0\">{spec.info.description}</Markdown> : null}\n {spec.info?.version ? <p className=\"mt-4 text-sm text-(--clarify-ui-text-faint)\">{t('openapi.version', { version: spec.info.version })}</p> : null}\n </header>\n )\n}\n\nfunction operationMatchesTags(operationTags: string[] | undefined, filterTags: string[] | undefined): boolean {\n if (!filterTags?.length) return true\n return operationTags?.some(tag => filterTags.includes(tag)) ?? false\n}\n\nfunction OpenApiPaths(arg0: OpenApiPathsProps): ReactNode {\n const { spec, tagFilter } = arg0\n\n const entries = listOpenApiOperations(spec)\n .filter(({ operation }) => operationMatchesTags(operation.tags, tagFilter))\n .map(({ path, method, operation, source }) => ({\n path,\n method: method.toUpperCase(),\n operation,\n source,\n }))\n\n return (\n <div className=\"clarify-openai-endpoints divide-y divide-zinc-200/70 dark:divide-white/10\">\n {entries.map(({ path, method, operation, source }) => (\n <OpenApiOperationComponent key={`${source}-${method}-${path}`} spec={spec} path={path} method={method} operation={operation} operationSource={source} />\n ))}\n </div>\n )\n}\n\nfunction WarningBox(arg0: WarningBoxProps): ReactNode {\n const { children, tone = 'amber' } = arg0\n\n const classes = tone === 'red'\n ? 'rounded-lg border border-red-200 bg-red-50 p-4 text-sm text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-200'\n : 'rounded-lg border border-amber-200 bg-amber-50 p-4 text-sm text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200'\n\n return <div className={`clarify-warning ${classes}`}>{children}</div>\n}\n\nexport function OpenApiDocument(arg0: OpenApiDocumentProps): ReactNode {\n const { spec, specPath, tagFilter } = arg0\n const t = useBuiltInText()\n const { spec: resolved, loading } = useOpenApiSpec(spec, specPath)\n\n if (loading) {\n return <WarningBox>{t('openapi.loading')}</WarningBox>\n }\n if (!resolved) {\n return <WarningBox>{t('openapi.specNotFound', { specPath: specPath ?? t('openapi.specPathMissing') })}</WarningBox>\n }\n\n return (\n <article className=\"clarify-openapi-page relative flex h-full flex-col pt-16 pb-10\">\n <div className=\"clarify-page-actions mb-4 flex justify-end sm:absolute sm:top-16 sm:right-0 sm:mb-0\">\n <PageActions />\n </div>\n <Prose className=\"flex-auto\">\n <OpenApiHeader spec={resolved} />\n <OpenApiPaths spec={resolved} tagFilter={tagFilter} />\n </Prose>\n </article>\n )\n}\n\nfunction OpenApiOperationWithSpec(arg0: OpenApiOperationWithSpecProps): ReactNode {\n const { spec, operationId } = arg0\n const t = useBuiltInText()\n const entry = getOpenApiOperationEntryById(spec, operationId)\n\n if (!entry) {\n return <WarningBox tone=\"red\">{t('openapi.endpointNotFound', { endpoint: operationId })}</WarningBox>\n }\n\n const normalizedMethod = entry.method.toUpperCase()\n return <OpenApiOperationComponent key={`${entry.source}-${normalizedMethod}-${entry.path}`} spec={spec} path={entry.path} method={normalizedMethod} operation={entry.operation} operationSource={entry.source} />\n}\n\nexport function OpenApiOperation(arg0: OpenApiOperationProps): ReactNode {\n const { specPath, operationId } = arg0\n const t = useBuiltInText()\n const { spec, loading } = useOpenApiSpec(undefined, specPath)\n\n if (loading) {\n return <WarningBox>{t('openapi.loading')}</WarningBox>\n }\n if (!spec) {\n return <WarningBox>{t('openapi.specNotFound', { specPath })}</WarningBox>\n }\n\n return <OpenApiOperationWithSpec spec={spec} operationId={operationId} />\n}\n\nexport function OpenApiRequest(arg0: OpenApiRequestProps): ReactNode {\n const { specPath, operationId, requestExample } = arg0\n const t = useBuiltInText()\n const { spec, loading } = useOpenApiSpec(undefined, specPath)\n\n if (loading) return <WarningBox>{t('openapi.loading')}</WarningBox>\n if (!spec) return <WarningBox>{t('openapi.specNotFound', { specPath })}</WarningBox>\n\n const entry = getOpenApiOperationEntryById(spec, operationId)\n if (!entry) return <WarningBox tone=\"red\">{t('openapi.endpointNotFound', { endpoint: operationId })}</WarningBox>\n\n return (\n <OpenApiRequestWorkbench\n spec={spec}\n path={entry.path}\n method={entry.method.toUpperCase()}\n operation={entry.operation}\n operationSource={entry.source}\n requestExample={requestExample}\n />\n )\n}\n\nexport function createOpenApiRouteComponent(data: OpenApiRouteData) {\n return function OpenApiRoutePage() {\n return <OpenApiDocument spec={data.spec} />\n }\n}\n","import clsx from 'clsx'\nimport { ArrowRight } from 'lucide-react'\nimport type { ReactNode } from 'react'\n\nimport { LocalizedLink } from '../../components/LocalizedLink'\nimport { useConfig, useLocale } from '../../core/context'\nimport { useBuiltInText } from '../../core/i18n'\nimport { localizeHref, prefixHref } from '../../utils/href'\nimport { useOpenApiSpec } from '../lib/spec-path'\nimport { getOpenApiOperationEntryById, getOpenApiOperationSectionId } from '../lib/utils'\n\nimport { EndpointMethodBadge } from './EndpointMethodBadge'\n\nexport type OpenApiLinkProps = {\n specPath: string\n operationId: string\n href?: string\n inline?: boolean\n className?: string\n}\n\ntype OpenApiLinkViewProps = {\n href: string\n method: string\n path: string\n label: string\n className?: string\n}\n\nexport function OpenApiLink(arg0: OpenApiLinkProps): ReactNode {\n const { specPath, operationId, href: hrefOverride, inline = false, className } = arg0\n const config = useConfig()\n const locale = useLocale()\n const t = useBuiltInText()\n const { spec, loading } = useOpenApiSpec(undefined, specPath)\n\n if (loading) return <span className={className}>{t('openapi.loading')}</span>\n\n const entry = spec ? getOpenApiOperationEntryById(spec, operationId) : undefined\n if (!entry) return <span className={className}>{t('openapi.endpointNotFound', { endpoint: operationId })}</span>\n\n const sectionId = getOpenApiOperationSectionId(entry.operation) || operationId\n const targetPath = hrefOverride ?? specPath\n const href = `${prefixHref(localizeHref(targetPath, config, locale), config.routePrefix)}#${sectionId}`\n const method = entry.method.toUpperCase()\n const title = entry.operation.summary?.trim() || ''\n\n if (inline) return <OpenApiLinkInline href={href} method={method} path={entry.path} label={title || entry.path} className={className} />\n return <OpenApiLinkBlock href={href} method={method} path={entry.path} label={title} className={className} />\n}\n\nfunction OpenApiLinkInline(arg0: OpenApiLinkViewProps): ReactNode {\n const { href, method, label, className } = arg0\n\n return (\n <LocalizedLink\n href={href}\n className={clsx(\n 'clarify-openapi-link clarify-openapi-link-inline not-prose inline-flex max-w-full items-center gap-1.5 rounded-md bg-(--clarify-ui-active-background) py-px pr-1.5 pl-px align-[0.125em] text-(--clarify-theme-tokens-colors-foreground) no-underline transition-colors hover:bg-(--clarify-ui-accent-background) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary) focus-visible:ring-offset-2',\n className,\n )}\n aria-label={`${method}: ${label}`}\n >\n <EndpointMethodBadge method={method} compact />\n <span className=\"truncate text-[0.8125rem]/5 font-medium\">{label}</span>\n </LocalizedLink>\n )\n}\n\nfunction OpenApiLinkBlock(arg0: OpenApiLinkViewProps): ReactNode {\n const { href, method, path, label, className } = arg0\n\n return (\n <LocalizedLink\n href={href}\n className={clsx(\n 'clarify-openapi-link not-prose group flex w-full items-center gap-3 rounded-lg border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) px-3 py-3 no-underline transition-colors hover:border-(--clarify-ui-accent-border) hover:bg-(--clarify-ui-hover-background) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary) focus-visible:ring-offset-2',\n className,\n )}\n >\n <EndpointMethodBadge method={method} />\n <span className=\"min-w-0 flex-1\">\n <code className=\"block truncate bg-transparent p-0 font-mono text-sm/6 font-semibold text-(--clarify-theme-tokens-colors-foreground)\">{path}</code>\n {label ? <span className=\"mt-0.5 block truncate text-xs/5 text-(--clarify-ui-text-faint)\">{label}</span> : null}\n </span>\n <span className=\"flex size-8 shrink-0 items-center justify-center rounded-md text-(--clarify-ui-text-faint) transition-colors group-hover:bg-(--clarify-theme-tokens-colors-surface) group-hover:text-(--clarify-ui-accent-text)\">\n <ArrowRight aria-hidden=\"true\" className=\"size-4\" />\n </span>\n </LocalizedLink>\n )\n}\n","import { Collapse } from '../components/Collapse'\nimport { Mermaid } from '../components/Mermaid'\nimport { OpenApiRequest, OpenApiDocument, OpenApiLink, OpenApiOperation } from '../openapi'\n\nimport * as mdxPrimitives from './primitives'\n\nconst builtInMDXComponents = {\n ...mdxPrimitives,\n Collapse,\n Mermaid,\n}\n\nconst builtInOpenAPIComponents = {\n OpenApiLink,\n OpenApiRequest,\n OpenApiDocument,\n OpenApiOperation,\n}\n\nexport function useMDXComponents(components: Record<string, unknown> = {}) {\n return {\n ...components,\n ...builtInMDXComponents,\n ...builtInOpenAPIComponents,\n }\n}\n","import type { ReactNode } from 'react'\n\nimport { Prose } from '../components/Prose'\n\nexport type DocShellProps = {\n title: string\n subtitle?: string\n children: ReactNode\n}\n\nexport function DocShell(arg0: DocShellProps) {\n const { title, subtitle, children } = arg0\n\n return (\n <main className=\"clarify-doc-shell min-h-screen bg-(--clarify-theme-tokens-colors-background) px-6 py-10 text-(--clarify-theme-tokens-colors-foreground) md:px-10\">\n <div className=\"mx-auto max-w-6xl\">\n <header className=\"mb-10\">\n <h1 className=\"text-3xl font-bold tracking-tight md:text-5xl\">{title}</h1>\n {subtitle ? <p className=\"mt-3 max-w-2xl text-(--clarify-ui-text-soft)\">{subtitle}</p> : null}\n </header>\n <Prose>{children}</Prose>\n </div>\n </main>\n )\n}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,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;EAAM,WAAU;YACd,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;GAAK,WAAU;aAAf,CACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,UAAD;IAAQ,WAAU;cAAlB,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD;KAAI,WAAU;eAAiD;IAAU,CAAA,GACxE,WAAW,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;KAAG,WAAU;eAAgD;IAAY,CAAA,IAAI,IACnF;OACR,iBAAA,GAAA,kBAAA,IAAA,CAAC,yBAAA,OAAD,EAAQ,SAAgB,CAAA,CACrB;;CACD,CAAA;AAEV"}
|
package/output/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { OpenApiSpecsContext, useOpenApiSpecs } from './context';
|
|
|
9
9
|
import { useMDXComponents } from './mdx/components';
|
|
10
10
|
import { DocShell } from './mdx/DocShell';
|
|
11
11
|
import { markdownRemarkPlugins, parseCodeMeta } from './mdx/remark';
|
|
12
|
-
import { OpenApiRequest, OpenApiDocument, OpenApiOperation, createOpenApiRouteComponent } from './openapi';
|
|
12
|
+
import { OpenApiRequest, OpenApiDocument, OpenApiLink, OpenApiOperation, createOpenApiRouteComponent } from './openapi';
|
|
13
13
|
import { render } from './runtime/render';
|
|
14
14
|
import { SlotProvider, RuntimeSlot, RuntimeSlotsProvider, useSlot } from './slots';
|
|
15
15
|
import { applyThemeVariables, themeEditorPresets, ThemeEditor } from './theme/ThemeEditor';
|
|
@@ -18,7 +18,7 @@ import { ThemeToggle } from './theme/ThemeToggle';
|
|
|
18
18
|
import { themePresets, themeBootstrapScript } from './theme/variables';
|
|
19
19
|
import { Config, RouteItem, RouteSection, RenderOptions, ServerRenderOptions } from './types';
|
|
20
20
|
import { remToPx } from './utils/remToPx';
|
|
21
|
-
export type { OpenApiRequestProps, OpenApiOperationProps, OpenApiDocumentProps, OpenAPIOperation, OpenAPISpec, OpenApiRouteData } from './openapi';
|
|
21
|
+
export type { OpenApiRequestProps, OpenApiOperationProps, OpenApiDocumentProps, OpenApiLinkProps, OpenAPIOperation, OpenAPISpec, OpenApiRouteData } from './openapi';
|
|
22
22
|
export type { ThemeEditorProps } from './theme/ThemeEditor';
|
|
23
23
|
export type { StepProps, StepsProps, TabItem, TabProps, TabsProps } from './components';
|
|
24
24
|
export type { ContentDiagnostic, ContentDiagnosticKind };
|
|
@@ -28,4 +28,4 @@ export { AppShell, render, OpenApiSpecsContext, useOpenApiSpecs, BuiltWithClarif
|
|
|
28
28
|
export { Button, Callout, Card, CardGroup, Code, CodeGroup, Collapse, Pre, Prose, Heading, Logo, Mermaid, GridPattern, HeroPattern, Feedback, Step, Steps, Tab, Tabs, Tag, WebFrame };
|
|
29
29
|
export { DocShell, useMDXComponents, markdownRemarkPlugins, parseCodeMeta };
|
|
30
30
|
export { SlotProvider, RuntimeSlot, RuntimeSlotsProvider, useSlot };
|
|
31
|
-
export { OpenApiRequest, OpenApiDocument, OpenApiOperation };
|
|
31
|
+
export { OpenApiRequest, OpenApiDocument, OpenApiLink, OpenApiOperation };
|
package/output/index.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as Feedback, B as LocalizedLink, C as Steps, D as Logo, E as HeroPattern, F as Mermaid, I as Card, L as CardGroup, M as Code, N as CodeGroup, O as Heading, P as Pre, R as Callout, S as Step, T as GridPattern, _ as Markdown, b as TabItem, d as EndpointMethodBadge, f as getOpenApiOperationEntryById, j as Collapse, k as Tag, m as listOpenApiOperations, n as OpenApiOperation$1, p as getOpenApiOperationSectionId, r as OpenApiRequestWorkbench, v as primitives_exports, w as Prose, x as Tabs, y as WebFrame, z as Button } from "./OpenApiOperation-Dv9u2GEJ.js";
|
|
2
2
|
import { a as useConfig, c as useOpenApiSpecs, i as OpenApiSpecsContext, s as useLocale, t as useBuiltInText } from "./i18n-Cff810G_.js";
|
|
3
|
-
import { a as themeBootstrapScript, c as AppShell, d as RenderErrorPanel, f as BuiltWithClarify, g as useSlot, h as SlotProvider, i as themeEditorPresets, l as PageFooter, m as RuntimeSlotsProvider, n as ThemeEditor, o as themePresets, p as RuntimeSlot, r as applyThemeVariables, u as PageBanner } from "./ClarifyShell-
|
|
4
|
-
import { a as SectionProvider, h as useTheme, m as ThemeProvider, o as useSectionStore, p as ThemeToggle, s as remToPx, t as PageActions } from "./PageActions-DviEypf6.js";
|
|
3
|
+
import { a as themeBootstrapScript, c as AppShell, d as RenderErrorPanel, f as BuiltWithClarify, g as useSlot, h as SlotProvider, i as themeEditorPresets, l as PageFooter, m as RuntimeSlotsProvider, n as ThemeEditor, o as themePresets, p as RuntimeSlot, r as applyThemeVariables, u as PageBanner } from "./ClarifyShell-CKvXZj0f.js";
|
|
4
|
+
import { T as prefixHref, a as SectionProvider, h as useTheme, m as ThemeProvider, o as useSectionStore, p as ThemeToggle, s as remToPx, t as PageActions, w as localizeHref } from "./PageActions-DviEypf6.js";
|
|
5
5
|
import { n as parseCodeMeta, t as markdownRemarkPlugins } from "./remark-C9iRQM0R.js";
|
|
6
|
-
import { t as render } from "./render-
|
|
6
|
+
import { t as render } from "./render-B41PHjt8.js";
|
|
7
|
+
import clsx from "clsx";
|
|
7
8
|
import { useEffect, useState } from "react";
|
|
8
9
|
import { useLocation } from "react-router-dom";
|
|
10
|
+
import { ArrowRight } from "lucide-react";
|
|
9
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
12
|
//#region source/app/ContentDiagnostic.tsx
|
|
11
13
|
function ContentDiagnosticPanel(params) {
|
|
@@ -254,6 +256,84 @@ function createOpenApiRouteComponent(data) {
|
|
|
254
256
|
};
|
|
255
257
|
}
|
|
256
258
|
//#endregion
|
|
259
|
+
//#region source/openapi/components/OpenApiLink.tsx
|
|
260
|
+
function OpenApiLink(arg0) {
|
|
261
|
+
const { specPath, operationId, href: hrefOverride, inline = false, className } = arg0;
|
|
262
|
+
const config = useConfig();
|
|
263
|
+
const locale = useLocale();
|
|
264
|
+
const t = useBuiltInText();
|
|
265
|
+
const { spec, loading } = useOpenApiSpec(void 0, specPath);
|
|
266
|
+
if (loading) return /* @__PURE__ */ jsx("span", {
|
|
267
|
+
className,
|
|
268
|
+
children: t("openapi.loading")
|
|
269
|
+
});
|
|
270
|
+
const entry = spec ? getOpenApiOperationEntryById(spec, operationId) : void 0;
|
|
271
|
+
if (!entry) return /* @__PURE__ */ jsx("span", {
|
|
272
|
+
className,
|
|
273
|
+
children: t("openapi.endpointNotFound", { endpoint: operationId })
|
|
274
|
+
});
|
|
275
|
+
const sectionId = getOpenApiOperationSectionId(entry.operation) || operationId;
|
|
276
|
+
const href = `${prefixHref(localizeHref(hrefOverride ?? specPath, config, locale), config.routePrefix)}#${sectionId}`;
|
|
277
|
+
const method = entry.method.toUpperCase();
|
|
278
|
+
const title = entry.operation.summary?.trim() || "";
|
|
279
|
+
if (inline) return /* @__PURE__ */ jsx(OpenApiLinkInline, {
|
|
280
|
+
href,
|
|
281
|
+
method,
|
|
282
|
+
path: entry.path,
|
|
283
|
+
label: title || entry.path,
|
|
284
|
+
className
|
|
285
|
+
});
|
|
286
|
+
return /* @__PURE__ */ jsx(OpenApiLinkBlock, {
|
|
287
|
+
href,
|
|
288
|
+
method,
|
|
289
|
+
path: entry.path,
|
|
290
|
+
label: title,
|
|
291
|
+
className
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
function OpenApiLinkInline(arg0) {
|
|
295
|
+
const { href, method, label, className } = arg0;
|
|
296
|
+
return /* @__PURE__ */ jsxs(LocalizedLink, {
|
|
297
|
+
href,
|
|
298
|
+
className: clsx("clarify-openapi-link clarify-openapi-link-inline not-prose inline-flex max-w-full items-center gap-1.5 rounded-md bg-(--clarify-ui-active-background) py-px pr-1.5 pl-px align-[0.125em] text-(--clarify-theme-tokens-colors-foreground) no-underline transition-colors hover:bg-(--clarify-ui-accent-background) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary) focus-visible:ring-offset-2", className),
|
|
299
|
+
"aria-label": `${method}: ${label}`,
|
|
300
|
+
children: [/* @__PURE__ */ jsx(EndpointMethodBadge, {
|
|
301
|
+
method,
|
|
302
|
+
compact: true
|
|
303
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
304
|
+
className: "truncate text-[0.8125rem]/5 font-medium",
|
|
305
|
+
children: label
|
|
306
|
+
})]
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
function OpenApiLinkBlock(arg0) {
|
|
310
|
+
const { href, method, path, label, className } = arg0;
|
|
311
|
+
return /* @__PURE__ */ jsxs(LocalizedLink, {
|
|
312
|
+
href,
|
|
313
|
+
className: clsx("clarify-openapi-link not-prose group flex w-full items-center gap-3 rounded-lg border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) px-3 py-3 no-underline transition-colors hover:border-(--clarify-ui-accent-border) hover:bg-(--clarify-ui-hover-background) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary) focus-visible:ring-offset-2", className),
|
|
314
|
+
children: [
|
|
315
|
+
/* @__PURE__ */ jsx(EndpointMethodBadge, { method }),
|
|
316
|
+
/* @__PURE__ */ jsxs("span", {
|
|
317
|
+
className: "min-w-0 flex-1",
|
|
318
|
+
children: [/* @__PURE__ */ jsx("code", {
|
|
319
|
+
className: "block truncate bg-transparent p-0 font-mono text-sm/6 font-semibold text-(--clarify-theme-tokens-colors-foreground)",
|
|
320
|
+
children: path
|
|
321
|
+
}), label ? /* @__PURE__ */ jsx("span", {
|
|
322
|
+
className: "mt-0.5 block truncate text-xs/5 text-(--clarify-ui-text-faint)",
|
|
323
|
+
children: label
|
|
324
|
+
}) : null]
|
|
325
|
+
}),
|
|
326
|
+
/* @__PURE__ */ jsx("span", {
|
|
327
|
+
className: "flex size-8 shrink-0 items-center justify-center rounded-md text-(--clarify-ui-text-faint) transition-colors group-hover:bg-(--clarify-theme-tokens-colors-surface) group-hover:text-(--clarify-ui-accent-text)",
|
|
328
|
+
children: /* @__PURE__ */ jsx(ArrowRight, {
|
|
329
|
+
"aria-hidden": "true",
|
|
330
|
+
className: "size-4"
|
|
331
|
+
})
|
|
332
|
+
})
|
|
333
|
+
]
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
//#endregion
|
|
257
337
|
//#region source/mdx/components.ts
|
|
258
338
|
var builtInMDXComponents = {
|
|
259
339
|
...primitives_exports,
|
|
@@ -261,6 +341,7 @@ var builtInMDXComponents = {
|
|
|
261
341
|
Mermaid
|
|
262
342
|
};
|
|
263
343
|
var builtInOpenAPIComponents = {
|
|
344
|
+
OpenApiLink,
|
|
264
345
|
OpenApiRequest,
|
|
265
346
|
OpenApiDocument,
|
|
266
347
|
OpenApiOperation
|
|
@@ -294,6 +375,6 @@ function DocShell(arg0) {
|
|
|
294
375
|
});
|
|
295
376
|
}
|
|
296
377
|
//#endregion
|
|
297
|
-
export { AppShell, BuiltWithClarify, Button, Callout, Card, CardGroup, Code, CodeGroup, Collapse, DocShell, Feedback, GridPattern, Heading, HeroPattern, Logo, Mermaid, OpenApiDocument, OpenApiOperation, OpenApiRequest, OpenApiSpecsContext, PageBanner, PageFooter, Pre, Prose, RuntimeSlot, RuntimeSlotsProvider, SectionProvider, SlotProvider, Step, Steps, TabItem as Tab, Tabs, Tag, ThemeEditor, ThemeProvider, ThemeToggle, WebFrame, applyThemeVariables, createContentDiagnosticComponent, createOpenApiRouteComponent, markdownRemarkPlugins, parseCodeMeta, remToPx, render, themeBootstrapScript, themeEditorPresets, themePresets, useMDXComponents, useOpenApiSpecs, useSectionStore, useSlot, useTheme };
|
|
378
|
+
export { AppShell, BuiltWithClarify, Button, Callout, Card, CardGroup, Code, CodeGroup, Collapse, DocShell, Feedback, GridPattern, Heading, HeroPattern, Logo, Mermaid, OpenApiDocument, OpenApiLink, OpenApiOperation, OpenApiRequest, OpenApiSpecsContext, PageBanner, PageFooter, Pre, Prose, RuntimeSlot, RuntimeSlotsProvider, SectionProvider, SlotProvider, Step, Steps, TabItem as Tab, Tabs, Tag, ThemeEditor, ThemeProvider, ThemeToggle, WebFrame, applyThemeVariables, createContentDiagnosticComponent, createOpenApiRouteComponent, markdownRemarkPlugins, parseCodeMeta, remToPx, render, themeBootstrapScript, themeEditorPresets, themePresets, useMDXComponents, useOpenApiSpecs, useSectionStore, useSlot, useTheme };
|
|
298
379
|
|
|
299
380
|
//# sourceMappingURL=index.js.map
|
package/output/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../source/app/ContentDiagnostic.tsx","../source/openapi/lib/spec-path.ts","../source/openapi/entry.tsx","../source/mdx/components.ts","../source/mdx/DocShell.tsx"],"sourcesContent":["import type { ComponentType } from 'react'\n\nimport { RenderErrorPanel } from './RenderErrorPanel'\n\nexport type ContentDiagnosticKind = 'markdown' | 'markdown+jsx' | 'openapi' | 'route-load'\n\nexport type ContentDiagnostic = {\n kind: ContentDiagnosticKind\n title: string\n message: string\n details?: string\n filePath?: string\n}\n\ntype ContentDiagnosticPanelProps = {\n data: ContentDiagnostic\n}\n\nfunction ContentDiagnosticPanel(params: ContentDiagnosticPanelProps) {\n const { data } = params\n const typeLabels: Record<ContentDiagnosticKind, string> = {\n markdown: 'Markdown',\n 'markdown+jsx': 'MDX',\n openapi: 'OpenAPI',\n 'route-load': 'Route',\n }\n const typeLabel = typeLabels[data.kind]\n const detailsLabel = data.kind === 'markdown+jsx' || data.kind === 'markdown' ? 'Why it happened' : 'Details'\n const pathLabel = 'File'\n\n return (\n <RenderErrorPanel\n title={data.title}\n description={data.message}\n titleId=\"clarify-content-diagnostic-title\"\n metadata={[\n { label: pathLabel, value: data.filePath ?? 'Unknown' },\n { label: 'Type', value: typeLabel },\n ]}\n detailsLabel={detailsLabel}\n detailsContent={data.details ? (\n <pre className=\"max-h-(--clarify-error-details-max-height) overflow-auto whitespace-pre-wrap wrap-break-word font-mono\">\n {data.details}\n </pre>\n ) : null}\n />\n )\n}\n\nexport function createContentDiagnosticComponent(data: ContentDiagnostic): ComponentType {\n return function ContentDiagnosticComponent() {\n return <ContentDiagnosticPanel data={data} />\n }\n}\n","import { useEffect, useState } from 'react'\nimport { useLocation } from 'react-router-dom'\n\nimport { useConfig, useLocale, useOpenApiSpecs } from '../../core/context'\n\nimport type { OpenAPISpec } from './utils'\n\ntype OpenApiSpecResult = {\n spec: OpenAPISpec | null\n loading: boolean\n}\n\ntype OpenApiSpecModule = { default: OpenAPISpec } | OpenAPISpec\n\ntype LoadedSpecState = {\n loader?: () => Promise<OpenApiSpecModule>\n spec: OpenAPISpec | null\n}\n\nfunction isOpenApiSpecLoader(value: unknown): value is () => Promise<OpenApiSpecModule> {\n return typeof value === 'function'\n}\n\nfunction getLoadedSpec(value: OpenApiSpecModule): OpenAPISpec {\n return value && typeof value === 'object' && 'default' in value\n ? value.default\n : value\n}\n\nconst VIRTUAL_PREFIX = 'virtual:clarify-page/'\n\nfunction resolveRelativePath(fromDir: string, to: string): string {\n const parts = (fromDir + '/' + to).split('/').filter(Boolean)\n const stack: string[] = []\n for (const part of parts) {\n if (part === '..') {\n stack.pop()\n } else if (part !== '.') {\n stack.push(part)\n }\n }\n return stack.join('/')\n}\n\nfunction normalizeSpecPath(specPath: string, currentRoutePath?: string, routePrefix = ''): string {\n if (specPath.startsWith(VIRTUAL_PREFIX)) return specPath\n\n const normalizedRoutePrefix = routePrefix.replace(/^\\/+|\\/+$/g, '')\n const normalizedSpecPath = specPath.startsWith('/') && normalizedRoutePrefix && specPath.slice(1).startsWith(`${normalizedRoutePrefix}/`)\n ? '/' + specPath.slice(normalizedRoutePrefix.length + 2)\n : specPath\n\n if (normalizedSpecPath.startsWith('/')) {\n return VIRTUAL_PREFIX + normalizedSpecPath.replace(/^\\//, '')\n }\n const fromDir = currentRoutePath === '/' ? '' : currentRoutePath?.replace(/^\\//, '').replace(/\\/[^/]*$/, '') ?? ''\n const normalizedFromDir = normalizedRoutePrefix && fromDir.startsWith(`${normalizedRoutePrefix}/`)\n ? fromDir.slice(normalizedRoutePrefix.length + 1)\n : fromDir\n return VIRTUAL_PREFIX + resolveRelativePath(normalizedFromDir, normalizedSpecPath)\n}\n\n/**\n * Prefer a locale-qualified registry key for absolute specPath values, then\n * fall back to the normalized key. The CLI registers visible route aliases,\n * while relative paths already resolve through the current localized route.\n */\nfunction specModuleCandidates(moduleId: string, specPath: string, locale: string | undefined): string[] {\n const candidates: string[] = []\n if (locale && specPath.startsWith('/') && !specPath.startsWith(VIRTUAL_PREFIX)) {\n const rest = moduleId.slice(VIRTUAL_PREFIX.length)\n if (!rest.startsWith(`${locale}/`) && rest !== locale) candidates.push(`${VIRTUAL_PREFIX}${locale}/${rest}`)\n }\n candidates.push(moduleId)\n return candidates\n}\n\nexport function useOpenApiSpec(spec?: OpenAPISpec, specPath?: string): OpenApiSpecResult {\n const config = useConfig()\n const locale = useLocale()\n const specs = useOpenApiSpecs()\n const location = useLocation()\n const [loadedSpec, setLoadedSpec] = useState<LoadedSpecState>({ spec: null })\n const normalized = specPath ? normalizeSpecPath(specPath, location.pathname, config.routePrefix) : undefined\n const candidates = specPath && normalized ? specModuleCandidates(normalized, specPath, locale) : []\n const registryValue = candidates.map(candidate => specs[candidate]).find(Boolean)\n\n useEffect(() => {\n let cancelled = false\n\n if (!isOpenApiSpecLoader(registryValue)) return\n\n registryValue().then(module => {\n if (!cancelled) setLoadedSpec({ loader: registryValue, spec: getLoadedSpec(module) })\n }).catch(() => {\n if (!cancelled) setLoadedSpec({ loader: registryValue, spec: null })\n })\n\n return () => {\n cancelled = true\n }\n }, [registryValue])\n\n if (spec) return { spec, loading: false }\n if (!specPath) return { spec: null, loading: false }\n if (isOpenApiSpecLoader(registryValue)) {\n return loadedSpec.loader === registryValue\n ? { spec: loadedSpec.spec, loading: false }\n : { spec: null, loading: true }\n }\n return { spec: registryValue ?? null, loading: false }\n}\n","import type { ReactNode } from 'react'\n\nimport { PageActions } from '../app/PageActions'\nimport { Prose } from '../components/Prose'\nimport { useBuiltInText } from '../core/i18n'\nimport { Markdown } from '../mdx/Markdown'\n\nimport { OpenApiOperation as OpenApiOperationComponent } from './components/OpenApiOperation'\nimport { OpenApiRequestWorkbench } from './components/OpenApiRequest'\nimport { useOpenApiSpec } from './lib/spec-path'\nimport { getOpenApiOperationEntryById, listOpenApiOperations } from './lib/utils'\nimport type { OpenAPISpec } from './lib/utils'\n\ntype OpenApiPathsProps = { spec: OpenAPISpec; tagFilter?: string[] }\n\ntype OpenApiHeaderProps = { spec: OpenAPISpec }\n\ntype WarningBoxProps = {\n children: ReactNode\n tone?: 'amber' | 'red'\n}\n\nexport type OpenApiDocumentProps = {\n spec?: OpenAPISpec\n specPath?: string\n tagFilter?: string[]\n}\n\nexport type OpenApiRouteData = {\n spec: OpenAPISpec\n}\n\ntype OpenApiOperationWithSpecProps = {\n spec: OpenAPISpec\n operationId: string\n}\n\nexport type OpenApiOperationProps = {\n specPath: string\n operationId: string\n}\n\nexport type OpenApiRequestProps = OpenApiOperationProps & {\n requestExample?: string\n}\n\nfunction OpenApiHeader(arg0: OpenApiHeaderProps): ReactNode {\n const { spec } = arg0\n\n const t = useBuiltInText()\n return (\n <header className=\"clarify-openapi-header mb-16 border-b border-(--clarify-theme-tokens-colors-border) pb-8\">\n <p className=\"mb-3 text-xs/6 font-medium tracking-widest text-(--clarify-ui-accent-text) uppercase\">\n {t('openapi.openApiReference')}\n </p>\n <h1 className=\"clarify-page-title\">{spec.info?.title ?? t('openapi.apiDocumentation')}</h1>\n {spec.info?.description ? <Markdown className=\"lead mt-4 *:first:mt-0 *:last:mb-0\">{spec.info.description}</Markdown> : null}\n {spec.info?.version ? <p className=\"mt-4 text-sm text-(--clarify-ui-text-faint)\">{t('openapi.version', { version: spec.info.version })}</p> : null}\n </header>\n )\n}\n\nfunction operationMatchesTags(operationTags: string[] | undefined, filterTags: string[] | undefined): boolean {\n if (!filterTags?.length) return true\n return operationTags?.some(tag => filterTags.includes(tag)) ?? false\n}\n\nfunction OpenApiPaths(arg0: OpenApiPathsProps): ReactNode {\n const { spec, tagFilter } = arg0\n\n const entries = listOpenApiOperations(spec)\n .filter(({ operation }) => operationMatchesTags(operation.tags, tagFilter))\n .map(({ path, method, operation, source }) => ({\n path,\n method: method.toUpperCase(),\n operation,\n source,\n }))\n\n return (\n <div className=\"clarify-openai-endpoints divide-y divide-zinc-200/70 dark:divide-white/10\">\n {entries.map(({ path, method, operation, source }) => (\n <OpenApiOperationComponent key={`${source}-${method}-${path}`} spec={spec} path={path} method={method} operation={operation} operationSource={source} />\n ))}\n </div>\n )\n}\n\nfunction WarningBox(arg0: WarningBoxProps): ReactNode {\n const { children, tone = 'amber' } = arg0\n\n const classes = tone === 'red'\n ? 'rounded-lg border border-red-200 bg-red-50 p-4 text-sm text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-200'\n : 'rounded-lg border border-amber-200 bg-amber-50 p-4 text-sm text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200'\n\n return <div className={`clarify-warning ${classes}`}>{children}</div>\n}\n\nexport function OpenApiDocument(arg0: OpenApiDocumentProps): ReactNode {\n const { spec, specPath, tagFilter } = arg0\n const t = useBuiltInText()\n const { spec: resolved, loading } = useOpenApiSpec(spec, specPath)\n\n if (loading) {\n return <WarningBox>{t('openapi.loading')}</WarningBox>\n }\n if (!resolved) {\n return <WarningBox>{t('openapi.specNotFound', { specPath: specPath ?? t('openapi.specPathMissing') })}</WarningBox>\n }\n\n return (\n <article className=\"clarify-openapi-page relative flex h-full flex-col pt-16 pb-10\">\n <div className=\"clarify-page-actions mb-4 flex justify-end sm:absolute sm:top-16 sm:right-0 sm:mb-0\">\n <PageActions />\n </div>\n <Prose className=\"flex-auto\">\n <OpenApiHeader spec={resolved} />\n <OpenApiPaths spec={resolved} tagFilter={tagFilter} />\n </Prose>\n </article>\n )\n}\n\nfunction OpenApiOperationWithSpec(arg0: OpenApiOperationWithSpecProps): ReactNode {\n const { spec, operationId } = arg0\n const t = useBuiltInText()\n const entry = getOpenApiOperationEntryById(spec, operationId)\n\n if (!entry) {\n return <WarningBox tone=\"red\">{t('openapi.endpointNotFound', { endpoint: operationId })}</WarningBox>\n }\n\n const normalizedMethod = entry.method.toUpperCase()\n return <OpenApiOperationComponent key={`${entry.source}-${normalizedMethod}-${entry.path}`} spec={spec} path={entry.path} method={normalizedMethod} operation={entry.operation} operationSource={entry.source} />\n}\n\nexport function OpenApiOperation(arg0: OpenApiOperationProps): ReactNode {\n const { specPath, operationId } = arg0\n const t = useBuiltInText()\n const { spec, loading } = useOpenApiSpec(undefined, specPath)\n\n if (loading) {\n return <WarningBox>{t('openapi.loading')}</WarningBox>\n }\n if (!spec) {\n return <WarningBox>{t('openapi.specNotFound', { specPath })}</WarningBox>\n }\n\n return <OpenApiOperationWithSpec spec={spec} operationId={operationId} />\n}\n\nexport function OpenApiRequest(arg0: OpenApiRequestProps): ReactNode {\n const { specPath, operationId, requestExample } = arg0\n const t = useBuiltInText()\n const { spec, loading } = useOpenApiSpec(undefined, specPath)\n\n if (loading) return <WarningBox>{t('openapi.loading')}</WarningBox>\n if (!spec) return <WarningBox>{t('openapi.specNotFound', { specPath })}</WarningBox>\n\n const entry = getOpenApiOperationEntryById(spec, operationId)\n if (!entry) return <WarningBox tone=\"red\">{t('openapi.endpointNotFound', { endpoint: operationId })}</WarningBox>\n\n return (\n <OpenApiRequestWorkbench\n spec={spec}\n path={entry.path}\n method={entry.method.toUpperCase()}\n operation={entry.operation}\n operationSource={entry.source}\n requestExample={requestExample}\n />\n )\n}\n\nexport function createOpenApiRouteComponent(data: OpenApiRouteData) {\n return function OpenApiRoutePage() {\n return <OpenApiDocument spec={data.spec} />\n }\n}\n","import { Collapse } from '../components/Collapse'\nimport { Mermaid } from '../components/Mermaid'\nimport { OpenApiRequest, OpenApiDocument, OpenApiOperation } from '../openapi'\n\nimport * as mdxPrimitives from './primitives'\n\nconst builtInMDXComponents = {\n ...mdxPrimitives,\n Collapse,\n Mermaid,\n}\n\nconst builtInOpenAPIComponents = {\n OpenApiRequest,\n OpenApiDocument,\n OpenApiOperation,\n}\n\nexport function useMDXComponents(components: Record<string, unknown> = {}) {\n return {\n ...components,\n ...builtInMDXComponents,\n ...builtInOpenAPIComponents,\n }\n}\n","import type { ReactNode } from 'react'\n\nimport { Prose } from '../components/Prose'\n\nexport type DocShellProps = {\n title: string\n subtitle?: string\n children: ReactNode\n}\n\nexport function DocShell(arg0: DocShellProps) {\n const { title, subtitle, children } = arg0\n\n return (\n <main className=\"clarify-doc-shell min-h-screen bg-(--clarify-theme-tokens-colors-background) px-6 py-10 text-(--clarify-theme-tokens-colors-foreground) md:px-10\">\n <div className=\"mx-auto max-w-6xl\">\n <header className=\"mb-10\">\n <h1 className=\"text-3xl font-bold tracking-tight md:text-5xl\">{title}</h1>\n {subtitle ? <p className=\"mt-3 max-w-2xl text-(--clarify-ui-text-soft)\">{subtitle}</p> : null}\n </header>\n <Prose>{children}</Prose>\n </div>\n </main>\n )\n}\n"],"mappings":";;;;;;;;;;AAkBA,SAAS,uBAAuB,QAAqC;CACnE,MAAM,EAAE,SAAS;CAOjB,MAAM,YAAY;EALhB,UAAU;EACV,gBAAgB;EAChB,SAAS;EACT,cAAc;CAEE,EAAW,KAAK;CAClC,MAAM,eAAe,KAAK,SAAS,kBAAkB,KAAK,SAAS,aAAa,oBAAoB;CAGpG,OACE,oBAAC,kBAAD;EACE,OAAO,KAAK;EACZ,aAAa,KAAK;EAClB,SAAQ;EACR,UAAU,CACR;GAAE,OAAO;GAAW,OAAO,KAAK,YAAY;EAAU,GACtD;GAAE,OAAO;GAAQ,OAAO;EAAU,CACpC;EACc;EACd,gBAAgB,KAAK,UACnB,oBAAC,OAAD;GAAK,WAAU;aACZ,KAAK;EACH,CAAA,IACH;CACL,CAAA;AAEL;AAEA,SAAgB,iCAAiC,MAAwC;CACvF,OAAO,SAAS,6BAA6B;EAC3C,OAAO,oBAAC,wBAAD,EAA8B,KAAO,C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,OAAO,UAAU,aAAa;CAEtC,OACE,oBAAC,QAAD;EAAM,WAAU;YACd,qBAAC,OAAD;GAAK,WAAU;aAAf,CACE,qBAAC,UAAD;IAAQ,WAAU;cAAlB,CACE,oBAAC,MAAD;KAAI,WAAU;eAAiD;IAAU,CAAA,GACxE,WAAW,oBAAC,KAAD;KAAG,WAAU;eAAgD;IAAY,CAAA,IAAI,IACnF;OACR,oBAAC,OAAD,EAAQ,SAAgB,CAAA,CACrB;;CACD,CAAA;AAEV"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../source/app/ContentDiagnostic.tsx","../source/openapi/lib/spec-path.ts","../source/openapi/entry.tsx","../source/openapi/components/OpenApiLink.tsx","../source/mdx/components.ts","../source/mdx/DocShell.tsx"],"sourcesContent":["import type { ComponentType } from 'react'\n\nimport { RenderErrorPanel } from './RenderErrorPanel'\n\nexport type ContentDiagnosticKind = 'markdown' | 'markdown+jsx' | 'openapi' | 'route-load'\n\nexport type ContentDiagnostic = {\n kind: ContentDiagnosticKind\n title: string\n message: string\n details?: string\n filePath?: string\n}\n\ntype ContentDiagnosticPanelProps = {\n data: ContentDiagnostic\n}\n\nfunction ContentDiagnosticPanel(params: ContentDiagnosticPanelProps) {\n const { data } = params\n const typeLabels: Record<ContentDiagnosticKind, string> = {\n markdown: 'Markdown',\n 'markdown+jsx': 'MDX',\n openapi: 'OpenAPI',\n 'route-load': 'Route',\n }\n const typeLabel = typeLabels[data.kind]\n const detailsLabel = data.kind === 'markdown+jsx' || data.kind === 'markdown' ? 'Why it happened' : 'Details'\n const pathLabel = 'File'\n\n return (\n <RenderErrorPanel\n title={data.title}\n description={data.message}\n titleId=\"clarify-content-diagnostic-title\"\n metadata={[\n { label: pathLabel, value: data.filePath ?? 'Unknown' },\n { label: 'Type', value: typeLabel },\n ]}\n detailsLabel={detailsLabel}\n detailsContent={data.details ? (\n <pre className=\"max-h-(--clarify-error-details-max-height) overflow-auto whitespace-pre-wrap wrap-break-word font-mono\">\n {data.details}\n </pre>\n ) : null}\n />\n )\n}\n\nexport function createContentDiagnosticComponent(data: ContentDiagnostic): ComponentType {\n return function ContentDiagnosticComponent() {\n return <ContentDiagnosticPanel data={data} />\n }\n}\n","import { useEffect, useState } from 'react'\nimport { useLocation } from 'react-router-dom'\n\nimport { useConfig, useLocale, useOpenApiSpecs } from '../../core/context'\n\nimport type { OpenAPISpec } from './utils'\n\ntype OpenApiSpecResult = {\n spec: OpenAPISpec | null\n loading: boolean\n}\n\ntype OpenApiSpecModule = { default: OpenAPISpec } | OpenAPISpec\n\ntype LoadedSpecState = {\n loader?: () => Promise<OpenApiSpecModule>\n spec: OpenAPISpec | null\n}\n\nfunction isOpenApiSpecLoader(value: unknown): value is () => Promise<OpenApiSpecModule> {\n return typeof value === 'function'\n}\n\nfunction getLoadedSpec(value: OpenApiSpecModule): OpenAPISpec {\n return value && typeof value === 'object' && 'default' in value\n ? value.default\n : value\n}\n\nconst VIRTUAL_PREFIX = 'virtual:clarify-page/'\n\nfunction resolveRelativePath(fromDir: string, to: string): string {\n const parts = (fromDir + '/' + to).split('/').filter(Boolean)\n const stack: string[] = []\n for (const part of parts) {\n if (part === '..') {\n stack.pop()\n } else if (part !== '.') {\n stack.push(part)\n }\n }\n return stack.join('/')\n}\n\nfunction normalizeSpecPath(specPath: string, currentRoutePath?: string, routePrefix = ''): string {\n if (specPath.startsWith(VIRTUAL_PREFIX)) return specPath\n\n const normalizedRoutePrefix = routePrefix.replace(/^\\/+|\\/+$/g, '')\n const normalizedSpecPath = specPath.startsWith('/') && normalizedRoutePrefix && specPath.slice(1).startsWith(`${normalizedRoutePrefix}/`)\n ? '/' + specPath.slice(normalizedRoutePrefix.length + 2)\n : specPath\n\n if (normalizedSpecPath.startsWith('/')) {\n return VIRTUAL_PREFIX + normalizedSpecPath.replace(/^\\//, '')\n }\n const fromDir = currentRoutePath === '/' ? '' : currentRoutePath?.replace(/^\\//, '').replace(/\\/[^/]*$/, '') ?? ''\n const normalizedFromDir = normalizedRoutePrefix && fromDir.startsWith(`${normalizedRoutePrefix}/`)\n ? fromDir.slice(normalizedRoutePrefix.length + 1)\n : fromDir\n return VIRTUAL_PREFIX + resolveRelativePath(normalizedFromDir, normalizedSpecPath)\n}\n\n/**\n * Prefer a locale-qualified registry key for absolute specPath values, then\n * fall back to the normalized key. The CLI registers visible route aliases,\n * while relative paths already resolve through the current localized route.\n */\nfunction specModuleCandidates(moduleId: string, specPath: string, locale: string | undefined): string[] {\n const candidates: string[] = []\n if (locale && specPath.startsWith('/') && !specPath.startsWith(VIRTUAL_PREFIX)) {\n const rest = moduleId.slice(VIRTUAL_PREFIX.length)\n if (!rest.startsWith(`${locale}/`) && rest !== locale) candidates.push(`${VIRTUAL_PREFIX}${locale}/${rest}`)\n }\n candidates.push(moduleId)\n return candidates\n}\n\nexport function useOpenApiSpec(spec?: OpenAPISpec, specPath?: string): OpenApiSpecResult {\n const config = useConfig()\n const locale = useLocale()\n const specs = useOpenApiSpecs()\n const location = useLocation()\n const [loadedSpec, setLoadedSpec] = useState<LoadedSpecState>({ spec: null })\n const normalized = specPath ? normalizeSpecPath(specPath, location.pathname, config.routePrefix) : undefined\n const candidates = specPath && normalized ? specModuleCandidates(normalized, specPath, locale) : []\n const registryValue = candidates.map(candidate => specs[candidate]).find(Boolean)\n\n useEffect(() => {\n let cancelled = false\n\n if (!isOpenApiSpecLoader(registryValue)) return\n\n registryValue().then(module => {\n if (!cancelled) setLoadedSpec({ loader: registryValue, spec: getLoadedSpec(module) })\n }).catch(() => {\n if (!cancelled) setLoadedSpec({ loader: registryValue, spec: null })\n })\n\n return () => {\n cancelled = true\n }\n }, [registryValue])\n\n if (spec) return { spec, loading: false }\n if (!specPath) return { spec: null, loading: false }\n if (isOpenApiSpecLoader(registryValue)) {\n return loadedSpec.loader === registryValue\n ? { spec: loadedSpec.spec, loading: false }\n : { spec: null, loading: true }\n }\n return { spec: registryValue ?? null, loading: false }\n}\n","import type { ReactNode } from 'react'\n\nimport { PageActions } from '../app/PageActions'\nimport { Prose } from '../components/Prose'\nimport { useBuiltInText } from '../core/i18n'\nimport { Markdown } from '../mdx/Markdown'\n\nimport { OpenApiOperation as OpenApiOperationComponent } from './components/OpenApiOperation'\nimport { OpenApiRequestWorkbench } from './components/OpenApiRequest'\nimport { useOpenApiSpec } from './lib/spec-path'\nimport { getOpenApiOperationEntryById, listOpenApiOperations } from './lib/utils'\nimport type { OpenAPISpec } from './lib/utils'\n\ntype OpenApiPathsProps = { spec: OpenAPISpec; tagFilter?: string[] }\n\ntype OpenApiHeaderProps = { spec: OpenAPISpec }\n\ntype WarningBoxProps = {\n children: ReactNode\n tone?: 'amber' | 'red'\n}\n\nexport type OpenApiDocumentProps = {\n spec?: OpenAPISpec\n specPath?: string\n tagFilter?: string[]\n}\n\nexport type OpenApiRouteData = {\n spec: OpenAPISpec\n}\n\ntype OpenApiOperationWithSpecProps = {\n spec: OpenAPISpec\n operationId: string\n}\n\nexport type OpenApiOperationProps = {\n specPath: string\n operationId: string\n}\n\nexport type OpenApiRequestProps = OpenApiOperationProps & {\n requestExample?: string\n}\n\nfunction OpenApiHeader(arg0: OpenApiHeaderProps): ReactNode {\n const { spec } = arg0\n\n const t = useBuiltInText()\n return (\n <header className=\"clarify-openapi-header mb-16 border-b border-(--clarify-theme-tokens-colors-border) pb-8\">\n <p className=\"mb-3 text-xs/6 font-medium tracking-widest text-(--clarify-ui-accent-text) uppercase\">\n {t('openapi.openApiReference')}\n </p>\n <h1 className=\"clarify-page-title\">{spec.info?.title ?? t('openapi.apiDocumentation')}</h1>\n {spec.info?.description ? <Markdown className=\"lead mt-4 *:first:mt-0 *:last:mb-0\">{spec.info.description}</Markdown> : null}\n {spec.info?.version ? <p className=\"mt-4 text-sm text-(--clarify-ui-text-faint)\">{t('openapi.version', { version: spec.info.version })}</p> : null}\n </header>\n )\n}\n\nfunction operationMatchesTags(operationTags: string[] | undefined, filterTags: string[] | undefined): boolean {\n if (!filterTags?.length) return true\n return operationTags?.some(tag => filterTags.includes(tag)) ?? false\n}\n\nfunction OpenApiPaths(arg0: OpenApiPathsProps): ReactNode {\n const { spec, tagFilter } = arg0\n\n const entries = listOpenApiOperations(spec)\n .filter(({ operation }) => operationMatchesTags(operation.tags, tagFilter))\n .map(({ path, method, operation, source }) => ({\n path,\n method: method.toUpperCase(),\n operation,\n source,\n }))\n\n return (\n <div className=\"clarify-openai-endpoints divide-y divide-zinc-200/70 dark:divide-white/10\">\n {entries.map(({ path, method, operation, source }) => (\n <OpenApiOperationComponent key={`${source}-${method}-${path}`} spec={spec} path={path} method={method} operation={operation} operationSource={source} />\n ))}\n </div>\n )\n}\n\nfunction WarningBox(arg0: WarningBoxProps): ReactNode {\n const { children, tone = 'amber' } = arg0\n\n const classes = tone === 'red'\n ? 'rounded-lg border border-red-200 bg-red-50 p-4 text-sm text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-200'\n : 'rounded-lg border border-amber-200 bg-amber-50 p-4 text-sm text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200'\n\n return <div className={`clarify-warning ${classes}`}>{children}</div>\n}\n\nexport function OpenApiDocument(arg0: OpenApiDocumentProps): ReactNode {\n const { spec, specPath, tagFilter } = arg0\n const t = useBuiltInText()\n const { spec: resolved, loading } = useOpenApiSpec(spec, specPath)\n\n if (loading) {\n return <WarningBox>{t('openapi.loading')}</WarningBox>\n }\n if (!resolved) {\n return <WarningBox>{t('openapi.specNotFound', { specPath: specPath ?? t('openapi.specPathMissing') })}</WarningBox>\n }\n\n return (\n <article className=\"clarify-openapi-page relative flex h-full flex-col pt-16 pb-10\">\n <div className=\"clarify-page-actions mb-4 flex justify-end sm:absolute sm:top-16 sm:right-0 sm:mb-0\">\n <PageActions />\n </div>\n <Prose className=\"flex-auto\">\n <OpenApiHeader spec={resolved} />\n <OpenApiPaths spec={resolved} tagFilter={tagFilter} />\n </Prose>\n </article>\n )\n}\n\nfunction OpenApiOperationWithSpec(arg0: OpenApiOperationWithSpecProps): ReactNode {\n const { spec, operationId } = arg0\n const t = useBuiltInText()\n const entry = getOpenApiOperationEntryById(spec, operationId)\n\n if (!entry) {\n return <WarningBox tone=\"red\">{t('openapi.endpointNotFound', { endpoint: operationId })}</WarningBox>\n }\n\n const normalizedMethod = entry.method.toUpperCase()\n return <OpenApiOperationComponent key={`${entry.source}-${normalizedMethod}-${entry.path}`} spec={spec} path={entry.path} method={normalizedMethod} operation={entry.operation} operationSource={entry.source} />\n}\n\nexport function OpenApiOperation(arg0: OpenApiOperationProps): ReactNode {\n const { specPath, operationId } = arg0\n const t = useBuiltInText()\n const { spec, loading } = useOpenApiSpec(undefined, specPath)\n\n if (loading) {\n return <WarningBox>{t('openapi.loading')}</WarningBox>\n }\n if (!spec) {\n return <WarningBox>{t('openapi.specNotFound', { specPath })}</WarningBox>\n }\n\n return <OpenApiOperationWithSpec spec={spec} operationId={operationId} />\n}\n\nexport function OpenApiRequest(arg0: OpenApiRequestProps): ReactNode {\n const { specPath, operationId, requestExample } = arg0\n const t = useBuiltInText()\n const { spec, loading } = useOpenApiSpec(undefined, specPath)\n\n if (loading) return <WarningBox>{t('openapi.loading')}</WarningBox>\n if (!spec) return <WarningBox>{t('openapi.specNotFound', { specPath })}</WarningBox>\n\n const entry = getOpenApiOperationEntryById(spec, operationId)\n if (!entry) return <WarningBox tone=\"red\">{t('openapi.endpointNotFound', { endpoint: operationId })}</WarningBox>\n\n return (\n <OpenApiRequestWorkbench\n spec={spec}\n path={entry.path}\n method={entry.method.toUpperCase()}\n operation={entry.operation}\n operationSource={entry.source}\n requestExample={requestExample}\n />\n )\n}\n\nexport function createOpenApiRouteComponent(data: OpenApiRouteData) {\n return function OpenApiRoutePage() {\n return <OpenApiDocument spec={data.spec} />\n }\n}\n","import clsx from 'clsx'\nimport { ArrowRight } from 'lucide-react'\nimport type { ReactNode } from 'react'\n\nimport { LocalizedLink } from '../../components/LocalizedLink'\nimport { useConfig, useLocale } from '../../core/context'\nimport { useBuiltInText } from '../../core/i18n'\nimport { localizeHref, prefixHref } from '../../utils/href'\nimport { useOpenApiSpec } from '../lib/spec-path'\nimport { getOpenApiOperationEntryById, getOpenApiOperationSectionId } from '../lib/utils'\n\nimport { EndpointMethodBadge } from './EndpointMethodBadge'\n\nexport type OpenApiLinkProps = {\n specPath: string\n operationId: string\n href?: string\n inline?: boolean\n className?: string\n}\n\ntype OpenApiLinkViewProps = {\n href: string\n method: string\n path: string\n label: string\n className?: string\n}\n\nexport function OpenApiLink(arg0: OpenApiLinkProps): ReactNode {\n const { specPath, operationId, href: hrefOverride, inline = false, className } = arg0\n const config = useConfig()\n const locale = useLocale()\n const t = useBuiltInText()\n const { spec, loading } = useOpenApiSpec(undefined, specPath)\n\n if (loading) return <span className={className}>{t('openapi.loading')}</span>\n\n const entry = spec ? getOpenApiOperationEntryById(spec, operationId) : undefined\n if (!entry) return <span className={className}>{t('openapi.endpointNotFound', { endpoint: operationId })}</span>\n\n const sectionId = getOpenApiOperationSectionId(entry.operation) || operationId\n const targetPath = hrefOverride ?? specPath\n const href = `${prefixHref(localizeHref(targetPath, config, locale), config.routePrefix)}#${sectionId}`\n const method = entry.method.toUpperCase()\n const title = entry.operation.summary?.trim() || ''\n\n if (inline) return <OpenApiLinkInline href={href} method={method} path={entry.path} label={title || entry.path} className={className} />\n return <OpenApiLinkBlock href={href} method={method} path={entry.path} label={title} className={className} />\n}\n\nfunction OpenApiLinkInline(arg0: OpenApiLinkViewProps): ReactNode {\n const { href, method, label, className } = arg0\n\n return (\n <LocalizedLink\n href={href}\n className={clsx(\n 'clarify-openapi-link clarify-openapi-link-inline not-prose inline-flex max-w-full items-center gap-1.5 rounded-md bg-(--clarify-ui-active-background) py-px pr-1.5 pl-px align-[0.125em] text-(--clarify-theme-tokens-colors-foreground) no-underline transition-colors hover:bg-(--clarify-ui-accent-background) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary) focus-visible:ring-offset-2',\n className,\n )}\n aria-label={`${method}: ${label}`}\n >\n <EndpointMethodBadge method={method} compact />\n <span className=\"truncate text-[0.8125rem]/5 font-medium\">{label}</span>\n </LocalizedLink>\n )\n}\n\nfunction OpenApiLinkBlock(arg0: OpenApiLinkViewProps): ReactNode {\n const { href, method, path, label, className } = arg0\n\n return (\n <LocalizedLink\n href={href}\n className={clsx(\n 'clarify-openapi-link not-prose group flex w-full items-center gap-3 rounded-lg border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) px-3 py-3 no-underline transition-colors hover:border-(--clarify-ui-accent-border) hover:bg-(--clarify-ui-hover-background) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary) focus-visible:ring-offset-2',\n className,\n )}\n >\n <EndpointMethodBadge method={method} />\n <span className=\"min-w-0 flex-1\">\n <code className=\"block truncate bg-transparent p-0 font-mono text-sm/6 font-semibold text-(--clarify-theme-tokens-colors-foreground)\">{path}</code>\n {label ? <span className=\"mt-0.5 block truncate text-xs/5 text-(--clarify-ui-text-faint)\">{label}</span> : null}\n </span>\n <span className=\"flex size-8 shrink-0 items-center justify-center rounded-md text-(--clarify-ui-text-faint) transition-colors group-hover:bg-(--clarify-theme-tokens-colors-surface) group-hover:text-(--clarify-ui-accent-text)\">\n <ArrowRight aria-hidden=\"true\" className=\"size-4\" />\n </span>\n </LocalizedLink>\n )\n}\n","import { Collapse } from '../components/Collapse'\nimport { Mermaid } from '../components/Mermaid'\nimport { OpenApiRequest, OpenApiDocument, OpenApiLink, OpenApiOperation } from '../openapi'\n\nimport * as mdxPrimitives from './primitives'\n\nconst builtInMDXComponents = {\n ...mdxPrimitives,\n Collapse,\n Mermaid,\n}\n\nconst builtInOpenAPIComponents = {\n OpenApiLink,\n OpenApiRequest,\n OpenApiDocument,\n OpenApiOperation,\n}\n\nexport function useMDXComponents(components: Record<string, unknown> = {}) {\n return {\n ...components,\n ...builtInMDXComponents,\n ...builtInOpenAPIComponents,\n }\n}\n","import type { ReactNode } from 'react'\n\nimport { Prose } from '../components/Prose'\n\nexport type DocShellProps = {\n title: string\n subtitle?: string\n children: ReactNode\n}\n\nexport function DocShell(arg0: DocShellProps) {\n const { title, subtitle, children } = arg0\n\n return (\n <main className=\"clarify-doc-shell min-h-screen bg-(--clarify-theme-tokens-colors-background) px-6 py-10 text-(--clarify-theme-tokens-colors-foreground) md:px-10\">\n <div className=\"mx-auto max-w-6xl\">\n <header className=\"mb-10\">\n <h1 className=\"text-3xl font-bold tracking-tight md:text-5xl\">{title}</h1>\n {subtitle ? <p className=\"mt-3 max-w-2xl text-(--clarify-ui-text-soft)\">{subtitle}</p> : null}\n </header>\n <Prose>{children}</Prose>\n </div>\n </main>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,SAAS,uBAAuB,QAAqC;CACnE,MAAM,EAAE,SAAS;CAOjB,MAAM,YAAY;EALhB,UAAU;EACV,gBAAgB;EAChB,SAAS;EACT,cAAc;CAEE,EAAW,KAAK;CAClC,MAAM,eAAe,KAAK,SAAS,kBAAkB,KAAK,SAAS,aAAa,oBAAoB;CAGpG,OACE,oBAAC,kBAAD;EACE,OAAO,KAAK;EACZ,aAAa,KAAK;EAClB,SAAQ;EACR,UAAU,CACR;GAAE,OAAO;GAAW,OAAO,KAAK,YAAY;EAAU,GACtD;GAAE,OAAO;GAAQ,OAAO;EAAU,CACpC;EACc;EACd,gBAAgB,KAAK,UACnB,oBAAC,OAAD;GAAK,WAAU;aACZ,KAAK;EACH,CAAA,IACH;CACL,CAAA;AAEL;AAEA,SAAgB,iCAAiC,MAAwC;CACvF,OAAO,SAAS,6BAA6B;EAC3C,OAAO,oBAAC,wBAAD,EAA8B,KAAO,CAAA;CAC9C;AACF;;;AClCA,SAAS,oBAAoB,OAA2D;CACtF,OAAO,OAAO,UAAU;AAC1B;AAEA,SAAS,cAAc,OAAuC;CAC5D,OAAO,SAAS,OAAO,UAAU,YAAY,aAAa,QACtD,MAAM,UACN;AACN;AAEA,IAAM,iBAAiB;AAEvB,SAAS,o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B,GAAG;CACH;CACA;AACF;AAEA,IAAM,2BAA2B;CAC/B;CACA;CACA;CACA;AACF;AAEA,SAAgB,iBAAiB,aAAsC,CAAC,GAAG;CACzE,OAAO;EACL,GAAG;EACH,GAAG;EACH,GAAG;CACL;AACF;;;ACfA,SAAgB,SAAS,MAAqB;CAC5C,MAAM,EAAE,OAAO,UAAU,aAAa;CAEtC,OACE,oBAAC,QAAD;EAAM,WAAU;YACd,qBAAC,OAAD;GAAK,WAAU;aAAf,CACE,qBAAC,UAAD;IAAQ,WAAU;cAAlB,CACE,oBAAC,MAAD;KAAI,WAAU;eAAiD;IAAU,CAAA,GACxE,WAAW,oBAAC,KAAD;KAAG,WAAU;eAAgD;IAAY,CAAA,IAAI,IACnF;OACR,oBAAC,OAAD,EAAQ,SAAgB,CAAA,CACrB;;CACD,CAAA;AAEV"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Collapse } from '../components/Collapse';
|
|
2
2
|
import { Mermaid } from '../components/Mermaid';
|
|
3
|
-
import { OpenApiRequest, OpenApiDocument, OpenApiOperation } from '../openapi';
|
|
3
|
+
import { OpenApiRequest, OpenApiDocument, OpenApiLink, OpenApiOperation } from '../openapi';
|
|
4
4
|
import * as mdxPrimitives from './primitives';
|
|
5
5
|
export declare function useMDXComponents(components?: Record<string, unknown>): {
|
|
6
|
+
OpenApiLink: typeof OpenApiLink;
|
|
6
7
|
OpenApiRequest: typeof OpenApiRequest;
|
|
7
8
|
OpenApiDocument: typeof OpenApiDocument;
|
|
8
9
|
OpenApiOperation: typeof OpenApiOperation;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { OpenApiRequest, OpenApiOperation, OpenApiDocument, createOpenApiRouteComponent } from './entry';
|
|
2
|
+
export { OpenApiLink, type OpenApiLinkProps } from './components/OpenApiLink';
|
|
2
3
|
export type { OpenApiRequestProps, OpenApiOperationProps, OpenApiDocumentProps, OpenApiRouteData } from './entry';
|
|
3
4
|
export type { OpenAPIOperation, OpenAPISpec } from './lib/utils';
|
package/output/preview.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_i18n = require("./i18n-Cjfk1N7i.cjs");
|
|
3
3
|
const require_PageActions = require("./PageActions-ob2OJusG.cjs");
|
|
4
|
-
const require_OpenApiOperation = require("./OpenApiOperation-
|
|
4
|
+
const require_OpenApiOperation = require("./OpenApiOperation-c-I6Nw9j.cjs");
|
|
5
5
|
let react = require("react");
|
|
6
6
|
let lucide_react = require("lucide-react");
|
|
7
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
package/output/preview.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ResponseExamplesPanel, c as getAuthOptions,
|
|
1
|
+
import { a as ResponseExamplesPanel, c as getAuthOptions, g as getRequestBody, h as getMediaTypeEntries, i as RequestExamplesPanel, l as getServerKey, o as authPlaceholder, s as defaultServerVariables, t as EndpointIdentity, u as getServers } from "./OpenApiOperation-Dv9u2GEJ.js";
|
|
2
2
|
import { i as OpenApiSpecsContext, n as ConfigContext, r as LocaleContext } from "./i18n-Cff810G_.js";
|
|
3
3
|
import { a as SectionProvider, i as Navigation } from "./PageActions-DviEypf6.js";
|
|
4
4
|
import { useState } from "react";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as ClarifyShell } from "./ClarifyShell-
|
|
1
|
+
import { t as ClarifyShell } from "./ClarifyShell-CKvXZj0f.js";
|
|
2
2
|
import { StrictMode } from "react";
|
|
3
3
|
import { BrowserRouter } from "react-router-dom";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -56,4 +56,4 @@ function render(options) {
|
|
|
56
56
|
//#endregion
|
|
57
57
|
export { render as t };
|
|
58
58
|
|
|
59
|
-
//# sourceMappingURL=render-
|
|
59
|
+
//# sourceMappingURL=render-B41PHjt8.js.map
|