exlab_wizard.ui.components.framed_pane#
Framed pane helper (GUI/Orchestrator Redesign §4.1).
The main-window refresh frames each content region (Explorer / Files / metadata / footer) as an elevated card on the grey app canvas, topped by an uppercase title strip with an optional right-aligned count pill – the approved “B + C hybrid” framing.
This module owns that shell as a single reusable context manager so the
card / title-strip / body styling lives in one place and every pane reads
identically. The style fragments are pure helpers so they can be
unit-tested without spinning up NiceGUI; the context manager itself is the
only NiceGUI-touching surface and yield``s the *body* element so children
of the ``with block nest inside the scrollable body, not the card root.
All colours / spacing / radii resolve to design tokens (var(--…));
each carries a literal fallback because register_theme is not injected
on every route, so a bare var(--color-surface) would otherwise resolve
to empty and drop the whole declaration. Every fragment ends with ; so
callers can safely concatenate an override (e.g. the metadata pane appends
overflow: auto; to beat the card’s overflow: hidden;).
Functions
Return the scrollable-body style fragment (pure; testable). |
|
Return the framed-pane card-shell style fragment (pure; testable). |
|
|
Context manager rendering a framed, titled pane; yields the body element. |
Return the title-strip style fragment (pure; testable). |
- exlab_wizard.ui.components.framed_pane.body_style()[source]#
Return the scrollable-body style fragment (pure; testable).
- Return type:
- exlab_wizard.ui.components.framed_pane.card_style()[source]#
Return the framed-pane card-shell style fragment (pure; testable).
Always ends with
;so callers can append an override (e.g. the metadata pane appendsoverflow: auto;to beatoverflow: hidden;).- Return type:
- exlab_wizard.ui.components.framed_pane.framed_pane(title, *, count=None, testid, header_extra=None, count_left=False, card_classes='')[source]#
Context manager rendering a framed, titled pane; yields the body element.
Use as:
with framed_pane("Explorer", testid="explorer-pane"): ... # body content -- rendered INSIDE the scrollable card body
titleis shown uppercase in the strip;count(when given) is a right-aligned pill such as"7 items".testidis set on the card (data-testid="<testid>"); the title strip carries<testid>-headerand the count pill<testid>-count.header_extrais an optional zero-arg callback invoked inside the title strip, after the title + count pill, so a pane can add header controls (e.g. the Files pane’s per-folder refresh button) without this helper knowing their semantics. It is skipped outside a NiceGUI context.card_classesis an optional space-separated class string added to the card root – used to scope descendant CSS (e.g.exlab-density-compact, which the theme rule keys on to tighten the file-list row padding). Empty by default, in which case no class is added.The manager opens the body div last and yields it, so children of the
withblock become DOM descendants of the body (not the card root or the header) – they therefore sit below the title strip and inside theoverflow: autoscroll region.Outside a NiceGUI app context (unit tests) the manager yields
Noneand renders nothing, mirroring the other components’ NiceGUI-optional pattern; the style helpers above stay independently testable.