Coverage for src / lexigram / ui / protocols.py: 100%

6 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-08-10 04:11 +0800

1"""UI rendering protocols for lexigram-ui components.""" 

2 

3from __future__ import annotations 

4 

5from typing import Protocol, runtime_checkable 

6 

7 

8@runtime_checkable 

9class RenderableProtocol(Protocol): 

10 """Any object that can render to an HTML string. 

11 

12 Implemented by Component, Element, and any custom renderable 

13 in lexigram-ui. Export this protocol from the UIModule so that 

14 other packages can accept UI objects without importing from 

15 lexigram-ui implementation modules. 

16 """ 

17 

18 def __str__(self) -> str: 

19 """Return the rendered HTML string.""" 

20 ... 

21 

22 

23__all__ = ["RenderableProtocol"]