feat: default_label_resolver reads name property; item-template convention

The default label_resolver now reads the optional player-facing `name`
property from the item-template; modules with named templates get pretty
row labels without registering an override. Falls back to "Item" when
`name` is absent or empty.

README documents the player-facing item-template convention: name,
description, weight, volume, composition.<material> — all optional,
all with documented defaults. Skill-gated description reveals stay on
the separate hints lib (designed, not yet implemented).
This commit is contained in:
Calic
2026-06-14 00:26:29 +02:00
parent 0921a03ede
commit 051f472442
3 changed files with 33 additions and 5 deletions

View File

@@ -5,7 +5,7 @@ Inventory vertical-list widget. Reads a composition list-container via
managed by `lib-core.panel`. Provides icon + label + count rows with
right-click context-menu support.
**Version:** 0.1.0
**Version:** 0.1.1
**Lib-ID:** lib-core.inventory-list-display
**Requires:** lib-core.panel v0.1.0, lib-core.inventory-list v0.1.0, lib-core.composition v0.2.0
**Tags:** inventory, ui, panel, widget, list
@@ -38,10 +38,33 @@ v0.1 ships a minimal vertical-list inventory widget:
**Intentional non-goals (deferred):**
- Row scrolling (wheel event silently ignored)
- Stack-count display (`stack_mode="stack"` not supported in v0.1)
- Pretty item names (no `composition.template_of` accessor yet; override via `set_label_resolver`)
- Row selection highlight
- Multi-column layout
## Item-Template-Convention
This widget reads optional player-facing properties from the item's
composition-template. All are optional; missing values fall back to
defaults.
| Property | Type | Default | Used by |
|---|---|---|---|
| `name` | string | template-id-fallback / `"Item"` | default `label_resolver` — shown in the row |
| `description` | string | (empty) | consumer-side actions (e.g. Inspect) — flavor text |
| `weight` | number | 0 | reserved — read by `inventory-grid` (Phase F/G) |
| `volume` | number | 0 | reserved — read by `inventory-grid` (Phase F/G) |
| `composition.<material>` | number (0-1) | (absent) | crafting recipes (Phase E); see `architecture/composition-model.md §4` for material catalog |
| `sprite_atlas` | string | (empty) | default `icon_resolver` — atlas path for icon |
| `sprite_uv` | `{x,y,w,h}` | (absent) | default `icon_resolver` — UV rect within atlas |
| `stack_mode` | string | required by `inventory-list` | `"individual"` only in v0.x |
| `position.x/y` | number | required for world placement | rendered by `lib-core.render` |
**Skill-gated reveals on top of `description`** are handled by a
separate `lib-core.hints` lib (designed, not yet implemented). When
hints land, the base `description` stays untouched; hints attach
predicate-gated extra reveals at examine/tooltip time. Modules without
skill systems use `description` as the only flavor text.
## API
### `display.create(container_entity, opts)`