feat(ui): custom modifier editor in-modal docs, recipes, and attr combobox

Surfaces the contents of docs/user/custom-modifiers.md directly inside
the Custom Modifier Editor so authors can compose descriptors without
cross-referencing the guide:

- Per-primitive docs panel in the Parameter Inspector with a longer
  behaviour explanation + one or more worked examples (collapsible).
- Palette hover tooltips now show the full long description plus the
  first example's headline.
- New 'Templates' header button opens a picker with 5 built-in recipes
  (Boosted Pawn, 3-Charge Shield, Aura King, Vampire, Low-HP Fortress).
- AttrCombobox replaces plain text inputs for attr / targetAttr fields.
  Grouped, free-form autocomplete over 17 curated suggestions with a
  'user-defined' badge for out-of-catalog typed names so ShieldCharges-
  style recipes still work.

Primitives gain optional longDescription + examples fields on their
EffectPrimitive descriptor; 15 registrations annotated. Recipe
descriptors pass the existing validator, and new unit tests enforce
doc coverage going forward.
This commit is contained in:
Joey Yakimowich-Payne 2026-04-21 12:50:14 -06:00
commit 934db775f9
No known key found for this signature in database
25 changed files with 1354 additions and 6 deletions

View file

@ -17,14 +17,47 @@ modifier profile can reference, exactly the same way it references a built-in.
2. In the editor's header, click **+ Custom Modifier**. The Custom Modifier
editor opens as a nested modal.
3. The Custom Modifier editor is a 3-column workspace:
- **Left**: primitive palette, grouped by category.
- **Left**: primitive palette, grouped by category. Hover any entry for a
full tooltip with the primitive's long description and a worked example.
- **Center**: the descriptor's primitive tree (the composition you're
building).
- **Right**: parameter inspector for the selected primitive.
- **Right**: parameter inspector for the selected primitive. The top of the
inspector shows an in-editor docs panel — a longer behaviour explanation
plus one or more concrete example configurations you can copy. Click
**Hide docs & examples** to collapse it when you want only the form.
Each descriptor needs a **name** (1-40 chars) and an optional **description**
(0-200 chars). The header also exposes **Save**, **Load from library**, and
live validation status.
(0-200 chars). The header exposes **Templates**, **Load**, **Save**, and live
validation status.
### Templates — starter recipes
The **Templates** button opens a picker with pre-composed recipes drawn from
the examples below (Boosted Pawn, 3-Charge Shield, Aura King, Vampire,
Low-HP Fortress). Picking a template replaces the current draft with a fresh
copy — the id is regenerated so you can save the loaded template as your own
library entry without collisions.
### Attribute-name autocomplete
Primitives that target an attribute (`seed-attribute`, `add-to-attribute`,
`multiply-attribute`, `absorb-damage-with-attribute`, `add-aura`) render
their `attr` / `targetAttr` field as a **combobox** with grouped
suggestions:
- **Core numeric attributes** — Hp, HpBonus, RangeBonus, DamageResistance,
ReflectDamagePercent, AbsorbDamageRate, HalfmoveClock, FullmoveNumber.
Safe targets for add/multiply/aura/absorb primitives.
- **Core non-numeric attributes** — CaptureFlags, DirectionAdditions,
PromotionOverride, BlockedMoveTypes, AbsorbDamageAttr, HasMoved. Seed-only
for most; avoid add/multiply.
- **User-defined examples** — ShieldCharges, ArmorPlates, BloodStacks,
ManaPool. Illustrative names matching the recipes; invent your own.
The combobox is **free-form** — type any name and hit Enter to accept it,
even if it isn't in the list. Typed values not in the catalog get a small
`user-defined` badge so you know you're outside the schema. Numeric-context
primitives (add, multiply, aura, absorb) rank numeric suggestions first.
---