Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
Loading...
Searching...
No Matches
portals::ui::ThemeSelectionRef Class Reference

Weak UI-affine observation of the one scene-owned catalog/model. Copying/destroying observations never cancels a preview. The first successful preview explicitly revokes a previous LiveTheme controller; cancel restores appearance, not that controller or legacy engine mode. Commands are checked and do not report on destruction. Return them from a managed action to use its existing error boundary. A failed transition preserves prior model/style state, apart from independent external operations. Factories are never retried automatically. More...

#include <theme_selection.hpp>

Public Member Functions

 ThemeSelectionRef ()
 Construct a cold observation on the UI thread; allocation may throw before an owner exists.
std::expected< void, ManagedError > preview (std::string_view id, std::source_location origin=std::source_location::current()) const
std::expected< void, ManagedError > commit (std::source_location origin=std::source_location::current()) const
std::expected< void, ManagedError > cancel (std::source_location origin=std::source_location::current()) const
std::expected< std::shared_ptr< const ThemeSelectionSnapshot >, ManagedError > snapshot () const

Friends

class portals::ManagedScene
struct detail::ThemeSelectionAccess
struct detail::ThemeSelectorAccess

Detailed Description

Weak UI-affine observation of the one scene-owned catalog/model. Copying/destroying observations never cancels a preview. The first successful preview explicitly revokes a previous LiveTheme controller; cancel restores appearance, not that controller or legacy engine mode. Commands are checked and do not report on destruction. Return them from a managed action to use its existing error boundary. A failed transition preserves prior model/style state, apart from independent external operations. Factories are never retried automatically.

Member Function Documentation

◆ cancel()

std::expected< void, ManagedError > portals::ui::ThemeSelectionRef::cancel ( std::source_location origin = std::source_location::current()) const
Parameters
originOriginal command site.
Returns
Allocation-free success from IDLE, or atomic restore from ACTIVE. SUPERSEDED returns STYLE/StyleError/INVALID_ARGUMENT without overwriting the external theme or historical IDs.

◆ commit()

std::expected< void, ManagedError > portals::ui::ThemeSelectionRef::commit ( std::source_location origin = std::source_location::current()) const
Parameters
originOriginal command site.
Returns
Success only after promoting an ACTIVE installed candidate; IDLE/SUPERSEDED returns STYLE/StyleError/INVALID_ARGUMENT and produces no new committed result. A pending/failed newer intent returns WOULD_BLOCK instead of committing the older installed preview. No persistence callback runs.

◆ preview()

std::expected< void, ManagedError > portals::ui::ThemeSelectionRef::preview ( std::string_view id,
std::source_location origin = std::source_location::current() ) const
Parameters
idExact application catalog ID, borrowed for this synchronous operation.
originOriginal command site retained in full managed errors.
Returns
Synchronous candidate installation, or acceptance of one latest prepared intent, or a typed error. A prepared intent remains observable through requestedId/preparing/preparationError until completion. Factory invocation/build/parse runs on the existing background executor; installation, copying, resolution and layout still occur on UI under the existing finite style budgets. Explicit preview after SUPERSEDED starts a fresh session from the current external theme.

◆ snapshot()

std::expected< std::shared_ptr< const ThemeSelectionSnapshot >, ManagedError > portals::ui::ThemeSelectionRef::snapshot ( ) const
Returns
Independent owning metadata/selection, or exact affinity/lifetime/allocation failure. Read-only; snapshots retain no factory, resolver, scene or widget pointer. Transition reentry is WOULD_BLOCK.

The documentation for this class was generated from the following file: