admin/client: fix deck editor concurrency, live search, iOS autofill

PrebuiltDeckEditor.razor:
- Add Db.ChangeTracker.Clear() at OnInitializedAsync start to prevent
  stale Deleted/Modified entities from prior circuit pages causing
  DbUpdateConcurrencyException on save
- Replace @bind + button-only search with @oninput + 300ms debounce for
  both card and arch-spirit search inputs (results appear as you type;
  search button retained as manual fallback)
- Clearing the input immediately clears previous results

LoginScreen.tscn:
- Set virtual_keyboard_type = 5 (EMAIL_ADDRESS) on EmailInput and
  RegEmailInput so Godot's experimental virtual keyboard creates
  <input type="email"> instead of type="text" on mobile/web

export_presets.cfg:
- Extend head_include with a MutationObserver that watches for virtual
  keyboard INPUT elements and sets autocomplete="username" on email
  inputs and autocomplete="current-password" on password inputs,
  enabling iOS Face ID / Touch ID password vault autofill

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
dingo
2026-02-28 23:00:13 -05:00
co-authored by Claude Happy
parent 2dcb5c48c8
commit 773fc6a349
3 changed files with 44 additions and 3 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ vram_texture_compression/for_desktop=true
vram_texture_compression/for_mobile=true
html/export_icon=true
html/custom_html_shell=""
html/head_include="<script>window.addEventListener('load',function(){var c=document.querySelector('canvas');if(c){c.style.touchAction='auto';}var m=document.querySelector('meta[name=viewport]');if(m){m.setAttribute('content','width=device-width,initial-scale=1.0,user-scalable=yes,maximum-scale=5.0');}else{var t=document.createElement('meta');t.name='viewport';t.content='width=device-width,initial-scale=1.0,user-scalable=yes,maximum-scale=5.0';document.head.appendChild(t);}});</script>"
html/head_include="<script>(function(){function tag(n){if(n.tagName==='INPUT'){if(n.type==='email')n.setAttribute('autocomplete','username');if(n.type==='password')n.setAttribute('autocomplete','current-password');}var kids=n.querySelectorAll&&n.querySelectorAll('input[type=email],input[type=password]');if(kids)kids.forEach(tag);}new MutationObserver(function(ms){ms.forEach(function(m){m.addedNodes.forEach(function(n){if(n.nodeType===1)tag(n);});});}).observe(document.documentElement,{childList:true,subtree:true});window.addEventListener('load',function(){var c=document.querySelector('canvas');if(c)c.style.touchAction='auto';var mv=document.querySelector('meta[name=viewport]');if(mv)mv.setAttribute('content','width=device-width,initial-scale=1.0,user-scalable=yes,maximum-scale=5.0');else{var t=document.createElement('meta');t.name='viewport';t.content='width=device-width,initial-scale=1.0,user-scalable=yes,maximum-scale=5.0';document.head.appendChild(t);};});})();</script>"
html/canvas_resize_policy=2
html/focus_canvas_on_start=true
html/experimental_virtual_keyboard=true
@@ -77,6 +77,7 @@ unique_name_in_owner = true
layout_mode = 2
custom_minimum_size = Vector2(0, 44)
placeholder_text = "your@email.com"
virtual_keyboard_type = 5
theme_override_font_sizes/font_size = 15
[node name="PasswordLabel" type="Label" parent="Center/Panel/Margin/VBox/Tabs/Login"]
@@ -115,6 +116,7 @@ unique_name_in_owner = true
layout_mode = 2
custom_minimum_size = Vector2(0, 44)
placeholder_text = "your@email.com"
virtual_keyboard_type = 5
theme_override_font_sizes/font_size = 15
[node name="RegPasswordLabel" type="Label" parent="Center/Panel/Margin/VBox/Tabs/Register"]
@@ -121,7 +121,8 @@ else
</div>
}
<div class="input-group">
<input @bind="_archSearch" class="form-control form-control-sm"
<input value="@_archSearch" @oninput="OnArchSearchInput"
class="form-control form-control-sm"
placeholder="Search ArchSpirit by name…" />
<button class="btn btn-outline-secondary btn-sm" @onclick="SearchArchSpiritsAsync">
<i class="bi bi-search"></i>
@@ -152,7 +153,8 @@ else
<div class="card-body">
<!-- Search + add -->
<div class="input-group mb-3">
<input @bind="_cardSearch" class="form-control form-control-sm"
<input value="@_cardSearch" @oninput="OnCardSearchInput"
class="form-control form-control-sm"
placeholder="Search card by name to add…" />
<button class="btn btn-outline-secondary btn-sm" @onclick="SearchCardsAsync">
<i class="bi bi-search"></i>
@@ -269,9 +271,16 @@ else
private List<CardDefinition> _cardResults = new();
private string _archSearch = string.Empty;
private List<CardDefinition> _archResults = new();
private CancellationTokenSource? _cardSearchCts;
private CancellationTokenSource? _archSearchCts;
protected override async Task OnInitializedAsync()
{
// Clear any entities tracked from previous pages in this circuit.
// Blazor Server scopes the DbContext to the SignalR circuit, so stale
// Deleted/Modified entities from a prior edit can bleed into this save.
Db.ChangeTracker.Clear();
_isNew = Id == null;
if (_isNew)
{
@@ -291,6 +300,36 @@ else
}
}
// ── Live search with 300 ms debounce ─────────────────────────────────────
private async Task OnCardSearchInput(ChangeEventArgs e)
{
_cardSearch = e.Value?.ToString() ?? "";
if (string.IsNullOrWhiteSpace(_cardSearch)) { _cardResults.Clear(); return; }
_cardSearchCts?.Cancel();
_cardSearchCts = new CancellationTokenSource();
try
{
await Task.Delay(300, _cardSearchCts.Token);
await SearchCardsAsync();
}
catch (OperationCanceledException) { }
}
private async Task OnArchSearchInput(ChangeEventArgs e)
{
_archSearch = e.Value?.ToString() ?? "";
if (string.IsNullOrWhiteSpace(_archSearch)) { _archResults.Clear(); return; }
_archSearchCts?.Cancel();
_archSearchCts = new CancellationTokenSource();
try
{
await Task.Delay(300, _archSearchCts.Token);
await SearchArchSpiritsAsync();
}
catch (OperationCanceledException) { }
}
private async Task SearchCardsAsync()
{
if (string.IsNullOrWhiteSpace(_cardSearch)) return;