arXiv:2512.20034cs.IR2025-12被引 1

让UI设计生成结构化代码,提升可维护性。

VSA:Visual-Structural Alignment for UI-to-Code

  • 通过视觉-结构对齐构建层级树,还原界面布局。
  • 识别重复界面模式并封装为可复用组件,提升模块化。
  • 生成类型安全、可直接用于生产的前端代码,适合工程落地。

用户界面自动化开发有望通过减少人工编码加速软件交付。尽管大型多模态模型在设计转代码方面取得进展,现有方法生成的代码大多结构松散,与 React、Angular 等组件化框架不兼容,导致耦合度高、内聚性差,难以长期维护。本文提出 VSA(Visual-Structural Alignment)多阶段范式,通过视觉-结构对齐生成组织化的前端资产。首先使用空间感知变压器将视觉输入重构为层次化树结构;进一步引入算法模式匹配层,识别常见 UI 模式并封装为模块化模板;最后通过基于模式的合成引擎,确保大语言模型生成类型安全、含属性传递的组件,适用于生产环境。实验表明,该框架在代码模块化与架构一致性上显著优于现有基准,有效弥合了像素输入与可扩展软件工程之间的差距。

原文摘要 · Abstract (English)

The automation of user interface development has the potential to accelerate software delivery by mitigating intensive manual implementation. Despite the advancements in Large Multimodal Models for design-to-code translation, existing methodologies predominantly yield unstructured, flat codebases that lack compatibility with component-oriented libraries such as React or Angular. Such outputs typically exhibit low cohesion and high coupling, complicating long-term maintenance. In this paper, we propose \textbf{VSA (VSA)}, a multi-stage paradigm designed to synthesize organized frontend assets through visual-structural alignment. Our approach first employs a spatial-aware transformer to reconstruct the visual input into a hierarchical tree representation. Moving beyond basic layout extraction, we integrate an algorithmic pattern-matching layer to identify recurring UI motifs and encapsulate them into modular templates. These templates are then processed via a schema-driven synthesis engine, ensuring the Large Language Model generates type-safe, prop-drilled components suitable for production environments. Experimental results indicate that our framework yields a substantial improvement in code modularity and architectural consistency over state-of-the-art benchmarks, effectively bridging the gap between raw pixels and scalable software engineering.

UI生成代码生成组件化

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。