spec(textarea-editor): adopt dedicated editor.css, simplify vocab sourcing

CSS lives in a dedicated stylesheet loaded only by the editor-assets partial,
not folded into components.css — keeps the editor's footprint isolated from
the global widget styles. Drop the two-stage vocab sourcing in favor of a
single cvarlist/cmdlist dump.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
mwiegand 2026-05-16 17:52:50 +02:00
parent bef6f0cdd9
commit b19b00e706
No known key found for this signature in database

View file

@ -78,19 +78,12 @@ Lives at `l4d2web/l4d2web/static/data/srccfg-vocab.json`:
} }
``` ```
**Sourcing — two-stage:** **Sourcing:** dump `cvarlist` / `cmdlist` from a freshly-started L4D2
server with the project's common SourceMod plugins loaded. Hand-trim engine
1. **Seed from the existing cvar reference doc.** `docs/l4d2-server-cvar-reference.md` internals nobody touches. Descriptions come from the `cvarlist` output's
already curates the cvars users actually touch (with descriptions and trailing help text where present; otherwise omitted. Generated once,
recommended values). Extract identifiers from its tables and code fences; committed verbatim. Document the regeneration procedure in the top-of-file
carry across short descriptions where present. comment of `srccfg-vocab.json`.
2. **Optionally augment** with a `cvarlist`/`cmdlist` dump from a freshly-
started L4D2 server with the project's common SourceMod plugins loaded,
hand-trimmed for engine internals nobody touches. This is purely additive
breadth; the curated reference is the authoritative source for descriptions.
Generated once, committed verbatim. Document the regeneration procedure in
the top-of-file comment.
**Loading:** lazy fetch on first `srccfg` editor mount; cached on **Loading:** lazy fetch on first `srccfg` editor mount; cached on
`window.__srccfgVocab` so multiple editors on the same page share the load. `window.__srccfgVocab` so multiple editors on the same page share the load.
@ -129,7 +122,7 @@ per the established pattern (`app.py:86`).
| `l4d2web/l4d2web/static/js/editor.js` | New — ~250 LOC widget | | `l4d2web/l4d2web/static/js/editor.js` | New — ~250 LOC widget |
| `l4d2web/l4d2web/static/js/srccfg-grammar.js` | New — ~30 LOC Prism grammar | | `l4d2web/l4d2web/static/js/srccfg-grammar.js` | New — ~30 LOC Prism grammar |
| `l4d2web/l4d2web/static/data/srccfg-vocab.json` | New — curated cvars/commands | | `l4d2web/l4d2web/static/data/srccfg-vocab.json` | New — curated cvars/commands |
| `l4d2web/l4d2web/static/css/components.css` | Add `.editor-shell`, `.editor-code`, `.editor-popup` rules; reuse `tokens.css` color variables; preserve textarea visual to avoid layout shift | | `l4d2web/l4d2web/static/css/editor.css` | New — dedicated stylesheet for `.editor-shell`, `.editor-code`, `.editor-popup`; reuses `tokens.css` color variables; preserves textarea visual to avoid layout shift. Loaded by the `_editor_assets.html` partial so it ships only on pages that mount an editor. |
| `l4d2web/pyproject.toml` | Add `playwright` dev dep | | `l4d2web/pyproject.toml` | Add `playwright` dev dep |
| `l4d2web/tests/e2e/conftest.py` | New — boot Flask app under test, expose URL fixture | | `l4d2web/tests/e2e/conftest.py` | New — boot Flask app under test, expose URL fixture |
| `l4d2web/tests/e2e/test_editor.py` | New — Playwright test: type `sv_che`, assert popup, accept, assert textarea value | | `l4d2web/tests/e2e/test_editor.py` | New — Playwright test: type `sv_che`, assert popup, accept, assert textarea value |