INNER CODE UNIT · TypeScript

props

f5/unovis · packages/mcp/src/codegen/index.ts:214

    const props = c.props.map(p => `  ${p.name}: ${p.expr},`).join('\n')
    return { varName, code: `const ${varName} = new ${c.type}<DataRecord>({\n${props}\n})` }
  })

  const containerProps: string[] = []
  if (spec.container === 'xy') {
    containerProps.push(`components: [${componentVars.map(c => c.varName).join(', ')}]`)
    if (xAxis) containerProps.push(`xAxis: new Axis<DataRecord>({ ${xAxis.filter(p => p.name !== 'type').map(p => `${p.name}: ${p.expr}`).join(', ')} })`)
    if (yAxis) containerProps.push(`yAxis: new Axis<DataRecord>({ ${yAxis.filter(p => p.name !== 'type').map(p => `${p.name}: ${p.expr}`).join(', ')} })`)
  } else {
    containerProps.push(`component: ${componentVars[0].varName}`)
  }
  containerProps.push(`height: ${spec.height}`)

  const imports = ['Axis', containerName(spec), ...components.map(c => c.type), ...emit.enumImports]
    .filter((name, i, all) => all.indexOf(name) === i && (name !== 'Axis' || xAxis || yAxis))
    .sort()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…