Noizu.Tessera.FromLit.Generator (Noizu.Tessera v0.2.0)

Copy Markdown View Source

Turns a Noizu.Tessera.FromLit.Extractor shape descriptor into a tessera component stub: the spec module (attr/prop/event/slot/cy DSL), a colocated Lit-based .mjs element template, and the WTR test skeleton.

Pure functions of their arguments (the Mix task only parses args and writes files), mirroring Noizu.Tessera.Scaffold. File layout and the WTR skeleton are reused from Scaffold.generate/3 so a converted component is indistinguishable from a scaffolded one.

Everything the contract grammar cannot represent is adapted LOUDLY (a warning + a comment in the generated file), never silently:

  • single-word / camelCase Lit event names are kebab-cased, and hyphen-less names are prefixed with the tag (close → <tag>-close);
  • Lit @state fields become commented-out state declarations (the element DSL is all-or-nothing: state + actions + template);
  • custom Lit attribute: names that differ from the snake→kebab wire name are flagged; complex (list/map) properties always ship as json: true props through tsr-props;
  • names that fail the snake_case grammar or the snake↔camel round-trip are skipped with a warning.

Summary

Functions

Builds the stub files for shape under host project root. Returns {files, warnings} where files is a list of {absolute_path, content} (the caller writes them). Raises CompileError when the tag violates the contract grammar.

Functions

generate(shape, module_name, root)

Builds the stub files for shape under host project root. Returns {files, warnings} where files is a list of {absolute_path, content} (the caller writes them). Raises CompileError when the tag violates the contract grammar.