Collapse inventory dropdown surface state

This commit is contained in:
Meta Vens 2026-06-29 08:53:42 +01:00
commit 23e2653dac
2 changed files with 18 additions and 42 deletions

View file

@ -6627,7 +6627,6 @@ static void RequireInventoryDropdownUseEveSurface(string root)
"public readonly struct AetheriaRuntimeInventoryDropdownCommand",
"public static class AetheriaRuntimeInventoryDropdownSurfaceCommands",
"public static bool TryRead(",
"AetheriaRuntimeInventoryDropdownSurfaceState",
"AetheriaRuntimeInventoryDropdownGroup",
"AetheriaRuntimeInventoryDropdownOption",
"AetheriaRuntimeInventoryDropdownEntityOption",
@ -6644,7 +6643,7 @@ static void RequireInventoryDropdownUseEveSurface(string root)
"public static string EntityBayCommand(",
"public static string EntityCommand(",
"public static string LoadoutCommand(",
"public static AetheriaRuntimeSurfaceDocument Build(",
"private static AetheriaRuntimeSurfaceDocument Build(",
"providerKind: \"inventory.panel\"",
"The observing client lists available inventory navigation; the shared runtime surface owns the dropdown contract."
};
@ -6658,11 +6657,13 @@ static void RequireInventoryDropdownUseEveSurface(string root)
string.Join(", ", missingBuilderSymbols));
}
if (inventoryDropdownSurfaceBuilder.Contains("public AetheriaRuntimeInventoryDropdownSurfaceState State { get; }", StringComparison.Ordinal) ||
if (inventoryDropdownSurfaceBuilder.Contains("AetheriaRuntimeInventoryDropdownSurfaceState", StringComparison.Ordinal) ||
inventoryDropdownSurfaceBuilder.Contains("public AetheriaRuntimeInventoryDropdownSurfaceState State { get; }", StringComparison.Ordinal) ||
inventoryDropdownSurfaceBuilder.Contains("public static AetheriaRuntimeSurfaceDocument Build(", StringComparison.Ordinal) ||
inventoryDropdownSurfaceBuilder.Contains("public static AetheriaRuntimeInventoryDropdownSurfaceModel Compose(", StringComparison.Ordinal))
{
throw new InvalidOperationException(
"Shared runtime inventory dropdown builder must return a model with a finished surface document; do not re-expose Compose or a public State handoff.");
"Shared runtime inventory dropdown builder must return a model with a finished surface document; do not rebuild a shadow SurfaceState projection layer.");
}
}

View file

@ -37,23 +37,6 @@ namespace GameCult.Aetheria.State.Verse
public IReadOnlyList<AetheriaRuntimeInventoryDropdownOption> Options { get; }
}
public sealed class AetheriaRuntimeInventoryDropdownSurfaceState
{
public AetheriaRuntimeInventoryDropdownSurfaceState(
string currentView,
IReadOnlyList<AetheriaRuntimeInventoryDropdownGroup> groups,
string updatedAtUtc)
{
CurrentView = currentView ?? "";
Groups = groups ?? Array.Empty<AetheriaRuntimeInventoryDropdownGroup>();
UpdatedAtUtc = updatedAtUtc ?? "";
}
public string CurrentView { get; }
public IReadOnlyList<AetheriaRuntimeInventoryDropdownGroup> Groups { get; }
public string UpdatedAtUtc { get; }
}
public sealed class AetheriaRuntimeInventoryDropdownEntityOption
{
public AetheriaRuntimeInventoryDropdownEntityOption(
@ -154,11 +137,7 @@ namespace GameCult.Aetheria.State.Verse
AetheriaRuntimeSurfaceDocument document,
IReadOnlyDictionary<string, AetheriaRuntimeInventoryDropdownSelection> selections)
{
Document = document ?? AetheriaRuntimeInventoryDropdownSurfaceBuilder.Build(
new AetheriaRuntimeInventoryDropdownSurfaceState(
"",
Array.Empty<AetheriaRuntimeInventoryDropdownGroup>(),
""));
Document = document ?? throw new ArgumentNullException(nameof(document));
Selections = selections ?? new Dictionary<string, AetheriaRuntimeInventoryDropdownSelection>(StringComparer.Ordinal);
}
@ -335,22 +314,18 @@ namespace GameCult.Aetheria.State.Verse
loadoutOptions));
}
var state = new AetheriaRuntimeInventoryDropdownSurfaceState(
currentView,
groups,
updatedAtUtc);
return new AetheriaRuntimeInventoryDropdownSurfaceModel(Build(state), selections);
return new AetheriaRuntimeInventoryDropdownSurfaceModel(
Build(currentView, groups, updatedAtUtc),
selections);
}
public static AetheriaRuntimeSurfaceDocument Build(
AetheriaRuntimeInventoryDropdownSurfaceState state,
private static AetheriaRuntimeSurfaceDocument Build(
string currentView,
IReadOnlyList<AetheriaRuntimeInventoryDropdownGroup> groups,
string updatedAtUtc,
long version = 1)
{
state ??= new AetheriaRuntimeInventoryDropdownSurfaceState(
"",
Array.Empty<AetheriaRuntimeInventoryDropdownGroup>(),
"");
groups ??= Array.Empty<AetheriaRuntimeInventoryDropdownGroup>();
var children = new List<AetheriaRuntimeSurfaceComponent>
{
@ -360,13 +335,13 @@ namespace GameCult.Aetheria.State.Verse
Metric(
$"{SurfaceId}.current",
"Current View",
string.IsNullOrWhiteSpace(state.CurrentView) ? "None" : state.CurrentView),
string.IsNullOrWhiteSpace(currentView) ? "None" : currentView),
Text(
$"{SurfaceId}.note",
"The observing client lists available inventory navigation; the shared runtime surface owns the dropdown contract."))
};
foreach (var group in state.Groups)
foreach (var group in groups)
{
if (group?.Options == null || group.Options.Count == 0)
continue;
@ -383,7 +358,7 @@ namespace GameCult.Aetheria.State.Verse
$"{SurfaceId}.actions",
Button($"{SurfaceId}.close", "Close", Close)));
var commands = state.Groups
var commands = groups
.Where(group => group?.Options != null)
.SelectMany(group => group.Options)
.Where(option => option?.IsCommand == true)
@ -396,7 +371,7 @@ namespace GameCult.Aetheria.State.Verse
providerKind: "inventory.panel",
title: "Inventory Dropdown",
version: version,
updatedAtUtc: state.UpdatedAtUtc,
updatedAtUtc: updatedAtUtc ?? "",
surface: new AetheriaRuntimeSurfaceTree(
SurfaceId,
Node(