@contractkit/explorer-ui 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/html.ts","../src/markdown.ts","../src/render-tryit.ts","../src/constraints.ts","../src/render-model.ts","../src/render-type.ts","../src/render-operation.ts","../src/render.ts","../src/render-item.ts"],"sourcesContent":["/**\n * Minimal tagged-template helper for building HTML strings with automatic escaping.\n *\n * html`<p>${userInput}</p>` // escapes userInput\n * html`<ul>${raw(items.join(''))}</ul>` // bypasses escaping\n *\n * Interpolations are coerced to strings and HTML-escaped. Arrays are joined without a separator\n * after escaping each element. `raw(...)` marks a string as pre-escaped so it passes through.\n */\n\nconst RAW = Symbol('raw');\n\ninterface RawHtml {\n [RAW]: true;\n value: string;\n}\n\n/** Marks a string as already-escaped HTML so the {@link html} tag inserts it verbatim. */\nexport function raw(value: string): RawHtml {\n return { [RAW]: true, value };\n}\n\nfunction isRaw(value: unknown): value is RawHtml {\n return typeof value === 'object' && value !== null && (value as { [RAW]?: boolean })[RAW] === true;\n}\n\n/** Escapes the five HTML-significant characters (`& < > \" '`) so the input is safe to embed in markup. */\nexport function escapeHtml(value: string): string {\n return value\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&#39;');\n}\n\nfunction renderValue(value: unknown): string {\n if (value === null || value === undefined || value === false) return '';\n if (isRaw(value)) return value.value;\n if (Array.isArray(value)) return value.map(renderValue).join('');\n return escapeHtml(String(value));\n}\n\n/**\n * Tagged template literal that auto-escapes every interpolated value. Use {@link raw} to inject\n * pre-built HTML without double-escaping. `null`, `undefined`, and `false` interpolations render\n * as empty strings; arrays are flattened and each element is escaped (or passed through if `raw`).\n */\nexport function html(strings: TemplateStringsArray, ...values: unknown[]): string {\n let out = strings[0] ?? '';\n for (let i = 0; i < values.length; i++) {\n out += renderValue(values[i]) + (strings[i + 1] ?? '');\n }\n return out;\n}\n\n/** Slugify an arbitrary string for use in anchor ids — keeps a-z, 0-9, dashes; collapses everything else. */\nexport function slug(value: string): string {\n return value\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '');\n}\n","import { escapeHtml } from './html.js';\n\n/**\n * Minimal block + inline Markdown renderer used for `description:` fields in models and operations.\n * Supports paragraphs, headings, fenced code blocks, inline code, **bold**, *italic*, [links](url),\n * unordered lists (`-` or `*` bullets), and ordered lists. Anything else passes through as text.\n *\n * Intentionally small (~80 LOC) so the webview bundle stays lean. For richer needs we can swap to\n * `marked` later — the API matches.\n */\nexport function renderMarkdown(input: string): string {\n if (!input) return '';\n const lines = input.replace(/\\r\\n/g, '\\n').split('\\n');\n const out: string[] = [];\n let i = 0;\n\n while (i < lines.length) {\n const line = lines[i] ?? '';\n\n // Fenced code block\n const fence = /^```(\\w*)\\s*$/.exec(line);\n if (fence) {\n const lang = fence[1] ?? '';\n const buf: string[] = [];\n i++;\n while (i < lines.length && !/^```\\s*$/.test(lines[i] ?? '')) {\n buf.push(lines[i] ?? '');\n i++;\n }\n i++; // skip closing fence\n const langAttr = lang ? ` data-lang=\"${escapeHtml(lang)}\"` : '';\n out.push(`<pre class=\"ce-code\"${langAttr}><code>${escapeHtml(buf.join('\\n'))}</code></pre>`);\n continue;\n }\n\n // Heading\n const heading = /^(#{1,6})\\s+(.+)$/.exec(line);\n if (heading) {\n const level = heading[1]!.length;\n out.push(`<h${level}>${renderInline(heading[2]!)}</h${level}>`);\n i++;\n continue;\n }\n\n // Unordered list\n if (/^\\s*[-*]\\s+/.test(line)) {\n const items: string[] = [];\n while (i < lines.length && /^\\s*[-*]\\s+/.test(lines[i] ?? '')) {\n items.push(renderInline((lines[i] ?? '').replace(/^\\s*[-*]\\s+/, '')));\n i++;\n }\n out.push(`<ul>${items.map(t => `<li>${t}</li>`).join('')}</ul>`);\n continue;\n }\n\n // Ordered list\n if (/^\\s*\\d+\\.\\s+/.test(line)) {\n const items: string[] = [];\n while (i < lines.length && /^\\s*\\d+\\.\\s+/.test(lines[i] ?? '')) {\n items.push(renderInline((lines[i] ?? '').replace(/^\\s*\\d+\\.\\s+/, '')));\n i++;\n }\n out.push(`<ol>${items.map(t => `<li>${t}</li>`).join('')}</ol>`);\n continue;\n }\n\n // Blank → paragraph break\n if (line.trim() === '') {\n i++;\n continue;\n }\n\n // Paragraph (consume consecutive non-blank, non-special lines)\n const buf: string[] = [line];\n i++;\n while (i < lines.length) {\n const next = lines[i] ?? '';\n if (next.trim() === '' || /^```/.test(next) || /^#{1,6}\\s/.test(next) || /^\\s*[-*]\\s/.test(next) || /^\\s*\\d+\\.\\s/.test(next)) break;\n buf.push(next);\n i++;\n }\n out.push(`<p>${renderInline(buf.join(' '))}</p>`);\n }\n\n return out.join('\\n');\n}\n\nfunction renderInline(text: string): string {\n // First escape, then re-introduce supported inline patterns.\n let s = escapeHtml(text);\n\n // Inline code: `code`\n s = s.replace(/`([^`]+)`/g, (_m, code: string) => `<code>${code}</code>`);\n\n // Bold: **text**\n s = s.replace(/\\*\\*([^*]+)\\*\\*/g, '<strong>$1</strong>');\n\n // Italic: *text* (single asterisks, no other asterisks inside)\n s = s.replace(/(^|[^*])\\*([^*\\s][^*]*?)\\*(?!\\*)/g, (_m, before: string, body: string) => `${before}<em>${body}</em>`);\n\n // Links: [text](url) — only http(s) URLs to avoid `javascript:` injection.\n s = s.replace(/\\[([^\\]]+)\\]\\((https?:\\/\\/[^)\\s]+)\\)/g, (_m, label: string, url: string) => {\n return `<a href=\"${url}\" rel=\"noopener noreferrer\">${label}</a>`;\n });\n\n return s;\n}\n","import type { OpParamNode, ParamSource } from '@contractkit/core';\nimport { escapeHtml } from './html.js';\nimport type { ResolvedOperation } from './types.js';\nimport { operationAnchor } from './render-operation.js';\n\n/**\n * Renders an interactive \"Try it\" form for an operation. The form collects path params, query\n * params, headers, and a JSON body, then dispatches via the host (extension or page script) on\n * submit. The host listens for `data-tryit-action=\"send\"` clicks via event delegation.\n */\nexport function renderTryIt(op: ResolvedOperation, baseUrl: string): string {\n const id = operationAnchor(op);\n const pathParams = extractParams(op.routeParams);\n const queryParams = extractParams(op.op.query);\n const headerParams = extractParams(op.op.headers);\n const hasJsonBody = !!op.op.request?.bodies.some(\n b => b.contentType === 'application/json' || b.contentType.endsWith('+json'),\n );\n\n return `<details class=\"ce-tryit\" data-tryit-id=\"${escapeHtml(id)}\">\n <summary>Try it</summary>\n <form class=\"ce-tryit-form\" onsubmit=\"return false;\">\n <label class=\"ce-tryit-row\">\n <span class=\"ce-tryit-label\">Base URL</span>\n <input type=\"text\" name=\"baseUrl\" value=\"${escapeHtml(baseUrl)}\" placeholder=\"https://api.example.com\" />\n </label>\n ${renderInputSection('Path params', 'path', pathParams)}\n ${renderInputSection('Query', 'query', queryParams)}\n ${renderInputSection('Headers', 'header', headerParams)}\n ${\n hasJsonBody\n ? `<label class=\"ce-tryit-row ce-tryit-col\">\n <span class=\"ce-tryit-label\">Body (JSON)</span>\n <textarea name=\"body\" rows=\"6\" placeholder=\"{}\"></textarea>\n </label>`\n : ''\n }\n <div class=\"ce-tryit-actions\">\n <button type=\"button\" class=\"ce-tryit-send\" data-tryit-action=\"send\" data-tryit-target=\"${escapeHtml(id)}\">\n Send ${escapeHtml(op.method.toUpperCase())} ${escapeHtml(op.routePath)}\n </button>\n </div>\n <div class=\"ce-tryit-response\" data-tryit-response=\"${escapeHtml(id)}\"></div>\n </form>\n </details>`;\n}\n\nfunction extractParams(source: ParamSource | undefined): OpParamNode[] {\n if (!source || source.kind !== 'params') return [];\n return source.nodes;\n}\n\nfunction renderInputSection(label: string, scope: 'path' | 'query' | 'header', params: OpParamNode[]): string {\n if (params.length === 0) return '';\n const rows = params\n .map(\n p => `<label class=\"ce-tryit-row\">\n <span class=\"ce-tryit-label\"><code>${escapeHtml(p.name)}</code>${p.optional ? '' : ' *'}</span>\n <input type=\"text\"\n name=\"${scope}.${escapeHtml(p.name)}\"\n placeholder=\"${escapeHtml(typeHint(p))}\"\n ${p.default !== undefined ? `value=\"${escapeHtml(String(p.default))}\"` : ''} />\n </label>`,\n )\n .join('');\n return `<fieldset class=\"ce-tryit-section\"><legend>${escapeHtml(label)}</legend>${rows}</fieldset>`;\n}\n\nfunction typeHint(p: OpParamNode): string {\n if (p.type.kind === 'scalar') return p.type.name;\n return p.type.kind;\n}\n","import type { ScalarTypeNode } from '@contractkit/core';\n\n/** Formats the constraint parameters on a scalar type (min/max/len/regex/format) as a parenthesized suffix. */\nexport function constraintSummary(scalar: ScalarTypeNode): string {\n const parts: string[] = [];\n if (scalar.min !== undefined) parts.push(`min=${scalar.min}`);\n if (scalar.max !== undefined) parts.push(`max=${scalar.max}`);\n if (scalar.len !== undefined) parts.push(`len=${scalar.len}`);\n if (scalar.regex !== undefined) parts.push(`regex=/${scalar.regex}/`);\n if (scalar.format !== undefined) parts.push(`format=${scalar.format}`);\n return parts.length > 0 ? `(${parts.join(', ')})` : '';\n}\n","import type { FieldNode } from '@contractkit/core';\nimport { escapeHtml, html, raw } from './html.js';\nimport { renderMarkdown } from './markdown.js';\nimport { renderType } from './render-type.js';\nimport type { RenderContext, ResolvedModel } from './types.js';\n\n/** Anchor id for a model, used by `<a href=\"#model-Name\">` ref links. */\nexport function modelAnchor(name: string): string {\n return `model-${encodeURIComponent(name)}`;\n}\n\n/** Renders a model card: header, badges, inheritance line, fields (or type alias). */\nexport function renderModel({ filePath, model }: ResolvedModel, ctx: RenderContext = {}): string {\n const badges: string[] = [];\n if (model.deprecated) badges.push(badge('deprecated', 'deprecated'));\n if (model.mode) badges.push(badge(`mode=${model.mode}`, 'mode'));\n if (model.inputCase) badges.push(badge(`format(input=${model.inputCase})`, 'format'));\n if (model.outputCase) badges.push(badge(`format(output=${model.outputCase})`, 'format'));\n\n // Suppress re-expansion of the model itself when its fields contain a self-reference.\n const fieldCtx: RenderContext = {\n ...ctx,\n visited: new Set([...(ctx.visited ?? []), model.name]),\n };\n\n const inheritance =\n model.bases && model.bases.length > 0\n ? `<p class=\"ce-extends\">extends ${model.bases\n .map(b => `<a class=\"ce-ref\" href=\"#model-${encodeURIComponent(b)}\" data-open-model=\"${escapeHtml(b)}\">${escapeHtml(b)}</a>`)\n .join(', ')}</p>`\n : '';\n\n const description = model.description\n ? `<div class=\"ce-description ce-markdown\">${renderMarkdown(model.description)}</div>`\n : '';\n\n const body = model.type\n ? `<div class=\"ce-type-alias\">= ${renderType(model.type, fieldCtx)}</div>`\n : renderFieldRows(model.fields, fieldCtx);\n\n return html`<section id=\"${raw(modelAnchor(model.name))}\" class=\"ce-card ce-model-card\">\n <header class=\"ce-card-header\">\n <h2>\n ${model.name}\n ${raw(badges.join(''))}\n <button\n class=\"ce-jump\"\n data-jump-file=\"${filePath}\"\n data-jump-line=\"${model.loc.line}\"\n title=\"Open in editor\"\n type=\"button\"\n >\n ↗\n </button>\n </h2>\n </header>\n ${raw(inheritance)}\n ${raw(description)}\n ${raw(body)}\n </section>`;\n}\n\n/** Renders a tabular view of fields with name/type/modifiers/default/description. Exported for reuse by inline-object rendering. */\nexport function renderFieldRows(fields: FieldNode[], ctx: RenderContext = {}): string {\n if (fields.length === 0) return `<p class=\"ce-empty\">No fields.</p>`;\n\n const rows = fields.map(f => {\n const modifiers: string[] = [];\n if (f.optional) modifiers.push('optional');\n if (f.nullable) modifiers.push('nullable');\n if (f.visibility === 'readonly') modifiers.push('readonly');\n if (f.visibility === 'writeonly') modifiers.push('writeonly');\n if (f.deprecated) modifiers.push('deprecated');\n if (f.override) modifiers.push('override');\n\n const modifierHtml = modifiers.map(m => badge(m, m)).join('');\n const defaultHtml =\n f.default !== undefined\n ? html`<code class=\"ce-default\">= ${String(f.default)}</code>`\n : '';\n const descHtml = f.description ? `<div class=\"ce-field-desc ce-markdown\">${renderMarkdown(f.description)}</div>` : '';\n\n return `<tr>\n <td class=\"ce-field-name\"><code>${escapeHtml(f.name)}</code>${modifierHtml}</td>\n <td class=\"ce-field-type\">${renderType(f.type, ctx)}${defaultHtml}${descHtml}</td>\n </tr>`;\n });\n\n return `<table class=\"ce-fields\"><tbody>${rows.join('')}</tbody></table>`;\n}\n\nfunction badge(label: string, kind: string): string {\n return `<span class=\"ce-badge ce-badge-${escapeHtml(kind)}\">${escapeHtml(label)}</span>`;\n}\n","import type { ContractTypeNode } from '@contractkit/core';\nimport { escapeHtml } from './html.js';\nimport { constraintSummary } from './constraints.js';\nimport { renderFieldRows } from './render-model.js';\nimport type { RenderContext } from './types.js';\n\nconst DEFAULT_MAX_DEPTH = 4;\n\n/**\n * Recursively renders a ContractTypeNode as inline HTML.\n *\n * When `ctx.models` is provided, `ref` types render as collapsible `<details>` containing the\n * referenced model's fields. `ctx.visited` (set internally) prevents infinite recursion on\n * self-referential models. Past `ctx.maxDepth` (default 4) refs collapse to plain links.\n */\nexport function renderType(type: ContractTypeNode, ctx: RenderContext = {}): string {\n switch (type.kind) {\n case 'scalar': {\n const constraint = constraintSummary(type);\n const constraintHtml = constraint\n ? `<span class=\"ce-type-constraint\">${escapeHtml(constraint)}</span>`\n : '';\n return `<span class=\"ce-type-scalar\">${escapeHtml(type.name)}${constraintHtml}</span>`;\n }\n case 'enum':\n return `<span class=\"ce-type-enum\">enum(${type.values.map(escapeHtml).join(', ')})</span>`;\n case 'literal':\n return `<span class=\"ce-type-literal\">${escapeHtml(\n typeof type.value === 'string' ? `\"${type.value}\"` : String(type.value),\n )}</span>`;\n case 'ref':\n return renderRef(type.name, ctx);\n case 'array':\n return `${tok('Array&lt;')}${renderType(type.item, ctx)}${tok('&gt;')}`;\n case 'tuple':\n return `${tok('[')}${type.items.map(t => renderType(t, ctx)).join(tok(', '))}${tok(']')}`;\n case 'record':\n return `${tok('Record&lt;')}${renderType(type.key, ctx)}${tok(', ')}${renderType(type.value, ctx)}${tok('&gt;')}`;\n case 'union':\n return type.members.map(m => renderType(m, ctx)).join(tok(' | '));\n case 'discriminatedUnion':\n return (\n `${tok(`Union by ${escapeHtml(type.discriminator)}:`)} ` +\n type.members.map(m => renderType(m, ctx)).join(tok(' | '))\n );\n case 'intersection':\n return type.members.map(m => renderType(m, ctx)).join(tok(' &amp; '));\n case 'lazy':\n return `${tok('Lazy&lt;')}${renderType(type.inner, ctx)}${tok('&gt;')}`;\n case 'inlineObject':\n return `<details class=\"ce-inline-object\"><summary>${tok('{ … }')}</summary>${renderFieldRows(type.fields, ctx)}</details>`;\n }\n}\n\nfunction renderRef(name: string, ctx: RenderContext): string {\n const encName = encodeURIComponent(name);\n const safeName = escapeHtml(name);\n const entry = ctx.models?.get(name);\n const visited = ctx.visited ?? new Set<string>();\n const depth = ctx.depth ?? 0;\n const maxDepth = ctx.maxDepth ?? DEFAULT_MAX_DEPTH;\n\n if (!entry) {\n // Unknown model — render as a link that lets the host navigate to the dedicated page.\n return `<a class=\"ce-ref\" href=\"#model-${encName}\">${safeName}</a>`;\n }\n if (visited.has(name)) {\n return `<span class=\"ce-ref ce-ref-cycle\" title=\"recursive reference\">${safeName} ↺</span>`;\n }\n\n const model = entry.model;\n const jumpAttrs = `data-jump-file=\"${escapeHtml(entry.filePath)}\" data-jump-line=\"${model.loc.line}\"`;\n\n if (depth >= maxDepth) {\n return `<a class=\"ce-ref\" href=\"#model-${encName}\" ${jumpAttrs} title=\"Jump to source\">${safeName}</a>`;\n }\n\n const nextCtx: RenderContext = {\n models: ctx.models,\n visited: new Set([...visited, name]),\n maxDepth,\n depth: depth + 1,\n };\n\n const bases =\n model.bases && model.bases.length > 0\n ? `<p class=\"ce-extends\">extends ${model.bases\n .map(b => renderRef(b, nextCtx))\n .join(', ')}</p>`\n : '';\n\n const body = model.type\n ? `<div class=\"ce-type-alias\">= ${renderType(model.type, nextCtx)}</div>`\n : renderFieldRows(model.fields, nextCtx);\n\n const openButton = `<button class=\"ce-ref-open\" type=\"button\" ${jumpAttrs} title=\"Jump to source\">↗</button>`;\n\n return `<details class=\"ce-ref-expand\">\n <summary><span class=\"ce-ref-name\">${safeName}</span>${openButton}</summary>\n <div class=\"ce-ref-body\">${bases}${body}</div>\n </details>`;\n}\n\n/** Internal: render a structural separator/keyword. Caller is responsible for escaping `text`. */\nfunction tok(text: string): string {\n return `<span class=\"ce-type-token\">${text}</span>`;\n}\n","import type {\n OpParamNode,\n OpRequestBodyNode,\n OpResponseHeaderNode,\n OpResponseNode,\n ParamSource,\n SecurityNode,\n} from '@contractkit/core';\nimport { escapeHtml, html, raw } from './html.js';\nimport { renderMarkdown } from './markdown.js';\nimport { renderTryIt } from './render-tryit.js';\nimport { renderType } from './render-type.js';\nimport type { RenderContext, ResolvedOperation } from './types.js';\n\n/** Anchor id for an operation. Stable across renders so the sidebar can deep-link to it. */\nexport function operationAnchor(op: ResolvedOperation): string {\n const suffix = op.op.sdk ?? op.op.name ?? '';\n const slug = `${op.method}-${op.routePath}-${suffix}`.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '');\n return `op-${slug}`;\n}\n\n/** Options for {@link renderOperation}. */\nexport interface RenderOperationOptions {\n /** Base URL pre-filled into the Try-it form. Empty string when no base is configured. Omit to hide the Try-it form. */\n tryItBaseUrl?: string;\n /** Render context used to inline `ref` types as collapsible model expansions. */\n ctx?: RenderContext;\n}\n\n/**\n * Renders an operation card with header (method, path, badges, jump-to-source), description,\n * service/signature lines, parameter tables (path/query/headers), request body, responses,\n * plugin extensions, and an optional Try-it form when `options.tryItBaseUrl` is defined.\n */\nexport function renderOperation(op: ResolvedOperation, options: RenderOperationOptions = {}): string {\n const ctx = options.ctx ?? {};\n const badges: string[] = [];\n for (const m of op.effectiveModifiers) {\n badges.push(badge(m, m));\n }\n const securityBadge = renderSecurityBadge(op.effectiveSecurity);\n if (securityBadge) badges.push(securityBadge);\n\n const description = op.op.description\n ? `<div class=\"ce-description ce-markdown\">${renderMarkdown(op.op.description)}</div>`\n : '';\n const service = op.op.service ? html`<p class=\"ce-meta\"><strong>service:</strong> <code>${op.op.service}</code></p>` : '';\n const signature = op.op.signature\n ? html`<p class=\"ce-meta\"><strong>signature:</strong> <code>${op.op.signature}</code>${\n op.op.signatureDescription ? raw(` — ${escapeHtml(op.op.signatureDescription)}`) : ''\n }</p>`\n : '';\n\n const pathParams = renderParamSection('Path params', op.routeParams, ctx);\n const queryParams = renderParamSection('Query', op.op.query, ctx);\n const headerParams = renderParamSection('Headers', op.op.headers, ctx);\n const requestBody = renderRequest(op.op.request, ctx);\n const responses = renderResponses(op.op.responses, ctx);\n const pluginExt = renderPluginExtensions(op.op.pluginExtensions);\n const tryIt = options.tryItBaseUrl !== undefined ? renderTryIt(op, options.tryItBaseUrl) : '';\n\n return html`<section id=\"${raw(operationAnchor(op))}\" class=\"ce-card ce-op-card\">\n <header class=\"ce-card-header\">\n <h2>\n <span class=\"ce-method ce-method-${raw(op.method)}\">${op.method.toUpperCase()}</span>\n <code class=\"ce-path\">${op.routePath}</code>\n ${raw(badges.join(''))}\n <button\n class=\"ce-jump\"\n data-jump-file=\"${op.filePath}\"\n data-jump-line=\"${op.op.loc.line}\"\n title=\"Open in editor\"\n type=\"button\"\n >\n ↗\n </button>\n </h2>\n ${op.op.name ? raw(`<p class=\"ce-op-name\">${escapeHtml(op.op.name)}</p>`) : ''}\n </header>\n ${raw(description)}\n ${raw(service)}\n ${raw(signature)}\n ${raw(pathParams)}\n ${raw(queryParams)}\n ${raw(headerParams)}\n ${raw(requestBody)}\n ${raw(responses)}\n ${raw(pluginExt)}\n ${raw(tryIt)}\n </section>`;\n}\n\nfunction renderSecurityBadge(security: SecurityNode | undefined): string {\n if (!security) return '';\n if (security === 'none') return badge('security: none', 'security-none');\n if (security.policy === false) return badge('security: bypassed', 'security-bypassed');\n if (typeof security.policy === 'string') return badge(`policy: ${security.policy}`, 'security-policy');\n return '';\n}\n\nfunction renderParamSection(label: string, source: ParamSource | undefined, ctx: RenderContext): string {\n if (!source) return '';\n if (source.kind === 'params') {\n if (source.nodes.length === 0) return '';\n return html`<section class=\"ce-subsection\">\n <h3>${label}</h3>\n ${raw(renderParamTable(source.nodes, ctx))}\n </section>`;\n }\n if (source.kind === 'ref') {\n return html`<section class=\"ce-subsection\">\n <h3>${label}</h3>\n <div>${raw(renderType({ kind: 'ref', name: source.name }, ctx))}</div>\n </section>`;\n }\n return html`<section class=\"ce-subsection\">\n <h3>${label}</h3>\n <div>${raw(renderType(source.node, ctx))}</div>\n </section>`;\n}\n\nfunction renderParamTable(params: OpParamNode[], ctx: RenderContext): string {\n const rows = params.map(p => {\n const modifiers: string[] = [];\n if (p.optional) modifiers.push('optional');\n if (p.nullable) modifiers.push('nullable');\n const modifierHtml = modifiers.map(m => badge(m, m)).join('');\n const defaultHtml = p.default !== undefined ? html`<code class=\"ce-default\">= ${String(p.default)}</code>` : '';\n const descHtml = p.description ? `<div class=\"ce-field-desc ce-markdown\">${renderMarkdown(p.description)}</div>` : '';\n return `<tr>\n <td class=\"ce-field-name\"><code>${escapeHtml(p.name)}</code>${modifierHtml}</td>\n <td class=\"ce-field-type\">${renderType(p.type, ctx)}${defaultHtml}${descHtml}</td>\n </tr>`;\n });\n return `<table class=\"ce-fields\"><tbody>${rows.join('')}</tbody></table>`;\n}\n\nfunction renderRequest(request: { bodies: OpRequestBodyNode[] } | undefined, ctx: RenderContext): string {\n if (!request || request.bodies.length === 0) return '';\n const blocks = request.bodies.map(body => {\n return `<div class=\"ce-body-block\">\n <p class=\"ce-content-type\"><code>${escapeHtml(body.contentType)}</code></p>\n <div>${renderType(body.bodyType, ctx)}</div>\n </div>`;\n });\n return `<section class=\"ce-subsection\"><h3>Request body</h3>${blocks.join('')}</section>`;\n}\n\nfunction renderResponses(responses: OpResponseNode[], ctx: RenderContext): string {\n if (responses.length === 0) return '';\n const blocks = responses.map(r => renderResponse(r, ctx));\n return `<section class=\"ce-subsection\"><h3>Responses</h3>${blocks.join('')}</section>`;\n}\n\nfunction renderResponse(response: OpResponseNode, ctx: RenderContext): string {\n const statusClass = `ce-status-${Math.floor(response.statusCode / 100)}xx`;\n const contentTypeHtml = response.contentType\n ? `<p class=\"ce-content-type\"><code>${escapeHtml(response.contentType)}</code></p>`\n : '';\n const bodyHtml = response.bodyType\n ? `<div>${renderType(response.bodyType, ctx)}</div>`\n : '<p class=\"ce-empty\">No body.</p>';\n const headersHtml = renderResponseHeaders(response.headers, ctx);\n return `<div class=\"ce-response-block\">\n <h4><span class=\"ce-status ${statusClass}\">${response.statusCode}</span></h4>\n ${contentTypeHtml}\n ${bodyHtml}\n ${headersHtml}\n </div>`;\n}\n\nfunction renderResponseHeaders(headers: OpResponseHeaderNode[] | undefined, ctx: RenderContext): string {\n if (!headers || headers.length === 0) return '';\n const rows = headers.map(h => {\n const optional = h.optional ? badge('optional', 'optional') : '';\n const desc = h.description ? `<div class=\"ce-field-desc ce-markdown\">${renderMarkdown(h.description)}</div>` : '';\n return `<tr>\n <td class=\"ce-field-name\"><code>${escapeHtml(h.name)}</code>${optional}</td>\n <td class=\"ce-field-type\">${renderType(h.type, ctx)}${desc}</td>\n </tr>`;\n });\n return `<h5>Headers</h5><table class=\"ce-fields\"><tbody>${rows.join('')}</tbody></table>`;\n}\n\nfunction renderPluginExtensions(ext: Record<string, unknown> | undefined): string {\n if (!ext || Object.keys(ext).length === 0) return '';\n const json = JSON.stringify(ext, null, 2);\n return html`<section class=\"ce-subsection\">\n <h3>Plugin extensions</h3>\n <details><summary>Show JSON</summary><pre class=\"ce-code\">${json}</pre></details>\n </section>`;\n}\n\nfunction badge(label: string, kind: string): string {\n return `<span class=\"ce-badge ce-badge-${escapeHtml(kind)}\">${escapeHtml(label)}</span>`;\n}\n","import { escapeHtml, html, raw } from './html.js';\nimport { operationAnchor, renderOperation } from './render-operation.js';\nimport { modelAnchor, renderModel } from './render-model.js';\nimport type { PreviewData, ResolvedOperation } from './types.js';\n\nconst METHOD_ORDER = ['get', 'post', 'put', 'patch', 'delete'] as const;\n\n/**\n * Renders the complete API explorer as an HTML fragment. Drop the result into a container\n * element (e.g. `root.innerHTML = renderApp(data)`) and pair with the package's `style.css`.\n */\nexport function renderApp(data: PreviewData): string {\n const warnings = renderWarnings(data.warnings);\n const overview = renderOverview(data);\n const sidebar = renderSidebar(data);\n const operations = sortOperations(data.operations);\n const opsHtml = operations.map(op => renderOperation(op)).join('');\n const modelsHtml = [...data.models]\n .sort((a, b) => a.model.name.localeCompare(b.model.name))\n .map(m => renderModel(m))\n .join('');\n\n return html`<div class=\"ce-layout\">\n ${raw(sidebar)}\n <main class=\"ce-detail\">\n ${raw(warnings)}\n ${raw(overview)}\n ${operations.length > 0 ? raw(`<section class=\"ce-section\"><h1 id=\"endpoints\">Endpoints</h1>${opsHtml}</section>`) : ''}\n ${data.models.length > 0 ? raw(`<section class=\"ce-section\"><h1 id=\"models\">Models</h1>${modelsHtml}</section>`) : ''}\n </main>\n </div>`;\n}\n\nfunction renderOverview(data: PreviewData): string {\n const { configMeta } = data;\n const description = configMeta.description\n ? html`<p class=\"ce-description\">${configMeta.description}</p>`\n : '';\n const servers =\n configMeta.servers && configMeta.servers.length > 0\n ? `<section class=\"ce-subsection\"><h3>Servers</h3><ul>${configMeta.servers\n .map(s => `<li><code>${escapeHtml(s.url)}</code>${s.description ? ` — ${escapeHtml(s.description)}` : ''}</li>`)\n .join('')}</ul></section>`\n : '';\n return html`<section id=\"overview\" class=\"ce-section ce-overview\">\n <h1>${configMeta.title}</h1>\n <p class=\"ce-version\">v${configMeta.version}</p>\n ${raw(description)}\n ${raw(servers)}\n </section>`;\n}\n\nfunction renderSidebar(data: PreviewData): string {\n const operations = sortOperations(data.operations);\n const groups = groupBy(operations, op => op.fileGroup);\n const groupKeys = [...groups.keys()].sort();\n\n const endpointGroups = groupKeys\n .map(key => {\n const items = groups\n .get(key)!\n .map(\n op =>\n `<li><a href=\"#${escapeHtml(operationAnchor(op))}\">\n <span class=\"ce-method ce-method-${escapeHtml(op.method)}\">${escapeHtml(op.method.toUpperCase())}</span>\n <span class=\"ce-sidebar-path\">${escapeHtml(op.routePath)}</span>\n </a></li>`,\n )\n .join('');\n return `<details open class=\"ce-sidebar-group\">\n <summary>${escapeHtml(key)}</summary>\n <ul>${items}</ul>\n </details>`;\n })\n .join('');\n\n const modelLinks = [...data.models]\n .sort((a, b) => a.model.name.localeCompare(b.model.name))\n .map(m => `<li><a href=\"#${escapeHtml(modelAnchor(m.model.name))}\">${escapeHtml(m.model.name)}</a></li>`)\n .join('');\n\n return `<aside class=\"ce-sidebar\">\n <nav>\n <section>\n <h4><a href=\"#overview\">Overview</a></h4>\n </section>\n ${operations.length > 0 ? `<section><h4><a href=\"#endpoints\">Endpoints</a></h4>${endpointGroups}</section>` : ''}\n ${data.models.length > 0 ? `<section><h4><a href=\"#models\">Models</a></h4><ul class=\"ce-model-list\">${modelLinks}</ul></section>` : ''}\n </nav>\n </aside>`;\n}\n\nfunction renderWarnings(warnings: PreviewData['warnings']): string {\n if (warnings.length === 0) return '';\n const items = warnings\n .map(w => `<li>${escapeHtml(w.message)}${w.file ? ` <code>${escapeHtml(w.file)}${w.line ? `:${w.line}` : ''}</code>` : ''}</li>`)\n .join('');\n return `<div class=\"ce-warnings\"><strong>${warnings.length} warning${warnings.length === 1 ? '' : 's'}</strong><ul>${items}</ul></div>`;\n}\n\nfunction sortOperations(operations: ResolvedOperation[]): ResolvedOperation[] {\n return [...operations].sort((a, b) => {\n const groupCmp = a.fileGroup.localeCompare(b.fileGroup);\n if (groupCmp !== 0) return groupCmp;\n const pathCmp = a.routePath.localeCompare(b.routePath);\n if (pathCmp !== 0) return pathCmp;\n return METHOD_ORDER.indexOf(a.method) - METHOD_ORDER.indexOf(b.method);\n });\n}\n\nfunction groupBy<T, K>(items: T[], keyFn: (item: T) => K): Map<K, T[]> {\n const out = new Map<K, T[]>();\n for (const item of items) {\n const key = keyFn(item);\n const arr = out.get(key);\n if (arr) arr.push(item);\n else out.set(key, [item]);\n }\n return out;\n}\n","import { escapeHtml, html, raw } from './html.js';\nimport { renderMarkdown } from './markdown.js';\nimport { operationAnchor, renderOperation } from './render-operation.js';\nimport { modelAnchor, renderModel } from './render-model.js';\nimport type { PreviewData, PreviewServer, RenderContext, ResolvedModel, ResolvedOperation } from './types.js';\n\n/** Discriminated union identifying which item the detail page should render. */\nexport type ItemSelection =\n | { kind: 'operation'; id: string }\n | { kind: 'model'; name: string }\n | { kind: 'overview' };\n\n/**\n * Renders a single-item detail page intended for a focused webview. Wraps `renderOperation` /\n * `renderModel` / an Overview block in a minimal shell — no sidebar (the consumer provides\n * navigation via a native tree view).\n */\n/** Options for {@link renderItemPage}. */\nexport interface RenderItemOptions {\n /** Base URL surfaced to the operation's Try-it form. Pass an empty string to render the form with no default; omit to hide the form. */\n tryItBaseUrl?: string;\n}\n\nexport function renderItemPage(data: PreviewData, selection: ItemSelection, options: RenderItemOptions = {}): string {\n const body = renderBody(data, selection, options);\n return html`<div class=\"ce-detail ce-detail-single\">${raw(body)}</div>`;\n}\n\nfunction renderBody(data: PreviewData, selection: ItemSelection, options: RenderItemOptions): string {\n if (selection.kind === 'overview') return renderOverviewPage(data);\n\n const ctx: RenderContext = { models: buildModelMap(data) };\n\n if (selection.kind === 'operation') {\n const op = data.operations.find(o => operationAnchor(o) === selection.id);\n if (!op) return renderMissing(`Operation \\`${selection.id}\\` is not in the current workspace.`);\n return renderOperation(op, { tryItBaseUrl: options.tryItBaseUrl, ctx });\n }\n\n const model = data.models.find(m => m.model.name === selection.name);\n if (!model) return renderMissing(`Model \\`${selection.name}\\` is not in the current workspace.`);\n return renderModel(model, ctx);\n}\n\nfunction buildModelMap(data: PreviewData): Map<string, ResolvedModel> {\n const out = new Map<string, ResolvedModel>();\n for (const entry of data.models) out.set(entry.model.name, entry);\n return out;\n}\n\nfunction renderOverviewPage(data: PreviewData): string {\n const { configMeta } = data;\n const description = configMeta.description\n ? `<div class=\"ce-description ce-markdown\">${renderMarkdown(configMeta.description)}</div>`\n : '';\n const servers = renderServersList(configMeta.servers);\n const stats = `<dl class=\"ce-stats\">\n <dt>Endpoints</dt><dd>${data.operations.length}</dd>\n <dt>Models</dt><dd>${data.models.length}</dd>\n </dl>`;\n\n return html`<section id=\"overview\" class=\"ce-section ce-overview\">\n <h1>${configMeta.title}</h1>\n <p class=\"ce-version\">v${configMeta.version}</p>\n ${raw(description)}\n ${raw(stats)}\n ${raw(servers)}\n <p class=\"ce-hint\">Pick an endpoint or model from the API Explorer in the sidebar to see details.</p>\n </section>`;\n}\n\nfunction renderServersList(servers: PreviewServer[] | undefined): string {\n if (!servers || servers.length === 0) return '';\n const items = servers\n .map(\n s =>\n `<li><code>${escapeHtml(s.url)}</code>${\n s.description ? ` — ${escapeHtml(s.description)}` : ''\n }</li>`,\n )\n .join('');\n return `<section class=\"ce-subsection\"><h3>Servers</h3><ul>${items}</ul></section>`;\n}\n\nfunction renderMissing(message: string): string {\n return `<section class=\"ce-card ce-missing\"><p class=\"ce-empty\">${escapeHtml(message)}</p></section>`;\n}\n\n/** Stable ids used by tree-view consumers to refer to operations and models. */\nexport const operationId = operationAnchor;\nexport const modelId = (name: string): string => modelAnchor(name);\n\n/**\n * Returns every selectable item in `data` as a flat list with its stable id paired with the\n * full resolved entry. Useful for building a navigation tree or a flat picker.\n */\nexport function listSelections(data: PreviewData): Array<\n | { kind: 'operation'; id: string; operation: ResolvedOperation }\n | { kind: 'model'; name: string; model: ResolvedModel }\n> {\n return [\n ...data.operations.map(operation => ({ kind: 'operation' as const, id: operationId(operation), operation })),\n ...data.models.map(model => ({ kind: 'model' as const, name: model.model.name, model })),\n ];\n}\n"],"mappings":";;;;AAUA,IAAMA,MAAMC,uBAAO,KAAA;AAQZ,SAASC,IAAIC,OAAa;AAC7B,SAAO;IAAE,CAACH,GAAAA,GAAM;IAAMG;EAAM;AAChC;AAFgBD;AAIhB,SAASE,MAAMD,OAAc;AACzB,SAAO,OAAOA,UAAU,YAAYA,UAAU,QAASA,MAA8BH,GAAAA,MAAS;AAClG;AAFSI;AAKF,SAASC,WAAWF,OAAa;AACpC,SAAOA,MACFG,QAAQ,MAAM,OAAA,EACdA,QAAQ,MAAM,MAAA,EACdA,QAAQ,MAAM,MAAA,EACd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pD,QAAME,QAAQ;gCACclC,KAAKa,WAAWsB,MAAM;6BACzBnC,KAAKU,OAAOyB,MAAM;;AAG3C,SAAO9B;cACGwB,WAAWO,KAAK;iCACGP,WAAWQ,OAAO;UACzC/B,IAAIwB,WAAAA,CAAAA;UACJxB,IAAI4B,KAAAA,CAAAA;UACJ5B,IAAI0B,OAAAA,CAAAA;;;AAGd;AAnBSxB;AAqBT,SAASyB,kBAAkBD,SAAoC;AAC3D,MAAI,CAACA,WAAWA,QAAQG,WAAW,EAAG,QAAO;AAC7C,QAAMG,QAAQN,QACTO,IACGC,CAAAA,MACI,aAAaC,WAAWD,EAAEE,GAAG,CAAA,UACzBF,EAAEV,cAAc,WAAMW,WAAWD,EAAEV,WAAW,CAAA,KAAM,EAAA,OACjD,EAEda,KAAK,EAAA;AACV,SAAO,sDAAsDL,KAAAA;AACjE;AAXSL;AAaT,SAASf,cAAc0B,SAAe;AAClC,SAAO,2DAA2DH,WAAWG,OAAAA,CAAAA;AACjF;AAFS1B;AAKF,IAAM2B,cAAc7B;AACpB,IAAM8B,UAAU,wBAACvB,SAAyBwB,YAAYxB,IAAAA,GAAtC;AAMhB,SAASyB,eAAehD,MAAiB;AAI5C,SAAO;OACAA,KAAKa,WAAW0B,IAAIU,CAAAA,eAAc;MAAE1C,MAAM;MAAsBU,IAAI4B,YAAYI,SAAAA;MAAYA;IAAU,EAAA;OACtGjD,KAAKU,OAAO6B,IAAIlB,CAAAA,WAAU;MAAEd,MAAM;MAAkBgB,MAAMF,MAAMA,MAAME;MAAMF;IAAM,EAAA;;AAE7F;AARgB2B;","names":["RAW","Symbol","raw","value","isRaw","escapeHtml","replace","renderValue","undefined","Array","isArray","map","join","String","html","strings","values","out","i","length","slug","toLowerCase","renderMarkdown","input","lines","replace","split","out","i","length","line","fence","exec","lang","buf","test","push","langAttr","escapeHtml","join","heading","level","renderInline","items","map","t","trim","next","text","s","_m","code","before","body","label","url","renderTryIt","op","baseUrl","id","operationAnchor","pathParams","extractParams","routeParams","queryParams","query","headerParams","headers","hasJsonBody","request","bodies","some","b","contentType","endsWith","escapeHtml","renderInputSection","method","toUpperCase","routePath","source","kind","nodes","label","scope","params","length","rows","map","p","name","optional","typeHint","default","undefined","String","join","type","constraintSummary","scalar","parts","min","undefined","push","max","len","regex","format","length","join","modelAnchor","name","encodeURIComponent","renderModel","filePath","model","ctx","badges","deprecated","push","badge","mode","inputCase","outputCase","fieldCtx","visited","Set","inheritance","bases","length","map","b","escapeHtml","join","description","renderMarkdown","body","type","renderType","renderFieldRows","fields","html","raw","loc","line","rows","f","modifiers","optional","nullable","visibility","override","modifierHtml","m","defaultHtml","default","undefined","String","descHtml","label","kind","DEFAULT_MAX_DEPTH","renderType","type","ctx","kind","constraint","constraintSummary","constraintHtml","escapeHtml","name","values","map","join","value","String","renderRef","tok","item","items","t","key","members","m","discriminator","inner","renderFieldRows","fields","encName","encodeURIComponent","safeName","entry","models","get","visited","Set","depth","maxDepth","has","model","jumpAttrs","filePath","loc","line","nextCtx","bases","length","b","body","openButton","text","operationAnchor","op","suffix","sdk","name","slug","method","routePath","toLowerCase","replace","renderOperation","options","ctx","badges","m","effectiveModifiers","push","badge","securityBadge","renderSecurityBadge","effectiveSecurity","description","renderMarkdown","service","html","signature","signatureDescription","raw","escapeHtml","pathParams","renderParamSection","routeParams","queryParams","query","headerParams","headers","requestBody","renderRequest","request","responses","renderResponses","pluginExt","renderPluginExtensions","pluginExtensions","tryIt","tryItBaseUrl","undefined","renderTryIt","toUpperCase","join","filePath","loc","line","security","policy","label","source","kind","nodes","length","renderParamTable","renderType","node","params","rows","map","p","modifiers","optional","nullable","modifierHtml","defaultHtml","default","String","descHtml","type","bodies","blocks","body","contentType","bodyType","r","renderResponse","response","statusClass","Math","floor","statusCode","contentTypeHtml","bodyHtml","headersHtml","renderResponseHeaders","h","desc","ext","Object","keys","json","JSON","stringify","METHOD_ORDER","renderApp","data","warnings","renderWarnings","overview","renderOverview","sidebar","renderSidebar","operations","sortOperations","opsHtml","map","op","renderOperation","join","modelsHtml","models","sort","a","b","model","name","localeCompare","m","renderModel","html","raw","length","configMeta","description","servers","s","escapeHtml","url","title","version","groups","groupBy","fileGroup","groupKeys","keys","endpointGroups","key","items","get","operationAnchor","method","toUpperCase","routePath","modelLinks","modelAnchor","w","message","file","line","groupCmp","pathCmp","indexOf","keyFn","out","Map","item","arr","push","set","renderItemPage","data","selection","options","body","renderBody","html","raw","kind","renderOverviewPage","ctx","models","buildModelMap","op","operations","find","o","operationAnchor","id","renderMissing","renderOperation","tryItBaseUrl","model","m","name","renderModel","out","Map","entry","set","configMeta","description","renderMarkdown","servers","renderServersList","stats","length","title","version","items","map","s","escapeHtml","url","join","message","operationId","modelId","modelAnchor","listSelections","operation"]}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Minimal block + inline Markdown renderer used for `description:` fields in models and operations.
3
+ * Supports paragraphs, headings, fenced code blocks, inline code, **bold**, *italic*, [links](url),
4
+ * unordered lists (`-` or `*` bullets), and ordered lists. Anything else passes through as text.
5
+ *
6
+ * Intentionally small (~80 LOC) so the webview bundle stays lean. For richer needs we can swap to
7
+ * `marked` later — the API matches.
8
+ */
9
+ export declare function renderMarkdown(input: string): string;
10
+ //# sourceMappingURL=markdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../src/markdown.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CA2EpD"}
@@ -0,0 +1,40 @@
1
+ import { operationAnchor } from './render-operation.js';
2
+ import type { PreviewData, ResolvedModel, ResolvedOperation } from './types.js';
3
+ /** Discriminated union identifying which item the detail page should render. */
4
+ export type ItemSelection = {
5
+ kind: 'operation';
6
+ id: string;
7
+ } | {
8
+ kind: 'model';
9
+ name: string;
10
+ } | {
11
+ kind: 'overview';
12
+ };
13
+ /**
14
+ * Renders a single-item detail page intended for a focused webview. Wraps `renderOperation` /
15
+ * `renderModel` / an Overview block in a minimal shell — no sidebar (the consumer provides
16
+ * navigation via a native tree view).
17
+ */
18
+ /** Options for {@link renderItemPage}. */
19
+ export interface RenderItemOptions {
20
+ /** Base URL surfaced to the operation's Try-it form. Pass an empty string to render the form with no default; omit to hide the form. */
21
+ tryItBaseUrl?: string;
22
+ }
23
+ export declare function renderItemPage(data: PreviewData, selection: ItemSelection, options?: RenderItemOptions): string;
24
+ /** Stable ids used by tree-view consumers to refer to operations and models. */
25
+ export declare const operationId: typeof operationAnchor;
26
+ export declare const modelId: (name: string) => string;
27
+ /**
28
+ * Returns every selectable item in `data` as a flat list with its stable id paired with the
29
+ * full resolved entry. Useful for building a navigation tree or a flat picker.
30
+ */
31
+ export declare function listSelections(data: PreviewData): Array<{
32
+ kind: 'operation';
33
+ id: string;
34
+ operation: ResolvedOperation;
35
+ } | {
36
+ kind: 'model';
37
+ name: string;
38
+ model: ResolvedModel;
39
+ }>;
40
+ //# sourceMappingURL=render-item.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-item.d.ts","sourceRoot":"","sources":["../src/render-item.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAmB,MAAM,uBAAuB,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAgC,aAAa,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE9G,gFAAgF;AAChF,MAAM,MAAM,aAAa,GACnB;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC;AAE3B;;;;GAIG;AACH,0CAA0C;AAC1C,MAAM,WAAW,iBAAiB;IAC9B,wIAAwI;IACxI,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,GAAE,iBAAsB,GAAG,MAAM,CAGnH;AA8DD,gFAAgF;AAChF,eAAO,MAAM,WAAW,wBAAkB,CAAC;AAC3C,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,KAAG,MAA2B,CAAC;AAEnE;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,GAAG,KAAK,CAClD;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,iBAAiB,CAAA;CAAE,GAC/D;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,aAAa,CAAA;CAAE,CAC1D,CAKA"}
@@ -0,0 +1,9 @@
1
+ import type { FieldNode } from '@contractkit/core';
2
+ import type { RenderContext, ResolvedModel } from './types.js';
3
+ /** Anchor id for a model, used by `<a href="#model-Name">` ref links. */
4
+ export declare function modelAnchor(name: string): string;
5
+ /** Renders a model card: header, badges, inheritance line, fields (or type alias). */
6
+ export declare function renderModel({ filePath, model }: ResolvedModel, ctx?: RenderContext): string;
7
+ /** Renders a tabular view of fields with name/type/modifiers/default/description. Exported for reuse by inline-object rendering. */
8
+ export declare function renderFieldRows(fields: FieldNode[], ctx?: RenderContext): string;
9
+ //# sourceMappingURL=render-model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-model.d.ts","sourceRoot":"","sources":["../src/render-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAInD,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE/D,yEAAyE;AACzE,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,sFAAsF;AACtF,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,aAAa,EAAE,GAAG,GAAE,aAAkB,GAAG,MAAM,CAgD/F;AAED,oIAAoI;AACpI,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,GAAG,GAAE,aAAkB,GAAG,MAAM,CA0BpF"}
@@ -0,0 +1,17 @@
1
+ import type { RenderContext, ResolvedOperation } from './types.js';
2
+ /** Anchor id for an operation. Stable across renders so the sidebar can deep-link to it. */
3
+ export declare function operationAnchor(op: ResolvedOperation): string;
4
+ /** Options for {@link renderOperation}. */
5
+ export interface RenderOperationOptions {
6
+ /** Base URL pre-filled into the Try-it form. Empty string when no base is configured. Omit to hide the Try-it form. */
7
+ tryItBaseUrl?: string;
8
+ /** Render context used to inline `ref` types as collapsible model expansions. */
9
+ ctx?: RenderContext;
10
+ }
11
+ /**
12
+ * Renders an operation card with header (method, path, badges, jump-to-source), description,
13
+ * service/signature lines, parameter tables (path/query/headers), request body, responses,
14
+ * plugin extensions, and an optional Try-it form when `options.tryItBaseUrl` is defined.
15
+ */
16
+ export declare function renderOperation(op: ResolvedOperation, options?: RenderOperationOptions): string;
17
+ //# sourceMappingURL=render-operation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-operation.d.ts","sourceRoot":"","sources":["../src/render-operation.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEnE,4FAA4F;AAC5F,wBAAgB,eAAe,CAAC,EAAE,EAAE,iBAAiB,GAAG,MAAM,CAI7D;AAED,2CAA2C;AAC3C,MAAM,WAAW,sBAAsB;IACnC,uHAAuH;IACvH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iFAAiF;IACjF,GAAG,CAAC,EAAE,aAAa,CAAC;CACvB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,iBAAiB,EAAE,OAAO,GAAE,sBAA2B,GAAG,MAAM,CAwDnG"}
@@ -0,0 +1,8 @@
1
+ import type { ResolvedOperation } from './types.js';
2
+ /**
3
+ * Renders an interactive "Try it" form for an operation. The form collects path params, query
4
+ * params, headers, and a JSON body, then dispatches via the host (extension or page script) on
5
+ * submit. The host listens for `data-tryit-action="send"` clicks via event delegation.
6
+ */
7
+ export declare function renderTryIt(op: ResolvedOperation, baseUrl: string): string;
8
+ //# sourceMappingURL=render-tryit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-tryit.d.ts","sourceRoot":"","sources":["../src/render-tryit.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGpD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAmC1E"}
@@ -0,0 +1,11 @@
1
+ import type { ContractTypeNode } from '@contractkit/core';
2
+ import type { RenderContext } from './types.js';
3
+ /**
4
+ * Recursively renders a ContractTypeNode as inline HTML.
5
+ *
6
+ * When `ctx.models` is provided, `ref` types render as collapsible `<details>` containing the
7
+ * referenced model's fields. `ctx.visited` (set internally) prevents infinite recursion on
8
+ * self-referential models. Past `ctx.maxDepth` (default 4) refs collapse to plain links.
9
+ */
10
+ export declare function renderType(type: ContractTypeNode, ctx?: RenderContext): string;
11
+ //# sourceMappingURL=render-type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-type.d.ts","sourceRoot":"","sources":["../src/render-type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAI1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAIhD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,gBAAgB,EAAE,GAAG,GAAE,aAAkB,GAAG,MAAM,CAqClF"}
@@ -0,0 +1,7 @@
1
+ import type { PreviewData } from './types.js';
2
+ /**
3
+ * Renders the complete API explorer as an HTML fragment. Drop the result into a container
4
+ * element (e.g. `root.innerHTML = renderApp(data)`) and pair with the package's `style.css`.
5
+ */
6
+ export declare function renderApp(data: PreviewData): string;
7
+ //# sourceMappingURL=render.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAqB,MAAM,YAAY,CAAC;AAIjE;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAoBnD"}
@@ -0,0 +1,65 @@
1
+ import type { HttpMethod, ModelNode, OpOperationNode, ParamSource, RouteModifier, SecurityNode } from '@contractkit/core';
2
+ /** Threaded through type/field renderers so a `ref` can lazily expand into the model's fields inline. */
3
+ export interface RenderContext {
4
+ /** Lookup table of model name → resolved model entry (carries `filePath` so refs can jump to source). */
5
+ models?: Map<string, ResolvedModel>;
6
+ /** Names already being expanded on this branch — prevents infinite recursion on self-referential models. */
7
+ visited?: ReadonlySet<string>;
8
+ /** Cap on how deep nested model expansions render. Past this depth, refs collapse to plain links. */
9
+ maxDepth?: number;
10
+ /** Current depth — incremented by the renderer on each `ref` descent. Callers should leave this at 0. */
11
+ depth?: number;
12
+ }
13
+ /** A single API server entry surfaced in the overview. */
14
+ export interface PreviewServer {
15
+ url: string;
16
+ description?: string;
17
+ }
18
+ /** Top-level API metadata rendered in the overview section. */
19
+ export interface PreviewConfigMeta {
20
+ title: string;
21
+ version: string;
22
+ description?: string;
23
+ servers?: PreviewServer[];
24
+ }
25
+ /** A non-fatal diagnostic captured while building {@link PreviewData}. */
26
+ export interface PreviewWarning {
27
+ message: string;
28
+ file?: string;
29
+ line?: number;
30
+ }
31
+ /** An operation with all cascade-resolved data the renderer needs to draw a card. */
32
+ export interface ResolvedOperation {
33
+ /** Absolute path of the source .ck file. */
34
+ filePath: string;
35
+ /** Sidebar grouping key — `ast.meta.area`, falling back to the file's relative path. */
36
+ fileGroup: string;
37
+ /** Path template (e.g. `/payments/{id}`). */
38
+ routePath: string;
39
+ method: HttpMethod;
40
+ /** Full operation node — carries `loc`, request/responses, plugins, etc. */
41
+ op: OpOperationNode;
42
+ /** Route-level params (path params) carried alongside the operation for rendering. */
43
+ routeParams?: ParamSource;
44
+ /** `resolveModifiers(route, op)` output — already excludes the synthetic `public` token. */
45
+ effectiveModifiers: RouteModifier[];
46
+ /** `resolveSecurity(route, op, root)` output. */
47
+ effectiveSecurity?: SecurityNode;
48
+ }
49
+ /** A model paired with the absolute path of the `.ck` file that declared it. */
50
+ export interface ResolvedModel {
51
+ filePath: string;
52
+ model: ModelNode;
53
+ }
54
+ /**
55
+ * Snapshot of an entire workspace's contracts and operations, pre-resolved so the renderer
56
+ * doesn't need to call into `@contractkit/core` at render time.
57
+ */
58
+ export interface PreviewData {
59
+ configMeta: PreviewConfigMeta;
60
+ workspaceRoot?: string;
61
+ operations: ResolvedOperation[];
62
+ models: ResolvedModel[];
63
+ warnings: PreviewWarning[];
64
+ }
65
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE1H,yGAAyG;AACzG,MAAM,WAAW,aAAa;IAC1B,yGAAyG;IACzG,MAAM,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACpC,4GAA4G;IAC5G,OAAO,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC9B,qGAAqG;IACrG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yGAAyG;IACzG,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,0DAA0D;AAC1D,MAAM,WAAW,aAAa;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,+DAA+D;AAC/D,MAAM,WAAW,iBAAiB;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,aAAa,EAAE,CAAC;CAC7B;AAED,0EAA0E;AAC1E,MAAM,WAAW,cAAc;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qFAAqF;AACrF,MAAM,WAAW,iBAAiB;IAC9B,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,wFAAwF;IACxF,SAAS,EAAE,MAAM,CAAC;IAClB,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,UAAU,CAAC;IACnB,4EAA4E;IAC5E,EAAE,EAAE,eAAe,CAAC;IACpB,sFAAsF;IACtF,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,4FAA4F;IAC5F,kBAAkB,EAAE,aAAa,EAAE,CAAC;IACpC,iDAAiD;IACjD,iBAAiB,CAAC,EAAE,YAAY,CAAC;CACpC;AAED,gFAAgF;AAChF,MAAM,WAAW,aAAa;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,SAAS,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IACxB,UAAU,EAAE,iBAAiB,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,iBAAiB,EAAE,CAAC;IAChC,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,QAAQ,EAAE,cAAc,EAAE,CAAC;CAC9B"}
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@contractkit/explorer-ui",
3
+ "version": "0.10.0",
4
+ "description": "ContractKit API explorer renderer — pure HTML output, themable via CSS custom properties",
5
+ "author": {
6
+ "name": "Marooned Software",
7
+ "url": "https://github.com/MaroonedSoftware/contractkit"
8
+ },
9
+ "bugs": {
10
+ "url": "https://github.com/MaroonedSoftware/contractkit/issues"
11
+ },
12
+ "homepage": "https://github.com/MaroonedSoftware/contractkit/packages/explorer-ui#readme",
13
+ "keywords": [
14
+ "contractkit",
15
+ "explorer",
16
+ "api-docs"
17
+ ],
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/MaroonedSoftware/contractkit.git"
21
+ },
22
+ "type": "module",
23
+ "main": "./dist/index.js",
24
+ "module": "./dist/index.js",
25
+ "types": "./dist/index.d.ts",
26
+ "exports": {
27
+ ".": "./dist/index.js",
28
+ "./style.css": "./dist/assets/style.css"
29
+ },
30
+ "files": [
31
+ "dist"
32
+ ],
33
+ "dependencies": {
34
+ "@contractkit/core": "0.18.0"
35
+ },
36
+ "devDependencies": {
37
+ "@repo/config-eslint": "0.3.1",
38
+ "@repo/config-typescript": "0.1.0"
39
+ },
40
+ "scripts": {
41
+ "build": "tsup src/index.ts --format esm --sourcemap --dts && tsc --emitDeclarationOnly --declaration && mkdir -p dist/assets && cp src/assets/style.css dist/assets/style.css",
42
+ "build:ci": "eslint --max-warnings=0 && pnpm run build",
43
+ "lint": "eslint --fix",
44
+ "format": "prettier --write .",
45
+ "test": "vitest run",
46
+ "test:ci": "vitest run --coverage"
47
+ }
48
+ }