yera.ui.apps_sidebar

Utils for the rendering the app tree sidebar panel.

Symbols

def app_icon — Generates an HTML badge for an application.
class AppTreeFile — A Python source file containing one or more app functions.
class AppTreeFolder — A directory containing folders or Python source files.
class AppTreeLeaf — A selectable app function within a source file.
def build_app_tree — Build a tree that preserves source files above app functions.
def render_app_tree — Recursively renders a compacted app tree as HTML.

app_icon

app_icon(
    app_id: str,
    app: AppFunctionWrapper,
) → str

Generates an HTML badge for an application.

Parameters

app_id
type: str

The unique identifier of the app used to determine its color.

app
type: AppFunctionWrapper

The application wrapper containing the display name.

Returns

type: str

An HTML string representing the app's icon badge.

AppTreeFile

A Python source file containing one or more app functions.

AppTreeFolder

A directory containing folders or Python source files.

AppTreeLeaf

A selectable app function within a source file.

build_app_tree

build_app_tree(
    apps: dict[str, AppFunctionWrapper],
) → list[AppTreeFolder | AppTreeFile]

Build a tree that preserves source files above app functions.

render_app_tree

render_app_tree(
    nodes: list[AppTreeLeaf | AppTreeFolder | AppTreeFile],
    depth: int = 0,
    selected_app_id: str | None = None,
) → str

Recursively renders a compacted app tree as HTML.

Indentation comes entirely from the nested .app-tree__children wrapper (border + margin, in CSS) — rows use fixed padding regardless of depth; depth here only controls whether a folder starts expanded.

Parameters

nodes
type: list[AppTreeLeaf | AppTreeFolder | AppTreeFile]

Tree nodes at this level, from _build_app_tree.

depth
type: int = 0

Current nesting depth — default-open state only.

selected_app_id
type: str | None = None

Optional app identifier to mark as the current selection.

Returns

type: str

HTML string of the rendered tree.