locus

UI Lexical Mode & Location Metadata

Locus now performs a lightweight lexical pass for UI blocks before structural transformation. This enables:

What Exists Today

The UI parser (parseUi) pre-processes directive sugar ({#if}, {#each}, etc.) into temporary element tags, then performs a single pass building a raw tree. During this pass we record:

Consuming Locations

A helper buildUiCodeFrame(filePath, loc) (in src/cli/uiDiagnostics.ts) produces a simple code frame highlighting the element or attribute span. This is intended for use by future validation passes and error reporters.

import { buildUiCodeFrame } from '../cli/uiDiagnostics';

// given a node with .loc
console.log(buildUiCodeFrame('MyPage.locus', node.loc));

Event & Binding Warnings

Validation now issues warnings for:

Roadmap

CLI Aid

You can experiment quickly:

echo '<Button onClick="{doThing}">Hi</Button>' | locus ui:ast

This prints the structured UI AST including location metadata.


Last updated: 2025-09-04