Generators

A generator is a back-end: it reads the Milda document and emits something concrete - real code for a framework, or a design file. Generators are where platform-specific decisions finally get made, and where a target says what it could not express.

#The React generator

The React generator is the one that ships first and defines the bar. It emits self-contained component source plus a shared theme - output you could read, review, and ship by hand, except you don't have to. It realizes:

  • Structure - neutral node kinds become the right elements.
  • Behavior - state machines become idiomatic React state and interaction.
  • Style - facets and foundations become a theme expressed as CSS custom properties.

The goal is a drop-in replacement for your existing components - matching API and behavior closely enough to swap in without rewrites.

#The Figma generator

Figma is a design target rather than a code target. It exports the foundations as Figma Variables with a mode per context and a W3C DTCG token file, and the components as component sets with variants and bound variables. The Figma plugin is a persistent bridge rather than a one-way dump: Milda stays the source, and the plugin re-syncs. Its output unit is the library, not the component, and it returns a list of what it skipped.

Built

Foundations export as Figma Variables and a W3C DTCG token file.proposal 0010

Built

Components export as component sets with variants and bound variables, through the Figma plugin, which is a persistent bridge rather than a one-way dump.proposal 0010

#One model, many back-ends

Every generator implements the same small contract: turn a document into files, and say what you could not express. A component target adds per-component emission, a theme and an icon module; a library target, like Figma, emits one artifact for the whole system. New targets slot in as additional back-ends without changing the document or the editor.

#What a target could not express

Each target reports its limits rather than approximating: the Figma target's skipped list, the React target's report of a constraint no type can say. foreign content is the author's side of the same honesty.

Partly built

Each target reports what it could not express (the Figma target’s skipped list, the React target’s constraint report). A single conformance checker over a document is not built.

#Realization differs per target

The same behavior can execute differently on different platforms, and the same facet token can resolve to a different value per platform. That divergence lives entirely in each generator's realization - never in the shared model. See The document.

Which generators a given project runs is controlled by its targets.