Skip to main content

Module ui

Module ui 

Source
Expand description

UI blocks: rich visual output (cards, charts, tables, stat tiles) that any node or tool can emit for a host to render.

A UI block is a plain object whose "$ui" key names its kind, for example {"$ui": "chart", "version": 1, ...}. The engine treats blocks as ordinary values; this module only finds them, so hosts and nodes agree on one envelope. The block kinds, their schemas and their validation live in the graphrt-ui crate: hosts must validate a block there before rendering it.

Constants§

MAX_COLLECTED_BLOCKS
Most blocks collect_ui_blocks returns for one value.
UI_KEY
Key that marks an object as a UI block; its value is the block kind.

Functions§

collect_ui_blocks
UI blocks in value, in document order: the value itself when it is a block, otherwise blocks found in its array items and object fields, at most three levels down (a node’s data output, a list of results, a {"chart": {...}} wrapper). The inside of a block is not searched, and at most MAX_COLLECTED_BLOCKS blocks are returned.
ui_block_kind
The kind of a UI block ("chart", "adaptive_card"…), or None when value is not one.