step_renderer

Composable renderers for the Phase 2 segmentation column and shared chrome

Segmentation Toolbar & Stats

Workflow-specific toolbar with undo/reset/AI split buttons and segment statistics. Used directly by mutation handlers for OOB swaps (via oob=True) and by the combined step renderer for initial chrome population.


render_toolbar


def render_toolbar(
    reset_url:str, # URL for reset action
    ai_split_url:str, # URL for NLTK split action
    undo_url:str, # URL for undo action
    can_undo:bool, # Whether undo is available
    extra_actions:tuple=(), # Additional elements for the right action group
    nltk_split_disabled:bool=False, # Whether NLTK Split button is disabled (current = NLTK pre-split)
    oob:bool=False, # Whether to render as OOB swap
)->Any: # Toolbar component

Render the segmentation toolbar with action buttons.


render_seg_stats


def render_seg_stats(
    segments:List, # Current segments
    oob:bool=False, # Whether to render as OOB swap
)->Any: # Statistics component

Render segmentation statistics.


render_seg_source_position


def render_seg_source_position(
    segments:List, # Current segments
    focused_index:int=0, # Currently focused segment index
    oob:bool=False, # Whether to render as OOB swap
)->Any: # Source position indicator (empty if single source)

Render source position indicator for the focused segment.

Column Body Renderer

Renders the segmentation column content area with viewport and keyboard infrastructure. Called by the combined step renderer (initial page load) and the init handler (HTMX swap).


render_seg_column_body


def render_seg_column_body(
    segments:List, # Segments to display
    focused_index:int, # Currently focused segment index
    visible_count:int, # Number of visible cards in viewport
    card_width:int, # Card stack width in rem
    urls:SegmentationUrls, # URL bundle for all segmentation routes
    kb_system:Optional=None, # Rendered keyboard system (None when KB managed externally)
)->Any: # Div with id=COLUMN_CONTENT containing viewport + infrastructure

Render the segmentation column content area with card stack viewport.

Shared Chrome Content

Functions that render segmentation-specific content for the shared chrome containers. Used by the combined step renderer for initial page load and by the init handler for OOB swaps.


render_seg_mini_stats_text


def render_seg_mini_stats_text(
    segments:List, # Current segments
)->str: # Compact stats string for column header badge

Generate compact stats string for the segmentation column header badge.