werk

@facet/metacompiler (1.0.2)

Published 2026-07-26 20:23:25 +02:00 by amelie

Installation

@facet:registry=https://gitlab.amandy.love/api/packages/werk/npm/
npm install @facet/metacompiler@1.0.2
"@facet/metacompiler": "1.0.2"

About this package

Schema-Driven UI Compiler with AI Adapter Generation

@facet/metacompiler

A Schema-Driven UI Compiler for the Multifacett monorepo.

Core Concepts

Atoms (Base Elements)

Hand-written, dependency-free Web Components that follow a strict interface.

  • BButton: Brutalist button.
  • BTree: Drag & Drop tree view.
  • BWorkbench: Main editor shell.
  • BTabs: Tabbed navigation.
  • BGraph: Hybrid HTML/SVG node graph with panning and zooming.
  • BTerminal: Reusable terminal component.
  • BField: Headless pedagogical form field.
  • BMenu: Subtle menu system.

Manifests

The language of the compiler.

  • AtomManifest: Defines the properties and tag of an Atom.
  • CompositionManifest: Defines how Atoms (and other Compositions) are combined, and how data is mapped (Adapters).

UICompiler

A build-time tool that converts CompositionManifest into high-performance, native Web Components.

Usage

const compiler = new UICompiler();
compiler.registerBlueprint(buttonBlueprint);

const manifest: CompositionManifest = {
  id: 'UserCard',
  tier: 'molecule',
  props: { user: { type: 'object', required: true } },
  children: [
    { nodeId: 'avatar', blueprintId: 'core-image' },
    { nodeId: 'name', blueprintId: 'core-text' }
  ],
  propBindings: [
    { targetNodeId: 'name', targetProp: 'content', sourceExpression: 'props.user.name' }
  ]
};

const webComponentCode = compiler.compile(manifest);

AI Integration

The CompositionManifest and propBindings are designed to be generated by LLMs. By providing the AtomManifest as context, the AI can precisely map raw data to UI properties without needing to write complex DOM code.

Dependencies

Dependencies

ID Version
@facet/editor ^1.0.1
@facet/field ^1.0.0
@facet/menu ^1.0.0
@facet/tabs ^1.0.0
@facet/terminal ^1.0.0
@facet/treeview ^1.0.0
@facet/workbench ^1.0.1

Development Dependencies

ID Version
tsx ^4.21.0
typescript ^6.0.3
Details
npm
2026-07-26 20:23:25 +02:00
1
latest
13 KiB
Assets (1)
Versions (3) View all
1.0.2 2026-07-26
1.0.1 2026-07-26
1.0.0 2026-07-26