@mosaicjs/core
v0.8.0
Published
The Mosaic core: the mosaic-jsx compiler, IR types, validate, resolve, the bounded expr evaluator, the modular block vocabulary (defineBlockSchema, createRegistry, macros), and the Host Manifest.
Readme
@mosaicjs/core
The framework-agnostic heart of Mosaic: the IR types, the Mosaic compiler (
Mosaic -> IR),validate,resolve, theexprevaluator,walk(), the block registry, and the Host Manifest.
Status: implemented. The compiler, the expr evaluator, validation, resolution, and walk() are real; every example in examples/ parses, validates, resolves, and round-trips through the canonical serialization under test.
This is the one package everything else depends on.
It absorbs what were separate @mosaicjs/wire (compile), @mosaicjs/schema (registry + validate), and @mosaicjs/host (manifest + theme) packages - the IR is small enough that splitting them added surface without value.
- IR -
MosaicNode,MosaicDocument,Directives,JsonLiteral(docs/proposal.md §4). - Compile -
parse/serialize(Mosaic -> IRand the IR's canonical JSON serialization);loadMosaic/saveMosaicread and write fenced.mosaicsource (§5). - expr -
evalExpr, the bounded CEL-class expression language behindfrom:expr/if:show/for:each(§6.2). AST-interpreted, nevereval. - walk -
walk(doc, visitor, manifest), the portable contract every framework implements (§7.2). - Manifest -
HostManifest,DEFAULT_MANIFEST,compactManifest(§3.3); plusTheme,DEFAULT_THEME, andresolveTokenfor renderers that take a token→value map.
A non-React framework imports from here and implements a NodeVisitor over the IR; @mosaicjs/react is the worked example.
