Registry

Registry system for the streamlit_rich_message_history package.

class streamlit_rich_message_history.registry.ComponentRegistry[source]

Bases: object

Registry to manage custom component types, detectors, and renderers.

classmethod get_all_types()[source]

Get all registered component types (built-in and custom).

Return type:

list

classmethod get_custom_type(name)[source]

Get a custom component type by name.

Return type:

Optional[ComponentType]

classmethod get_detector(comp_type)[source]

Get the detector function for a component type.

Return type:

Optional[Callable]

classmethod get_renderer(comp_type)[source]

Get the renderer function for a component type.

Return type:

Optional[Callable]

classmethod register_component_type(name)[source]

Register a new custom component type.

Parameters:

name (str) – The name of the custom component type.

Returns:

The newly created or existing ComponentType.

Return type:

ComponentType

classmethod register_detector(comp_type, detector)[source]

Register a detector function for a component type.

Parameters:
  • comp_type (ComponentType) – The component type to register the detector for.

  • detector (Callable) – A function that takes (content, kwargs) and returns True if it matches.

Return type:

None

classmethod register_renderer(comp_type, renderer)[source]

Register a renderer function for a component type.

Parameters:
  • comp_type (ComponentType) – The component type to register the renderer for.

  • renderer (Callable) – A function that takes (content, kwargs) and renders using streamlit.

Return type:

None