Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
Loading...
Searching...
No Matches
ui_recipe_context.hpp
1// Copyright (c) 2026 ttldtor.
2// SPDX-License-Identifier: BSL-1.0
3#pragma once
4
5#include <portals/detail/control_context.hpp>
6#include <portals/detail/line_edit_text.hpp>
7#include <portals/detail/move_only_function.hpp>
8#include <portals/detail/recipe_sizing.hpp>
9#include <portals/grid.hpp>
10#include <portals/ui_ref.hpp>
11
12#include <algorithm>
13#include <array>
14#include <bit>
15#include <cstdio>
16#include <ranges>
17#include <tuple>
18
19namespace portals { class PopupMenu; }
20
21namespace portals::ui {
25template <class T> class Description;
26class GridSection;
27
28namespace detail {
29struct ResourceAccess;
30
35template <class T> struct IsDescription : std::false_type {};
36
40template <class T> struct IsDescription<Description<T>> : std::true_type {};
41
45template <class T> struct IsVirtualList : std::false_type {};
46
48template <class T> struct IsVirtualList<VirtualList<T>> : std::true_type {};
49
53template <class T> struct IsVirtualTable : std::false_type {};
54
56template <class T> struct IsVirtualTable<VirtualTable<T>> : std::true_type {};
57
61template <class T> struct IsChart : std::false_type {};
62
64template <class T> struct IsChart<Chart<T>> : std::true_type {};
65
70template <class T>
71concept DescriptionInput = IsDescription<std::remove_cvref_t<T>>::value && !std::is_lvalue_reference_v<T>;
72
74template <class T>
75concept GridInput =
76 DescriptionInput<T> || (std::same_as<std::remove_cvref_t<T>, GridSection> && !std::is_lvalue_reference_v<T>);
77
81template <class T>
82concept SceneLayer = DescriptionInput<T> && (std::same_as<std::remove_cvref_t<T>, Description<Dialog>> ||
83 std::same_as<std::remove_cvref_t<T>, Description<PopupMenu>> ||
84 std::same_as<std::remove_cvref_t<T>, Description<Widget>>);
85
89template <class R>
91 std::ranges::input_range<R> && IsDescription<std::ranges::range_value_t<R>>::value &&
93 std::constructible_from<std::ranges::range_value_t<R>, std::ranges::range_reference_t<R>>) ||
94 (!std::is_lvalue_reference_v<R> && !std::ranges::view<std::remove_cvref_t<R>> &&
95 !std::ranges::enable_borrowed_range<std::remove_cvref_t<R>> &&
96 std::same_as<std::ranges::range_reference_t<R>, std::ranges::range_value_t<R> &>));
97
105inline ManagedError error(Node<Widget> node, TreeError cause) {
106 return {ManagedPhase::MOUNT, node.id(), cause, {}, {}};
107}
108
112 ~ClassNames() = default;
113
114 std::vector<std::string> values = std::vector<std::string>(0);
115};
116
121inline ClassNames splitClasses(std::string_view value) {
122 ClassNames result;
123 constexpr std::string_view SEPARATORS = " \t\r\n\f\v";
124 auto begin = value.find_first_not_of(SEPARATORS);
125
126 while (begin != std::string_view::npos) {
127 const auto end = value.find_first_of(SEPARATORS, begin);
128
129 result.values.emplace_back(value.substr(begin, end == std::string_view::npos ? end : end - begin));
130 begin = end == std::string_view::npos ? end : value.find_first_not_of(SEPARATORS, end);
131 }
132
133 return result;
134}
135
141inline ManagedError textError(Node<Widget> node, TextError cause) {
142 const auto kind = cause.kind;
143 const bool limited = kind == TextErrorKind::INPUT_LIMIT || kind == TextErrorKind::CLUSTER_LIMIT ||
145 auto failure = error(node, limited ? TreeError::NODE_LIMIT : TreeError::INVALID_ARGUMENT);
146
147 failure.text = cause;
148
149 return failure;
150}
151
156inline std::expected<portals::detail::LineEditPlaceholder, ManagedError> lineEditPlaceholder(LineEditOptions &options,
157 Node<Widget> parent) {
158 if (!portals::detail::validLineEditDisplayMode(options.displayMode) ||
159 (options.placeholder && portals::detail::hasLineSeparator(*options.placeholder))) {
160 return std::unexpected(error(parent, TreeError::INVALID_ARGUMENT));
161 }
162 auto prepared = portals::detail::prepareLineEditPlaceholder(options);
163 if (!prepared) {
164 return std::unexpected(textError(parent, prepared.error()));
165 }
166 return std::move(*prepared);
167}
168
169// Checked MSVC strings allocate iterator proxies in otherwise noexcept moves.
170#if defined(_MSVC_STL_VERSION) && defined(_ITERATOR_DEBUG_LEVEL) && _ITERATOR_DEBUG_LEVEL != 0
171inline constexpr bool CHECKED_STRING_MOVES = true;
172#else
173inline constexpr bool CHECKED_STRING_MOVES = false;
174#endif
175
179inline auto captureText(std::string_view value) {
180 if constexpr (CHECKED_STRING_MOVES) {
181 return std::make_shared<const std::string>(value);
182 } else {
183 return std::string(value);
184 }
185}
186
191template <class T> std::string_view captionView(const T &value) {
192 if constexpr (std::same_as<T, std::string>) {
193 return value;
194 } else {
195 return *value;
196 }
197}
198
202constexpr std::optional<FramePattern> framePattern(std::string_view name) noexcept {
203 if (name == "single" || name == "plain") {
205 }
206
207 if (name == "rounded") {
209 }
210
211 if (name == "double") {
213 }
214
215 if (name == "heavy") {
216 return FramePattern::HEAVY;
217 }
218
219 if (name == "ascii") {
220 return FramePattern::ASCII;
221 }
222
223 return {};
224}
225
227constexpr ScrollbarThumbPattern scrollbarThumbPattern(std::string_view name) noexcept {
228 if (name == "fractional-block") {
230 }
231 if (name == "legacy") {
233 }
234
235 if (name == "block") {
237 }
238
239 if (name == "ascii") {
241 }
242
243 return static_cast<ScrollbarThumbPattern>(-1);
244}
245
246constexpr ScrollbarArrowPattern scrollbarArrowPattern(std::string_view name) noexcept {
247 if (name == "legacy") {
249 }
250
251 if (name == "triangle") {
253 }
254
255 if (name == "ascii") {
257 }
258
259 return static_cast<ScrollbarArrowPattern>(-1);
260}
261
262constexpr ScrollbarPattern scrollbarPattern(std::string_view name) noexcept {
263 if (name == "fractional-block") {
265 }
266 if (name == "legacy")
268 if (name == "frame")
270 if (name == "minimal")
272 if (name == "ascii")
274
275 return static_cast<ScrollbarPattern>(-1);
276}
277
279constexpr GlyphProfile glyphProfile(std::string_view name) noexcept {
280 constexpr std::array<std::string_view, 7> NAMES{"default", "unicode", "ascii", "nf-rounded",
281 "nf-chevron", "nf-slash", "nf-backslash"};
282 const auto found = std::ranges::find(NAMES, name);
283
284 return found == NAMES.end() ? static_cast<GlyphProfile>(-1) : static_cast<GlyphProfile>(found - NAMES.begin());
285}
286
288constexpr GlyphFallback glyphFallback(std::string_view name) noexcept {
289 return name == "unicode" ? GlyphFallback::UNICODE_GLYPHS
290 : name == "ascii" ? GlyphFallback::ASCII
291 : static_cast<GlyphFallback>(-1);
292}
293
295constexpr TitleDecoration titleDecorationPreset(std::string_view name) noexcept {
296 if (name == "none")
298 if (name == "spaced")
300 if (name == "square")
302 if (name == "angle")
304 if (name == "round")
306 if (name == "profile")
308
309 return static_cast<TitleDecoration>(-1);
310}
311
315inline bool hasFrameSettings(const ControlScrollFrameSettings &frame) noexcept {
316 const auto &sides = frame.sides;
317 const auto &glyphs = frame.customGlyphs;
318
319 return frame.enabled || frame.glyphs || frame.maxPaintCells || frame.pattern || sides.top || sides.right ||
320 sides.bottom || sides.left || frame.title || frame.titleAlignment || frame.maxTitleBytes || glyphs.enabled ||
321 glyphs.topLeft || glyphs.topRight || glyphs.bottomLeft || glyphs.bottomRight || glyphs.horizontal ||
322 glyphs.vertical || frame.titleDecoration || frame.customTitleDecoration.enabled ||
323 frame.customTitleDecoration.prefix || frame.customTitleDecoration.suffix;
324}
325
330inline ManagedError frameContextError(ControlContextErrorCode code, std::string_view path, Node<Widget> node = {}) {
331 try {
332 auto diagnostic = std::make_shared<ControlContextDiagnostic>();
333
334 diagnostic->path = path;
335
336 return controlContextError({code, std::move(diagnostic)}, node);
337 } catch (const std::bad_alloc &) {
338 return error(node, TreeError::NO_MEMORY);
339 }
340}
341
346 std::optional<std::string> variant;
347 std::unique_ptr<ResolvedControl> resolved;
348 bool prepared{};
351 ControlPropertyPresence materializedSettings{};
352};
353
359 bool validated{};
360 bool validRecipe{true};
364 std::function<std::expected<std::pair<bool, bool>, ManagedError>(ControlContext)>
366 std::optional<DeclarativeGridOptions> grid;
367 std::unique_ptr<GridPlacementPlan> plan;
368 std::vector<std::shared_ptr<RecipeLayout>> children =
369 std::vector<std::shared_ptr<RecipeLayout>>(0);
370 std::vector<NodeId> mounted = std::vector<NodeId>(0);
371 std::size_t headerSections{};
372 std::size_t bodySections{};
373 std::size_t directItems{};
375 bool validSections{true};
377 std::optional<CellStyle> headerStyle;
378 std::optional<CellStyle> bodyStyle;
379 std::optional<GridRowStyles> rowStyles;
380 std::optional<GridScrollOptions> scroll;
381 std::unique_ptr<GridRecipeControl> control;
382 std::unique_ptr<std::vector<AxisSize>> columnSizes;
383 std::unique_ptr<std::vector<AxisSize>> rowSizes;
384};
385
389inline std::expected<void, TreeError> preflightLayout(const std::shared_ptr<RecipeLayout> &root) {
390 if (!root || root->validated) {
391 return {};
392 }
393
394 struct Visit {
395 std::shared_ptr<RecipeLayout> layout;
396 bool gridChild{};
397 };
398
399 std::vector<Visit> pending(0);
400 std::vector<std::shared_ptr<RecipeLayout>> checked(0);
401
402 pending.push_back({root, false});
403
404 while (!pending.empty()) {
405 auto visit = std::move(pending.back());
406
407 pending.pop_back();
408
409 auto &layout = *visit.layout;
410
411 if (!layout.validRecipe || (layout.itemRequested && !visit.gridChild) || (layout.grid && !layout.gridContainer)) {
412 return std::unexpected(TreeError::INVALID_ARGUMENT);
413 }
414
415 if (layout.gridContainer && layout.presentation.maxPaintCells == 0) {
416 return std::unexpected(TreeError::INVALID_ARGUMENT);
417 }
418
419 const bool declarative = layout.gridContainer && layout.grid.has_value();
420
421 if (declarative) {
422 if (!layout.validSections || layout.headerSections > 1 || layout.bodySections > 1 ||
423 ((layout.grid->regions || layout.headerSections || layout.bodySections) && layout.directItems != 0)) {
424 return std::unexpected(TreeError::INVALID_ARGUMENT);
425 }
426
427 if (layout.headerSections || layout.bodySections) {
428 layout.grid->regions = true;
429 layout.grid->stickyHeader = layout.stickyHeader;
430 }
431
432 if (layout.scroll) {
433 auto valid = validateScrollOptions(layout.scroll->area);
434
435 if (!valid) {
436 return std::unexpected(valid.error());
437 }
438 }
439
440 std::vector<GridItemOptions> items(0);
441
442 items.reserve(layout.children.size());
443
444 for (const auto &child : layout.children) {
445 items.push_back(child->item);
446 }
447
448 auto resolved = resolveGridPlacements(*layout.grid, items);
449
450 if (!resolved) {
451 return std::unexpected(resolved.error());
452 }
453
454 for (const auto &[policies, count] :
455 {std::pair{layout.columnSizes.get(), resolved->columns}, std::pair{layout.rowSizes.get(), resolved->rows}}) {
456 if (!policies) {
457 continue;
458 }
459
460 if (policies->size() != count) {
461 return std::unexpected(TreeError::INVALID_ARGUMENT);
462 }
463
464 auto valid = portals::detail::validateGridTrackSizes(*policies);
465
466 if (!valid) {
467 return std::unexpected(valid.error());
468 }
469 }
470
471 layout.plan = std::make_unique<GridPlacementPlan>(*resolved);
472 layout.mounted.reserve(items.size());
473 }
474
475 for (const auto &child : layout.children) {
476 pending.push_back({child, declarative});
477 }
478
479 checked.push_back(std::move(visit.layout));
480 }
481
482 for (const auto &layout : checked) {
483 layout->validated = true;
484 }
485
486 return {};
487}
488
492inline GridOptions resolvedGridOptions(const RecipeLayout &layout) {
493 GridOptions result;
494 const auto &settings = *layout.grid;
495 const auto &plan = *layout.plan;
496
497 result.columns.resize(plan.columns);
498 result.rows.resize(plan.rows);
499 result.header_rows.resize(plan.headerRows);
500
501 if (layout.columnSizes) {
502 result.columns = *layout.columnSizes;
503 }
504
505 if (layout.rowSizes) {
506 result.rows = *layout.rowSizes;
507 }
508 result.regions = settings.regions;
509 result.sticky_header = settings.stickyHeader;
510 result.presentation = layout.presentation;
511
512 if (layout.headerStyle) {
513 result.presentation.header = layout.headerStyle;
514 }
515
516 if (layout.bodyStyle) {
517 result.presentation.body = layout.bodyStyle;
518 }
519
520 if (layout.rowStyles) {
521 result.presentation.rows = *layout.rowStyles;
522 }
523 result.column_gap = settings.columnGap;
524 result.row_gap = settings.rowGap;
525 result.padding = settings.padding;
526 result.max_tracks_per_axis = settings.maxTracksPerAxis;
527 result.max_placements = settings.maxPlacements;
528 result.cells.reserve(layout.mounted.size());
529
530 for (std::size_t index = 0; index < layout.mounted.size(); ++index) {
531 const auto &item = layout.children[index]->item;
532 const auto position = plan.positions[index];
533
534 result.cells.push_back({layout.mounted[index], position.row, position.column, item.rowSpan, item.columnSpan,
535 item.horizontal, item.vertical, item.region});
536 }
537
538 return GridOptions(result);
539}
540
543 ~SemanticConstruction() = default;
544
545 ControlFactoryKind kind{
546 ControlFactoryKind::MESSAGE_BINDING};
548 ControlPropertyPresence materialized{};
549 bool prepared{};
550 std::shared_ptr<Description<Widget>> body;
551};
552
556 std::size_t controlLeaves{};
558 const TextResolver
560 const TextResolver *messageResolver{};
561 const TextResolver *dataStateResolver{};
568 std::vector<Node<Widget>> nodes =
569 std::vector<Node<Widget>>(0);
570 std::vector<portals::detail::MoveOnlyFunction<void()>> publish =
571 std::vector<portals::detail::MoveOnlyFunction<void()>>(0);
572 std::vector<portals::detail::MoveOnlyFunction<void()>> release =
573 std::vector<portals::detail::MoveOnlyFunction<void()>>(0);
574
580
581 std::vector<PendingRef> pending = std::vector<PendingRef>(0);
582
586 std::shared_ptr<RefTarget> source;
587 bool completed{};
588 portals::detail::MoveOnlyFunction<std::expected<void, ManagedError>()> complete;
589 };
590
591 std::vector<CaptionFinalizer> captions =
592 std::vector<CaptionFinalizer>(0);
593 std::vector<portals::detail::MoveOnlyFunction<std::expected<void, ManagedError>()>> finalize =
594 std::vector<portals::detail::MoveOnlyFunction<std::expected<void, ManagedError>()>>(
595 0);
596 std::vector<portals::detail::MoveOnlyFunction<void()>> rollback =
597 std::vector<portals::detail::MoveOnlyFunction<void()>>(
598 0);
599 bool committed{};
600
603 if (!committed) {
604 for (auto &retire : rollback) {
605 retire();
606 }
607 }
608 for (auto &reservation : release) {
609 reservation();
610 }
611 }
612};
613
618std::expected<void, ManagedError> prepareGridLayouts(const std::shared_ptr<RecipeLayout> &root, MountContext &context,
619 Node<Widget> parent);
620
621} // namespace detail
622
623} // namespace portals::ui
UI-owned retained plot of a bounded immutable model range. Accessors run only in prepareChart,...
Definition chart.hpp:117
Copyable typed observer; never owns or exposes an unchecked widget pointer.
Definition widget.hpp:92
Sized action-backed popup plane, owned by one private managed Dialog activation. Use ui::popupMenu as...
Definition popup_menu.hpp:50
One UI-owned view with bounded owning row text and one independent model consumer....
Definition virtual_list.hpp:133
One UI-owned table with bounded owning cell text and one independent model consumer....
Definition virtual_table.hpp:154
Cheap owning immutable snapshot of named definitions and defaults. Const snapshot reads are concurren...
Definition ui_control_context.hpp:632
Single-use owning construction recipe; no mounted widget ownership.
Definition ui_description.hpp:48
Single-use semantic Grid section; owns recipes and never mounts a placeholder Widget.
Definition ui_description.hpp:2889
Admit only consuming recipe arguments, rejecting implicit moves from lvalues.
Definition ui_recipe_context.hpp:71
Admit immediately consumable recipes without draining borrowed lvalue elements.
Definition ui_recipe_context.hpp:90
Consuming real grid child or semantic section.
Definition ui_recipe_context.hpp:75
Admit a declared dialog layer or an erased recipe checked after its existing factory runs.
Definition ui_recipe_context.hpp:82
Public Portals API.
Definition action.hpp:8
@ SINGLE
Single lines and square corners.
Definition frame.hpp:10
@ HEAVY
Heavy lines and square corners.
Definition frame.hpp:14
@ ASCII
Portable plus, minus and vertical-bar glyphs.
Definition frame.hpp:15
@ DOUBLE
Double lines and square corners.
Definition frame.hpp:13
@ ROUNDED
Single lines and rounded corners.
Definition frame.hpp:12
ScrollbarThumbPattern
Independent thumb source; all choices are opt-in.
Definition scrollbar_skin.hpp:24
@ LEGACY
Existing repeated thumb, including ASCII fallback.
Definition scrollbar_skin.hpp:25
@ BLOCK
Explicit block with the control width/glyph fallback.
Definition scrollbar_skin.hpp:26
@ FRACTIONAL_BLOCK
Eighth-cell block placement; requires a blank track and no custom thumb shapes.
Definition scrollbar_skin.hpp:28
@ ASCII
Hash thumb.
Definition scrollbar_skin.hpp:27
TitleDecoration
Optional top-title break decoration; NONE preserves literal legacy titles.
Definition frame.hpp:39
@ SQUARE
Square brackets and inner spaces.
Definition frame.hpp:42
@ ROUND
Parentheses and inner spaces.
Definition frame.hpp:44
@ PROFILE
Explicit selected profile caps; customTitleDecoration still wins.
Definition frame.hpp:45
@ NONE
No additional title cells.
Definition frame.hpp:40
@ SPACED
One space on either side.
Definition frame.hpp:41
@ ANGLE
Angle brackets and inner spaces.
Definition frame.hpp:43
ScrollbarPattern
Opt-in scrollbar glyph presets; legacy calls retain their original appearance.
Definition scrollbar_skin.hpp:15
@ MINIMAL
Blank track and block thumb.
Definition scrollbar_skin.hpp:18
@ LEGACY
Existing shaded track and block thumb.
Definition scrollbar_skin.hpp:16
@ FRAME
Actual frame lines, or single lines on an unframed control.
Definition scrollbar_skin.hpp:17
@ FRACTIONAL_BLOCK
Blank track and eighth-cell block placement; explicit leaves keep priority.
Definition scrollbar_skin.hpp:20
@ ASCII
Dot track and hash thumb.
Definition scrollbar_skin.hpp:19
std::expected< void, TreeError > validateScrollOptions(const ScrollBarOptions &options) noexcept
Validate standalone bar settings without mutation, allocation or callbacks.
@ MOUNT
Create the scene root or attach and register a managed widget.
Definition managed_diagnostics.hpp:49
GlyphProfile
Explicit glyph map, independent of colors and geometry. NF maps use Nerd Fonts 3 Powerline codepoints...
Definition glyph_profile.hpp:12
GlyphFallback
Portable replacement when the selected map fails one-cell admission.
Definition glyph_profile.hpp:23
@ UNICODE_GLYPHS
Unicode replacement, with ASCII when Unicode is not one cell.
Definition glyph_profile.hpp:24
@ ASCII
ASCII replacement; also selects ASCII vertical caps for NF maps.
Definition glyph_profile.hpp:25
std::expected< GridPlacementPlan, TreeError > resolveGridPlacements(const DeclarativeGridOptions &options, std::span< const GridItemOptions > items)
Resolve sparse placement without factories, tree access or retained input views.
ScrollbarArrowPattern
Independent functional-arrow source; selecting it never enables buttons.
Definition scrollbar_skin.hpp:32
@ LEGACY
Existing functional arrow source.
Definition scrollbar_skin.hpp:33
@ TRIANGLE
Triangle glyphs with the control width/glyph fallback.
Definition scrollbar_skin.hpp:34
@ ASCII
Less-than, greater-than, caret and lowercase v.
Definition scrollbar_skin.hpp:35
@ INPUT_LIMIT
Input length exceeds its configured/representation limit.
Definition text.hpp:73
@ CLUSTER_LIMIT
One whole cluster exceeds its byte limit.
Definition text.hpp:75
@ GRAPHEME_LIMIT
The number of clusters exceeds its limit.
Definition text.hpp:77
@ CELL_LIMIT
Cell accumulation exceeds its configured/int32_t limit.
Definition text.hpp:79
TreeError
Checked tree failures; rejected operations never start the requested callback.
Definition widget_types.hpp:26
@ NODE_LIMIT
The configured live node, observer or consumer limit was reached.
Definition widget_types.hpp:35
@ INVALID_ARGUMENT
An option, enum value or operation argument is invalid.
Definition widget_types.hpp:27
@ NO_MEMORY
Allocation failed inside the operation boundary.
Definition widget_types.hpp:33
Owning advanced frame settings; legacy BorderOptions remains a literal value type.
Definition primitives.hpp:62
Owning parent-child relationship; omitted coordinates request automatic placement.
Definition grid.hpp:65
Backgrounds only; these values never inherit into child control state styles.
Definition grid.hpp:35
Original error plus independent runner/restoration and cleanup failures.
Definition managed_diagnostics.hpp:62
Owning error value, independent of the failed input's lifetime.
Definition text.hpp:87
TextErrorKind kind
Failure category.
Definition text.hpp:89
Owning sparse literals only; never contains IDs, models, handlers or live history.
Definition ui_control_context.hpp:391
Owning class names with fallible copies instead of checked-STL container moves.
Definition ui_recipe_context.hpp:110
~ClassNames()=default
Suppress implicit noexcept moves of checked containers.
std::vector< std::string > values
Ordered owning names, including duplicates.
Definition ui_recipe_context.hpp:114
Grid-only sparse configuration, released with its construction transaction.
Definition ui_recipe_context.hpp:343
ControlPropertyPresence materializedSettings
Resource fields already counted against the mount budget.
Definition ui_recipe_context.hpp:351
std::unique_ptr< ResolvedControl > resolved
Owning settings resolved before control construction.
Definition ui_recipe_context.hpp:347
std::optional< std::string > variant
Optional named fallback type checked during preflight.
Definition ui_recipe_context.hpp:346
bool materialized
Resource properties already supplied materialized grid settings.
Definition ui_recipe_context.hpp:349
ControlSettings patch
Sparse instance overrides applied after positional literals.
Definition ui_recipe_context.hpp:345
ControlSettings arguments
Positional grid literals retained for fallback-schema resolution.
Definition ui_recipe_context.hpp:344
bool settingsRequested
Explicit settings or variant modifiers were requested.
Definition ui_recipe_context.hpp:350
bool prepared
Settings were already resolved and validated.
Definition ui_recipe_context.hpp:348
Recognize exact native chart recipes without admitting arbitrary subclasses.
Definition ui_recipe_context.hpp:61
Recognize an owning recipe after cv/ref normalization.
Definition ui_recipe_context.hpp:35
Recognize exact provider-bound list recipes, excluding arbitrary derived controls.
Definition ui_recipe_context.hpp:45
Recognize exact provider-bound table recipes, excluding arbitrary derived controls.
Definition ui_recipe_context.hpp:53
Transaction-local dependency; it never survives mount or schedules runtime work.
Definition ui_recipe_context.hpp:584
std::shared_ptr< RefTarget > source
Original weak observation, resolved after every sibling has mounted.
Definition ui_recipe_context.hpp:586
Node< Control > receiver
Newly created caption receiving this transaction's initial value.
Definition ui_recipe_context.hpp:585
portals::detail::MoveOnlyFunction< std::expected< void, ManagedError >()> complete
Owning mount-only action.
Definition ui_recipe_context.hpp:588
bool completed
True after source-first initial synchronization and observation registration succeed.
Definition ui_recipe_context.hpp:587
Same-attempt Ref reservation used by cold graph finalization before publication.
Definition ui_recipe_context.hpp:576
RefTarget target
Checked private identity used only by cold finalization.
Definition ui_recipe_context.hpp:578
const RefTarget * identity
Original unpublished slot identity; never dereferenced from another thread.
Definition ui_recipe_context.hpp:577
Stack-owned transaction bookkeeping, discarded after one description mount.
Definition ui_recipe_context.hpp:554
std::vector< portals::detail::MoveOnlyFunction< void()> > publish
Nonthrowing assignments publishing reserved refs.
Definition ui_recipe_context.hpp:570
const ControlSettings * frameSettings
Current source frame patch only; never inherited by children.
Definition ui_recipe_context.hpp:564
std::vector< portals::detail::MoveOnlyFunction< void()> > release
Nonthrowing releases of temporary ref reservations.
Definition ui_recipe_context.hpp:572
const TextResolver * messageResolver
Opted-in MessageBox constructor-only fallback; cleared before children.
Definition ui_recipe_context.hpp:560
std::vector< PendingRef > pending
Private same-attempt reservations.
Definition ui_recipe_context.hpp:581
Node< Widget > root
First created node; identifies the subtree to retire on failure.
Definition ui_recipe_context.hpp:567
std::vector< portals::detail::MoveOnlyFunction< void()> > rollback
Explicit attempt-owned resources, never numeric checkpoints.
Definition ui_recipe_context.hpp:596
ControlContext controls
Immutable owning defaults for this mount transaction.
Definition ui_recipe_context.hpp:555
std::vector< Node< Widget > > nodes
Created observers checked for liveness before publication.
Definition ui_recipe_context.hpp:568
~MountContext()
Release attempt-owned resources and ref reservations after publication or rollback.
Definition ui_recipe_context.hpp:602
bool controlPrepared
Only the current constructor received already resolved resource settings.
Definition ui_recipe_context.hpp:557
const TextResolver * themeSelectorResolver
Constructor-only selector fallback, cleared before internal children.
Definition ui_recipe_context.hpp:559
std::size_t controlLeaves
Effective settings counted across the complete transaction.
Definition ui_recipe_context.hpp:556
Description< Widget > * messageBody
Constructor-scoped owning cold source, never retained after mount.
Definition ui_recipe_context.hpp:563
Node< Widget > mountedOuter
Last synchronous mount's actual layout root, including through type erasure.
Definition ui_recipe_context.hpp:566
bool committed
True only after every finalizer and node check succeeds.
Definition ui_recipe_context.hpp:599
const TextResolver * dataStateResolver
Native fallback constructor-only borrow; never ambient to body/setup.
Definition ui_recipe_context.hpp:561
std::vector< CaptionFinalizer > captions
Fallible checked-STL construction stays inside mount's error boundary.
Definition ui_recipe_context.hpp:591
const FrameOptions * frameOptions
Current native ScrollArea constructor only; never inherited by children.
Definition ui_recipe_context.hpp:565
std::vector< portals::detail::MoveOnlyFunction< std::expected< void, ManagedError >()> > finalize
Pure cold graph completion.
Definition ui_recipe_context.hpp:593
const ControlSettings * controlSettings
Constructor-only borrowed settings; restored before setup/children.
Definition ui_recipe_context.hpp:562
Cold layout values only; released with the single-use construction transaction.
Definition ui_recipe_context.hpp:355
bool stickyHeader
Header sticky setting copied from its section.
Definition ui_recipe_context.hpp:374
bool needsChoiceHost
A choice popup needs the existing scene-level overlay owner.
Definition ui_recipe_context.hpp:362
std::size_t bodySections
Number of structural body sections.
Definition ui_recipe_context.hpp:372
GridItemOptions item
Parent-child placement, never inherited from control defaults.
Definition ui_recipe_context.hpp:356
std::optional< DeclarativeGridOptions > grid
Present only after declarative opt-in.
Definition ui_recipe_context.hpp:366
bool validRecipe
An empty consuming child fails before any mount effects.
Definition ui_recipe_context.hpp:360
std::unique_ptr< GridPlacementPlan > plan
Origins established before any constructor or setup.
Definition ui_recipe_context.hpp:367
bool itemRequested
Distinguish ordinary defaults from an explicitly requested relationship.
Definition ui_recipe_context.hpp:357
std::unique_ptr< std::vector< AxisSize > > rowSizes
Cold owning body-row policies; header stays independent.
Definition ui_recipe_context.hpp:383
GridPresentation presentation
Owning grid background and paint-budget settings.
Definition ui_recipe_context.hpp:376
std::size_t headerSections
Number of structural header sections.
Definition ui_recipe_context.hpp:371
std::size_t directItems
Number of children outside structural sections.
Definition ui_recipe_context.hpp:373
std::optional< CellStyle > headerStyle
Optional header-section background.
Definition ui_recipe_context.hpp:377
bool validSections
Whether section placement modifiers are valid.
Definition ui_recipe_context.hpp:375
bool gridContainer
True only for the standard grid recipe.
Definition ui_recipe_context.hpp:358
std::vector< NodeId > mounted
Full identities collected during child mount.
Definition ui_recipe_context.hpp:370
bool validated
This cold graph has completed its parent-aware preflight.
Definition ui_recipe_context.hpp:359
bool hasDeclaredGrid
Cold composition contains an explicitly configured standard Grid.
Definition ui_recipe_context.hpp:361
std::optional< CellStyle > bodyStyle
Optional body-section background.
Definition ui_recipe_context.hpp:378
std::optional< GridRowStyles > rowStyles
Optional alternating body-row backgrounds.
Definition ui_recipe_context.hpp:379
std::unique_ptr< GridRecipeControl > control
Deferred grid control settings.
Definition ui_recipe_context.hpp:381
std::function< std::expected< std::pair< bool, bool >, ManagedError >(ControlContext)> choiceProbe
Owning cold metadata probe; never mounts nodes or invokes application factories.
Definition ui_recipe_context.hpp:365
std::unique_ptr< std::vector< AxisSize > > columnSizes
Cold owning shared-column policies, absent by default.
Definition ui_recipe_context.hpp:382
std::optional< GridScrollOptions > scroll
Optional owning scroll settings.
Definition ui_recipe_context.hpp:380
std::vector< std::shared_ptr< RecipeLayout > > children
Cold child metadata in insertion order.
Definition ui_recipe_context.hpp:368
bool hasOverlayHost
A declared overlay owner already exists in this cold graph.
Definition ui_recipe_context.hpp:363
Shared observation; publication and all mutable fields belong to the constructing UI thread.
Definition ui_ref.hpp:71
Finite native composite capability shared only across cold recipe erasure, never mounted records.
Definition ui_recipe_context.hpp:542
std::shared_ptr< Description< Widget > > body
Optional owning resource body, consumed once by native construction.
Definition ui_recipe_context.hpp:550
bool prepared
Whether the source packet has been installed before construction.
Definition ui_recipe_context.hpp:549
ControlFactoryKind kind
Actual native producer, independent of C++ widget type.
Definition ui_recipe_context.hpp:545
ControlPropertyPresence materialized
Leaves already reserved by resource preparation.
Definition ui_recipe_context.hpp:548
ControlSettings source
Owning effective resource inputs for the actual native producer.
Definition ui_recipe_context.hpp:547