Pre-alpha. No tagged release and no upgrade path between versions. Use for evaluation and development only, not production.
Core DevPre-alpha

Sum template (.sum.xml)

SWC includes a compile-time template language for addon and core components. Files use the .sum.xml extension and compile to TypeScript html tagged literals via the esbuild plugin in core/swc/esbuild.config.mjs.

When to use

ApproachUse when
html in .ts`Most field widgets and views (default)
.sum.xmlLarger templates with many conditionals or loops

Core views use html` directly; sum-template is optional for addon authors who prefer XML-like markup.

Directives

DirectiveCompiles to
t-if="expr"when(expr, () => html)
t-elif="expr"Chained when
t-elseElse branch of when
t-foreach="item in items" t-key="item.id"forEach(items, …)
t-esc="expr"${expr} (escaped)
t-raw="expr"${expr}
t-model="expr"Two-way @input + value bind
t-component="MyComponent"mountComponent(MyComponent, …)
t-ref="name"data-ref="name" attribute
t-portal="target"data-portal="target" attribute
t-slot="name"data-slot="name" attribute
{{ expr }}Interpolation

Example

MyPanel.sum.xml:

<div class="sum-my-panel">
  <div t-foreach="item in items" t-key="item.id">
    <span t-if="item.active">{{ item.name }}</span>
  </div>
</div>

Compiles to a TypeScript module exporting a template function used by SwcComponent.template().

Limitations

  • t-slot, t-portal, and t-ref emit data attributes only — there is no runtime slot-filling or portal API yet.
  • t-model is compile-time binding; no centralized v-model runtime.
  • Compiler lives in core/swc/src/template/sum/; tests in tests/template/sum-compiler.test.ts.

Build

Sum files are processed during make swc / npm run build in core/swc. Addon packages can copy the esbuild plugin from sum-compile.mjs.

See also