A small readonly record struct representing an interaction gesture in the editor architecture. It encodes a kind, an item id and an optional control path, exposes factory and helper methods to build control-qualified keys, and provides a Key string and ToString override.
namespace Sunless.Architecture;
// What a drag is ABOUT, rather than a string the caller happened to compose. Two widgets that key alike share one
// accumulated travel, so the identity has to say which kind, which authored payload and which of that payload's
// controls was grabbed - and a leaf may name its own control without minting a plan-wide namespace.
public readonly record struct ArchGesture( ArchKind Kind, int Item, string Control )
{
public static ArchGesture On( ArchKind kind, int item ) => new( kind, item, null );
public ArchGesture At( string control ) => this with { Control = Control is null ? control : $"{Control}.{control}" };
public ArchGesture At( string control, int index ) => At( $"{control}.{index}" );
public string Key => Control is null ? $"{Kind.Ident}#{Item}" : $"{Kind.Ident}#{Item}.{Control}";
public override string ToString() => Key;
}