@* Static TwinCAT address builder: ADS variable name (free text) → verbatim *@

<div class="row g-3">
    <div class="col-md-8">
        <label class="form-label">ADS variable name</label>
        <input type="text" class="form-control form-control-sm mono" placeholder="MAIN.fValue"
               @bind="_varName" @bind:after="OnChangedAsync" />
        <div class="form-text">
            Full ADS symbol path, e.g. <code>MAIN.fValue</code> or <code>GVL.iCounter</code>.
        </div>
    </div>
</div>

<div class="mt-3">
    <span class="text-muted small">Result:</span>
    <code class="mono ms-2">@_built</code>
</div>

@code {
    [Parameter] public string CurrentAddress { get; set; } = "";
    [Parameter] public EventCallback<string> CurrentAddressChanged { get; set; }

    private string _varName = "";
    private string _built = "";

    protected override void OnInitialized()
    {
        _built = _varName;
        _ = CurrentAddressChanged.InvokeAsync(_built);
    }

    private async Task OnChangedAsync()
    {
        _built = _varName;
        await CurrentAddressChanged.InvokeAsync(_built);
    }
}
