Render structured list and table entries in stat block traits
All checks were successful
CI / check (push) Successful in 2m21s
CI / build-image (push) Successful in 17s

Stat block traits containing 5etools list (e.g. Confusing Burble d4
effects) or table entries were silently dropped. The adapter now
produces structured TraitSegment[] instead of flat text, preserving
lists and tables as first-class data. The stat block component renders
labeled list items inline (bold label + flowing text) matching the
5etools layout. Also fixes support for the singular "entry" field on
list items and bumps the bestiary cache version to force re-normalize.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Lukas
2026-04-04 22:09:11 +02:00
parent 817cfddabc
commit 8f6eebc43b
7 changed files with 335 additions and 37 deletions

View File

@@ -3,7 +3,7 @@ import { type IDBPDatabase, openDB } from "idb";
const DB_NAME = "initiative-bestiary";
const STORE_NAME = "sources";
const DB_VERSION = 2;
const DB_VERSION = 3;
interface CachedSourceInfo {
readonly sourceCode: string;
@@ -38,8 +38,11 @@ async function getDb(): Promise<IDBPDatabase | null> {
keyPath: "sourceCode",
});
}
if (oldVersion < 2 && database.objectStoreNames.contains(STORE_NAME)) {
// Clear cached creatures to pick up improved tag processing
if (
oldVersion < DB_VERSION &&
database.objectStoreNames.contains(STORE_NAME)
) {
// Clear cached creatures so they get re-normalized with latest rendering
void transaction.objectStore(STORE_NAME).clear();
}
},