INNER CODE UNIT · TypeScript
containerName
f5/unovis · packages/mcp/src/codegen/index.ts:190
const containerName = (spec: ChartSpec): string => spec.container === 'xy' ? 'XYContainer' : 'SingleContainer'
const preamble = (emit: Emit, dataLiteral: string, includeEnumImport = false): string => {
const blocks: string[] = []
// Enums live in the core package even when components come from a wrapper
if (includeEnumImport && emit.enumImports.size) {
blocks.push(`import { ${[...emit.enumImports].sort().join(', ')} } from '@unovis/ts'`)
}
if (emit.mapImports.size) {
blocks.push(`import { ${[...emit.mapImports].join(', ')} } from '@unovis/ts/maps'`)
}
blocks.push(dataLiteral)
if (emit.helpers.length) blocks.push(emit.helpers.join('\n\n'))
return blocks.join('\n\n')
}
/** Vanilla TypeScript, using the imperative API */
function emitTs (spec: ChartSpec, emit: Emit): GeneratedFile {