diff --git a/src/Aquarium.Engine.Contracts/Ui/AquariumUi.cs b/src/Aquarium.Engine.Contracts/Ui/AquariumUi.cs index d6bbdf3..70b9881 100644 --- a/src/Aquarium.Engine.Contracts/Ui/AquariumUi.cs +++ b/src/Aquarium.Engine.Contracts/Ui/AquariumUi.cs @@ -98,6 +98,25 @@ public sealed record AquariumUiLayout( public sealed record AquariumUiStyle(string Variant = "default", string Tone = "neutral"); +public sealed record AquariumUiBinding( + string DocumentSchema, + string DocumentId, + string Path, + string ValueKind, + string Access = "read", + string Authority = "", + string? CommandId = null) +{ + public static AquariumUiBinding Read(string documentSchema, string documentId, string path, string valueKind, string authority = "") + => new(documentSchema, documentId, path, valueKind, "read", authority); + + public static AquariumUiBinding ReadWrite(string documentSchema, string documentId, string path, string valueKind, string authority = "") + => new(documentSchema, documentId, path, valueKind, "read-write", authority); + + public static AquariumUiBinding Command(string documentSchema, string documentId, string path, string authority, string commandId) + => new(documentSchema, documentId, path, "command", "command", authority, commandId); +} + public sealed record AquariumUiPreviewItem( string Id, string Label, @@ -135,6 +154,7 @@ public sealed record AquariumUiElement( string? Role = null, AquariumUiLayout? Layout = null, AquariumUiStyle? Style = null, + AquariumUiBinding? Binding = null, Func? ReadText = null, Func? ReadMetric = null, Func? ReadToggle = null, @@ -200,45 +220,45 @@ public sealed class AquariumUiSurfaceBuilder(List children) return this; } - public AquariumUiSurfaceBuilder Text(string id, string text, string role = "body", float weight = 1.0f, Func? isVisible = null) + public AquariumUiSurfaceBuilder Text(string id, string text, string role = "body", float weight = 1.0f, Func? isVisible = null, AquariumUiBinding? binding = null) { - children.Add(new AquariumUiElement(id, "text", text, role, IsVisible: isVisible, Weight: Math.Max(0.001f, weight))); + children.Add(new AquariumUiElement(id, "text", text, role, Binding: binding, IsVisible: isVisible, Weight: Math.Max(0.001f, weight))); return this; } - public AquariumUiSurfaceBuilder Text(string id, Func read, string role = "body", float weight = 1.0f, Func? isVisible = null) + public AquariumUiSurfaceBuilder Text(string id, Func read, string role = "body", float weight = 1.0f, Func? isVisible = null, AquariumUiBinding? binding = null) { - children.Add(new AquariumUiElement(id, "text", Role: role, ReadText: read, IsVisible: isVisible, Weight: Math.Max(0.001f, weight))); + children.Add(new AquariumUiElement(id, "text", Role: role, Binding: binding, ReadText: read, IsVisible: isVisible, Weight: Math.Max(0.001f, weight))); return this; } - public AquariumUiSurfaceBuilder Metric(string id, string label, Func read, string tone = "neutral", float weight = 1.0f) + public AquariumUiSurfaceBuilder Metric(string id, string label, Func read, string tone = "neutral", float weight = 1.0f, AquariumUiBinding? binding = null) { - children.Add(new AquariumUiElement(id, "metric", label, Style: new AquariumUiStyle("compact", tone), ReadMetric: read, Weight: Math.Max(0.001f, weight))); + children.Add(new AquariumUiElement(id, "metric", label, Style: new AquariumUiStyle("compact", tone), Binding: binding, ReadMetric: read, Weight: Math.Max(0.001f, weight))); return this; } - public AquariumUiSurfaceBuilder Toggle(string id, string label, Func read, Action write, float weight = 1.0f) + public AquariumUiSurfaceBuilder Toggle(string id, string label, Func read, Action write, float weight = 1.0f, AquariumUiBinding? binding = null) { - children.Add(new AquariumUiElement(id, "toggle", label, ReadToggle: read, WriteToggle: write, Weight: Math.Max(0.001f, weight))); + children.Add(new AquariumUiElement(id, "toggle", label, Binding: binding, ReadToggle: read, WriteToggle: write, Weight: Math.Max(0.001f, weight))); return this; } - public AquariumUiSurfaceBuilder Slider(string id, string label, Func read, Action write, float min, float max, string format = "0.###", float weight = 1.0f) + public AquariumUiSurfaceBuilder Slider(string id, string label, Func read, Action write, float min, float max, string format = "0.###", float weight = 1.0f, AquariumUiBinding? binding = null) { - children.Add(new AquariumUiElement(id, "slider", label, ReadFloat: read, WriteFloat: write, Min: min, Max: max, Format: format, Weight: Math.Max(0.001f, weight))); + children.Add(new AquariumUiElement(id, "slider", label, Binding: binding, ReadFloat: read, WriteFloat: write, Min: min, Max: max, Format: format, Weight: Math.Max(0.001f, weight))); return this; } - public AquariumUiSurfaceBuilder Options(string id, string label, Func read, Action write, IReadOnlyList options, float weight = 1.0f) + public AquariumUiSurfaceBuilder Options(string id, string label, Func read, Action write, IReadOnlyList options, float weight = 1.0f, AquariumUiBinding? binding = null) { - children.Add(new AquariumUiElement(id, "select", label, ReadOption: read, WriteOption: write, Options: options, Weight: Math.Max(0.001f, weight))); + children.Add(new AquariumUiElement(id, "select", label, Binding: binding, ReadOption: read, WriteOption: write, Options: options, Weight: Math.Max(0.001f, weight))); return this; } - public AquariumUiSurfaceBuilder Button(string id, string label, Action invoke, float weight = 1.0f, Func? isVisible = null) + public AquariumUiSurfaceBuilder Button(string id, string label, Action invoke, float weight = 1.0f, Func? isVisible = null, AquariumUiBinding? binding = null) { - children.Add(new AquariumUiElement(id, "button", label, Invoke: invoke, IsVisible: isVisible, Weight: Math.Max(0.001f, weight))); + children.Add(new AquariumUiElement(id, "button", label, Binding: binding, Invoke: invoke, IsVisible: isVisible, Weight: Math.Max(0.001f, weight))); return this; } @@ -250,7 +270,8 @@ public sealed class AquariumUiSurfaceBuilder(List children) bool blitOutputBuffer = false, Action? handleInteraction = null, Func? readState = null, - Func>? readGuides = null) + Func>? readGuides = null, + AquariumUiBinding? binding = null) { children.Add(new AquariumUiElement( id, @@ -259,6 +280,7 @@ public sealed class AquariumUiSurfaceBuilder(List children) ReadPreviewItems: readItems, ReadPreviewState: readState, ReadPreviewGuides: readGuides, + Binding: binding, PreviewBlitsOutputBuffer: blitOutputBuffer, HandlePreviewInteraction: handleInteraction, Weight: Math.Max(0.001f, weight))); diff --git a/state/evidence.jsonl b/state/evidence.jsonl index 4e8fb9a..8f5d234 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -329,3 +329,5 @@ {"ts":"2026-06-01T13:48:00+01:00","type":"implementation","status":"ok","note":"CultUI preview elements now support direct compositor gestures. AquariumUiElement can carry a preview interaction callback, D3D12Renderer hit-tests preview item bodies and selected corner handles in normalized canvas coordinates, captures input while dragging, and DirectWriteOverlay draws visible selected corner handles. Clients still own gesture meaning; Fensalir owns the reusable UI hit-test and rendering affordance.","files":["src/Aquarium.Engine.Contracts/Ui/AquariumUi.cs","src/Aquarium.Engine/Render/D3D12Renderer.cs","src/Aquarium.Engine/Render/DirectWriteOverlay.cs"],"source":"dotnet build src/Aquarium.Engine.Contracts/Aquarium.Engine.Contracts.csproj -p:UseSharedCompilation=false; dotnet build src/Aquarium.Engine/Aquarium.Engine.csproj -p:UseSharedCompilation=false"} {"ts":"2026-06-01T14:12:00+01:00","type":"implementation","status":"ok","note":"CultUI preview affordances now include hover/active state, empty-canvas hits, drag-end events, and normalized guide rendering. D3D12Renderer emits hover/begin/drag/end interactions for preview bodies, handles, and empty canvas; DirectWriteOverlay draws hovered/active selected handles and client-provided x/y guides. Added Up/Down/PageUp/PageDown/Control key codes for editor hotkeys.","files":["src/Aquarium.Engine.Contracts/Input/InputState.cs","src/Aquarium.Engine.Contracts/Ui/AquariumUi.cs","src/Aquarium.Engine/Platform/Win32Window.cs","src/Aquarium.Engine/Render/D3D12Renderer.cs","src/Aquarium.Engine/Render/DirectWriteOverlay.cs"],"source":"dotnet build src/Aquarium.Engine.Contracts/Aquarium.Engine.Contracts.csproj -p:UseSharedCompilation=false; dotnet build src/Aquarium.Engine/Aquarium.Engine.csproj -p:UseSharedCompilation=false"} {"ts":"2026-06-01T15:05:00+01:00","type":"implementation","status":"ok","note":"Eve remains the portable dashboard authority; the C# Aquarium/CultUI UI contract is the reference API shape. Added content padding and fixed-extent layout fields to retained surface documents, made pane headers conditional, and kept DirectWrite drawing plus D3D12 preview hit-testing on the same document geometry. Mimir now uses this for an edge-to-edge headerless editor shell with fixed output controls and an expanding inspector.","files":["src/Aquarium.Engine.Contracts/Ui/AquariumUi.cs","src/Aquarium.Engine/Render/D3D12Renderer.cs","src/Aquarium.Engine/Render/DirectWriteOverlay.cs"],"source":"dotnet build src/Aquarium.Engine/Aquarium.Engine.csproj -p:UseSharedCompilation=false; dotnet build E:/Projects/Mimir/src/Mimir.App/Mimir.App.csproj -p:UseSharedCompilation=false; Mimir headless capture artifacts/runtime/mimir-output-panel-headless.png"} +{"ts":"2026-06-01T15:40:00+01:00","type":"implementation","status":"ok","note":"AquariumUiElement now carries an optional typed AquariumUiBinding descriptor for Verse-backed CultCache/CultMesh fields: document schema/id, field path, value kind, access, authority, and optional command id. Fensalir lowerings keep using local callbacks for native actuation; the binding is provenance/state authority metadata, not renderer-owned dashboard semantics.","files":["src/Aquarium.Engine.Contracts/Ui/AquariumUi.cs","state/map.yaml"]} +{"ts":"2026-06-01T15:48:00+01:00","type":"verification","status":"ok","note":"Release build passed for Aquarium.Engine after adding AquariumUiBinding; Mimir Release builds and scene-editor smoke also passed against the updated contract.","files":["src/Aquarium.Engine.Contracts/Ui/AquariumUi.cs"],"source":"dotnet build src/Aquarium.Engine/Aquarium.Engine.csproj -c Release -p:UseSharedCompilation=false; dotnet run --project E:/Projects/Mimir/src/Mimir.BufferSmoke/Mimir.BufferSmoke.csproj -c Release -- --scene-editor-smoke"} diff --git a/state/map.yaml b/state/map.yaml index a8ce44f..7762807 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -92,7 +92,9 @@ invariants: - Eve is the portable retained-dashboard authority. The C# Aquarium/CultUI contract is the reference API shape for those documents; Fensalir Direct2D and D3D12 hit testing lower that document locally, but must not become the - owner of dashboard semantics or client policy. + owner of dashboard semantics or client policy. `AquariumUiBinding` names + the Verse-backed CultCache/CultMesh field behind a UI element; local + callbacks remain lowering actuators, not a second state authority. - Final composition reads the resolved HDR field texture produced by the shared reservoir history update pass. TubeField render lowerings inject visibility proposals into the shared field reservoir; they must not regain @@ -135,6 +137,9 @@ invariants: CultMesh UI documents. The adapter should lower those documents into `AquariumUiDocument` and route commands back through Eve/CultNet; provider repos still own dashboard state, accepted commands, and meaning. CultUI + bindings carry document schema/id, path, value kind, access, authority, and + optional command id so provider state can move into CultCache without + changing the native renderer contract. preview elements may expose reusable item-body/corner-handle gestures in normalized preview coordinates, but the client remains the owner of what those gestures do. The preview primitive also carries hover/active state,