notation library

The compact notation (docs/design/13-compact-notation.md): the form an agent writes for a small UI, expanded to an ordinary document.

Classes

A2uiResult
What parseA2ui gives: the document, the notation it was read through, and what was approximated.
NotationIssue
A problem in the notation's text: where and what.
NotationOptions
How the notation expands.
NotationResult
NotationStream
The notation read as it arrives: add takes text in any chunks and returns the edit operations of the lines completed so far (a set per node under its parent, vars for the state a line introduced), ready for applyOps; close gives the last line's.
WantedBlock
What parseNotation gives: the document and what it could not read. A component an answer asked for because none fitted a part of its UI: Wanted "PollResults" "each option with its share of the votes", with the part built from plain parts under it. The part shows as written; a host may have the component designed and added for the answers that follow.

Constants

buttonVariants → const Map<String, ({Json props, String type})>
Button.<variant>: the button type and props it stands for.
defaultTextVariants → const Map<String, Object>
SSUI's text styles (design_systems/ssui/design_system.json, theme .textStyles with its colors), written out so a document needs no theme: SSUI's own names, and the short words an agent reaches for.
notationTypes → const Map<String, ({Json node, String type})>
Short names: what an agent writes → the node type and what it implies.

Functions

a2uiToDocument(List<Json> messages, {required Catalog catalog, String? surfaceId, NotationOptions options = const NotationOptions()}) → A2uiResult
messages (decoded agent-to-renderer envelopes) as a document.
notationOptionsFor(Json document) → NotationOptions
The options printNotation's output is parsed with: the document's canvas id and width.
notationPrompt({Catalog? catalog, NotationOptions options = const NotationOptions(), DesignSystem? designSystem, Set<String>? only, bool natural = false, bool wanted = false}) → String
The prompt for the notation over catalog (its level 0 and 1 types).
parseA2ui(String text, {required Catalog catalog, String? surfaceId, NotationOptions options = const NotationOptions()}) → A2uiResult
The surface A2UI's JSONL text describes (the last one created, or surfaceId), as a document.
parseNotation(String text, {Catalog? catalog, NotationOptions options = const NotationOptions()}) → NotationResult
text in the compact notation as a layout document. Never throws: what cannot be read is reported and skipped.
printNotation(Json document, {required Catalog catalog}) → String
document in the notation. Parse it back with notationOptionsFor.