feat(ability-builder): full inspector parity with form view in canvas mode

Every canvas node now exposes all editable properties and delete actions
in the right-hand Inspector panel:

Meta node
  - Duration override (all types, ForNTurns N)
  - Aura type: AuraRangeMin/Max, On-Leave mode radios, linger duration

Trigger node
  - Trigger-specific parameter fields (RenderTriggerFields) wired in after
    the event type select; was previously missing entirely

Cost node (new)
  - CostGroup Logic Op + Chooser Role
  - Inline per-cost type select + amount input + per-entry delete button
  - Add Cost button

Conditions node (new)
  - Per-condition type, subject, parameter fields (RenderConditionFields)
  - Per-entry delete button
  - Add Condition button

Sub-group node
  - Delete Sub-Group button

Action / sg-action node
  - Target Filter dropdown
  - Action-level Conditions section (add / edit type+subject+params / delete)
  - Delete Action button

Effect / sg-effect node
  - Full effect parameter fields (RenderEffectFields) replacing the old
    "Switch to Form View" placeholder
  - SummonToken redirects to Form View (token editor is too wide for panel)
  - Delete Effect button

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-04-21 20:32:42 -04:00
co-authored by Claude Happy
parent 2575d700f4
commit e3e9ca66cf
@@ -1246,6 +1246,8 @@
@if (inAi >= 0 && inAi < _abilities.Count)
{
var inAb = _abilities[inAi];
@* ── Meta node ── *@
@if (inKind == "meta")
{
<label class="form-label small mb-0">Type</label>
@@ -1256,7 +1258,66 @@
<input class="form-control form-control-sm mb-2" @bind="inAb.Name" @bind:after="Compile" />
<label class="form-label small mb-0">Description</label>
<textarea class="form-control form-control-sm mb-2" rows="3" @bind="inAb.Description" @bind:after="Compile"></textarea>
@* Aura-specific *@
@if (inAb.TypeStr == "Aura")
{
<label class="form-label small mb-0">Aura Range Min</label>
<input type="number" class="form-control form-control-sm mb-1" @bind="inAb.AuraRangeMin" @bind:after="Compile" />
<label class="form-label small mb-0">Aura Range Max</label>
<input type="number" class="form-control form-control-sm mb-2" @bind="inAb.AuraRangeMax" @bind:after="Compile" />
<label class="form-label small mb-1">On Leave Range</label>
<div class="d-flex flex-column gap-1 mb-2">
<div class="form-check mb-0">
<input class="form-check-input" type="radio" name="inAuraLeave"
id="inAuraLeaveNone"
checked="@(string.IsNullOrEmpty(inAb.AuraLingerDurationStr) && !inAb.AuraClearOnLeave)"
@onchange="() => SetAuraLeaveMode(inAb, 0)" />
<label class="form-check-label small" for="inAuraLeaveNone">Persist</label>
</div>
<div class="form-check mb-0">
<input class="form-check-input" type="radio" name="inAuraLeave"
id="inAuraClear"
checked="@(inAb.AuraClearOnLeave && string.IsNullOrEmpty(inAb.AuraLingerDurationStr))"
@onchange="() => SetAuraLeaveMode(inAb, 1)" />
<label class="form-check-label small" for="inAuraClear">Clear immediately</label>
</div>
<div class="form-check mb-0">
<input class="form-check-input" type="radio" name="inAuraLeave"
id="inAuraLinger"
checked="@(!string.IsNullOrEmpty(inAb.AuraLingerDurationStr))"
@onchange="() => SetAuraLeaveMode(inAb, 2)" />
<label class="form-check-label small" for="inAuraLinger">Linger</label>
</div>
</div>
@if (!string.IsNullOrEmpty(inAb.AuraLingerDurationStr))
{
<label class="form-label small mb-0">Linger Duration</label>
<select class="form-select form-select-sm mb-1" @bind="inAb.AuraLingerDurationStr" @bind:after="Compile">
@foreach (var d in DurationTypeValues) { <option value="@d">@d</option> }
</select>
@if (inAb.AuraLingerDurationStr == "ForNTurns")
{
<label class="form-label small mb-0">N</label>
<input type="number" min="1" class="form-control form-control-sm mb-2" @bind="inAb.AuraLingerDurationN" @bind:after="Compile" />
}
}
}
@* Duration override (all types) *@
<label class="form-label small mb-0">Duration override</label>
<select class="form-select form-select-sm mb-1" @bind="inAb.DurationStr" @bind:after="Compile">
<option value="">— per-action —</option>
@foreach (var d in DurationTypeValues) { <option value="@d">@d</option> }
</select>
@if (inAb.DurationStr == "ForNTurns")
{
<label class="form-label small mb-0">N</label>
<input type="number" min="1" class="form-control form-control-sm mb-2" @bind="inAb.DurationN" @bind:after="Compile" />
}
}
@* ── Range node (Active) ── *@
else if (inKind == "range")
{
<label class="form-label small mb-0">Min Range</label>
@@ -1274,16 +1335,108 @@
<label class="form-label small mb-0">Uses/Turn</label>
<input type="number" class="form-control form-control-sm" @bind="inAb.UsesPerTurn" @bind:after="Compile" min="1" />
}
@* ── Trigger node ── *@
else if (inKind == "trigger")
{
<label class="form-label small mb-0">Trigger Event</label>
<select class="form-select form-select-sm mb-2" @bind="inAb.TriggerType" @bind:after="Compile">
<select class="form-select form-select-sm mb-2"
value="@inAb.TriggerType"
@onchange="e => SelectTrigger(inAb, (string)e.Value!)">
<option value="">(none)</option>
@foreach (var tt in TriggerTypesList) { <option value="@tt">@tt</option> }
</select>
@if (!string.IsNullOrEmpty(inAb.TriggerType))
{
<div class="d-flex flex-wrap gap-1 mb-2">
@RenderTriggerFields(inAb)
</div>
}
<label class="form-label small mb-0">Limit/Turn</label>
<input type="number" class="form-control form-control-sm" @bind="inAb.TriggerLimitPerTurn" @bind:after="Compile" />
<input type="number" class="form-control form-control-sm" @bind="inAb.TriggerLimitPerTurn" @bind:after="Compile" placeholder="unlimited" />
}
@* ── Cost node ── *@
else if (inKind == "cost")
{
<label class="form-label small mb-0">Logic Op</label>
<select class="form-select form-select-sm mb-1" @bind="inAb.CostGroupLogicOp" @bind:after="Compile">
@foreach (var op in LogicOpValues) { <option value="@op">@op</option> }
</select>
@if (inAb.CostGroupLogicOp != "And")
{
<label class="form-label small mb-0">Chooser</label>
<select class="form-select form-select-sm mb-2" @bind="inAb.CostGroupChooserRole" @bind:after="Compile">
@foreach (var r in ChooserRoleValues) { <option value="@r">@r</option> }
</select>
}
<hr class="my-2" />
@for (int inCi = 0; inCi < inAb.Costs.Count; inCi++)
{
int inCidx = inCi;
var inCost = inAb.Costs[inCidx];
<div class="mb-1">
<div class="d-flex gap-1 align-items-center">
<button class="btn btn-sm btn-outline-danger py-0 px-1 flex-shrink-0"
@onclick="() => { inAb.Costs.RemoveAt(inCidx); Compile(); }">
<i class="bi bi-x"></i>
</button>
<select class="form-select form-select-sm flex-grow-1"
@bind="inCost.TypeStr" @bind:after="Compile">
@foreach (var ct in CostTypes) { <option value="@ct">@ct</option> }
</select>
</div>
<input type="number" min="1" class="form-control form-control-sm mt-1"
@bind="inCost.Amount" @bind:after="Compile" placeholder="Amount" />
</div>
}
<button class="btn btn-sm btn-outline-secondary w-100 mt-1 py-0"
@onclick="() => { inAb.Costs.Add(new CostDraft()); Compile(); }">
<i class="bi bi-plus-lg me-1"></i>Add Cost
</button>
}
@* ── Conditions node ── *@
else if (inKind == "cond")
{
@for (int inCondI = 0; inCondI < inAb.Conditions.Count; inCondI++)
{
int inCondIdx = inCondI;
var inCond = inAb.Conditions[inCondIdx];
<div class="border rounded p-1 mb-1" style="overflow-x:auto">
<div class="d-flex gap-1 align-items-center mb-1">
<select class="form-select form-select-sm flex-grow-1"
@bind="inCond.TypeStr" @bind:after="Compile">
@foreach (var grp in ConditionGroups)
{
<optgroup label="@grp.Label">
@foreach (var ct in grp.Types)
{ <option value="@ct">@ct</option> }
</optgroup>
}
</select>
<button class="btn btn-sm btn-outline-danger py-0 px-1 flex-shrink-0"
@onclick="() => { inAb.Conditions.RemoveAt(inCondIdx); Compile(); }">
<i class="bi bi-x"></i>
</button>
</div>
<div class="d-flex gap-1 flex-wrap align-items-center">
<select class="form-select form-select-sm" style="width:80px"
@bind="inCond.Subject" @bind:after="Compile" title="Subject">
<option value="Self">Self</option>
<option value="Target">Target</option>
</select>
@RenderConditionFields(inCond)
</div>
</div>
}
<button class="btn btn-sm btn-outline-secondary w-100 mt-1 py-0"
@onclick="() => { inAb.Conditions.Add(new ConditionDraft()); Compile(); }">
<i class="bi bi-plus-lg me-1"></i>Add Condition
</button>
}
@* ── ActionGroup node ── *@
else if (inKind == "group")
{
<label class="form-label small mb-0">Logic Op</label>
@@ -1298,6 +1451,8 @@
</select>
}
}
@* ── Sub-group node ── *@
else if (inKind == "subgroup" && inJ >= 0 && inJ < inAb.SubGroups.Count)
{
var inSg = inAb.SubGroups[inJ];
@@ -1308,11 +1463,18 @@
@if (inSg.LogicOp != "And")
{
<label class="form-label small mb-0">Chooser Role</label>
<select class="form-select form-select-sm" @bind="inSg.ChooserRole" @bind:after="Compile">
<select class="form-select form-select-sm mb-2" @bind="inSg.ChooserRole" @bind:after="Compile">
@foreach (var r in ChooserRoleValues) { <option value="@r">@r</option> }
</select>
}
<hr class="my-1" />
<button class="btn btn-sm btn-outline-danger w-100 py-0"
@onclick="() => { inAb.SubGroups.RemoveAt(inJ); _selectedNode = null; Compile(); }">
<i class="bi bi-trash me-1"></i>Delete Sub-Group
</button>
}
@* ── Action / sg-action node ── *@
else if ((inKind == "action" || inKind == "sgaction") && inJ >= 0)
{
ActionDraft? inAct = null;
@@ -1340,28 +1502,105 @@
@foreach (var s in ChooserRoleValues) { <option value="@s">@s</option> }
</select>
<div class="form-check mb-1">
<input class="form-check-input" type="checkbox" id="inAll" @bind="inAct.All" @bind:after="Compile" />
<label class="form-check-label small" for="inAll">All targets</label>
<input class="form-check-input" type="checkbox" id="inAll_@(_selectedNode)" @bind="inAct.All" @bind:after="Compile" />
<label class="form-check-label small" for="inAll_@(_selectedNode)">All targets</label>
</div>
@if (!inAct.All)
{
<label class="form-label small mb-0">Count</label>
<input type="number" class="form-control form-control-sm" @bind="inAct.Count" @bind:after="Compile" min="1" />
<input type="number" class="form-control form-control-sm mb-1" @bind="inAct.Count" @bind:after="Compile" min="1" />
}
<label class="form-label small mb-0">Target Filter</label>
<select class="form-select form-select-sm mb-2" @bind="inAct.FilterType" @bind:after="Compile">
<option value="">(none)</option>
<option value="IsSelf">IsSelf</option>
<option value="IsExactSelf">IsExactSelf</option>
<option value="IsAdjacentToSource">IsAdjacentToSource</option>
<option value="IsAdjacentToUnitMatching">IsAdjacentToUnitMatching</option>
<option value="IsAdjacentToTileMatching">IsAdjacentToTileMatching</option>
</select>
@* Action conditions *@
<div class="d-flex justify-content-between align-items-center mb-1">
<span class="small fw-medium">Conditions</span>
<button class="btn btn-sm btn-outline-secondary py-0 px-1"
@onclick="() => { inAct.Conditions.Add(new ConditionDraft()); Compile(); }">
<i class="bi bi-plus-lg"></i>
</button>
</div>
@for (int inAcI = 0; inAcI < inAct.Conditions.Count; inAcI++)
{
int inAcIdx = inAcI;
var inAc = inAct.Conditions[inAcIdx];
<div class="border rounded p-1 mb-1" style="overflow-x:auto">
<div class="d-flex gap-1 align-items-center mb-1">
<select class="form-select form-select-sm flex-grow-1"
@bind="inAc.TypeStr" @bind:after="Compile">
@foreach (var grp in ConditionGroups)
{
<optgroup label="@grp.Label">
@foreach (var ct in grp.Types)
{ <option value="@ct">@ct</option> }
</optgroup>
}
</select>
<button class="btn btn-sm btn-outline-danger py-0 px-1 flex-shrink-0"
@onclick="() => { inAct.Conditions.RemoveAt(inAcIdx); Compile(); }">
<i class="bi bi-x"></i>
</button>
</div>
<div class="d-flex gap-1 flex-wrap align-items-center">
<select class="form-select form-select-sm" style="width:80px"
@bind="inAc.Subject" @bind:after="Compile" title="Subject">
<option value="Self">Self</option>
<option value="Target">Target</option>
</select>
@RenderConditionFields(inAc)
</div>
</div>
}
<hr class="my-1" />
@if (inKind == "action")
{
<button class="btn btn-sm btn-outline-danger w-100 py-0"
@onclick="() => { inAb.Actions.RemoveAt(inJ); _selectedNode = null; Compile(); }">
<i class="bi bi-trash me-1"></i>Delete Action
</button>
}
else
{
<button class="btn btn-sm btn-outline-danger w-100 py-0"
@onclick="() => { inAb.SubGroups[inJ].Actions.RemoveAt(inK); _selectedNode = null; Compile(); }">
<i class="bi bi-trash me-1"></i>Delete Action
</button>
}
}
}
@* ── Effect / sg-effect node ── *@
else if ((inKind == "effect" || inKind == "sgeffect") && inJ >= 0)
{
EffectDraft? inEff = null;
int inEffActionIdx = 0;
if (inKind == "effect" && inJ < inAb.Actions.Count && inK >= 0 && inK < inAb.Actions[inJ].Effects.Count)
{
inEff = inAb.Actions[inJ].Effects[inK];
inEffActionIdx = inJ;
}
else if (inKind == "sgeffect" && inJ < inAb.SubGroups.Count && inK >= 0 && inK < inAb.SubGroups[inJ].Actions.Count && inL >= 0 && inL < inAb.SubGroups[inJ].Actions[inK].Effects.Count)
{
inEff = inAb.SubGroups[inJ].Actions[inK].Effects[inL];
inEffActionIdx = inK;
}
@if (inEff != null)
{
var inIsTriggered = inAb.TypeStr == "Triggered";
<label class="form-label small mb-0">Effect Type</label>
<select class="form-select form-select-sm mb-2" @bind="inEff.TypeKey" @bind:after="() => { SelectEffectType(inEff, inEff.TypeKey); }">
<select class="form-select form-select-sm mb-2"
value="@inEff.TypeKey"
@onchange="e => SelectEffectType(inEff, (string)e.Value!)">
@foreach (var grp in EffectGroups)
{
<optgroup label="@grp.Label">
@@ -1370,7 +1609,31 @@
</optgroup>
}
</select>
<p class="text-muted small fst-italic mb-0">Switch to Form View for full effect parameters.</p>
@if (inEff.TypeKey != "SummonToken")
{
<div class="d-flex gap-1 flex-wrap align-items-center mb-2" style="overflow-x:auto">
@RenderEffectFields(inEff, inEffActionIdx, inIsTriggered)
</div>
}
else
{
<p class="text-muted small fst-italic mb-2">SummonToken — use Form View for full token editor.</p>
}
<hr class="my-1" />
@if (inKind == "effect")
{
<button class="btn btn-sm btn-outline-danger w-100 py-0"
@onclick="() => { inAb.Actions[inJ].Effects.RemoveAt(inK); _selectedNode = null; Compile(); }">
<i class="bi bi-trash me-1"></i>Delete Effect
</button>
}
else
{
<button class="btn btn-sm btn-outline-danger w-100 py-0"
@onclick="() => { inAb.SubGroups[inJ].Actions[inK].Effects.RemoveAt(inL); _selectedNode = null; Compile(); }">
<i class="bi bi-trash me-1"></i>Delete Effect
</button>
}
}
}
}