Keep characteristics and resources visible across tabs

This commit is contained in:
Dandaedre 2026-09-19 00:12:06 +02:00
parent 5210183d20
commit 1adfa11d37
Signed by: Dandaedre
GPG Key ID: 440C6592E8A26D99
6 changed files with 26 additions and 17 deletions

View File

@ -28,9 +28,11 @@ la traduction dans les onglets correspondants de l'éditeur de feuille
personnalisée Roll20. `sheet.json` est un manifeste; `build-info.json` contient
la variante, le thème, le nombre de compétences et une empreinte du résultat.
La feuille a quatre onglets : **Personnage** (caractéristiques et ressources),
**Compétences**, **Combat** et **Autres** (sections répétables). Le choix de
l'onglet est stocké dans l'attribut `d10_tab`. L'en-tête reste visible. Les
Les sections **01 Caractéristiques** et **02 Ressources** restent visibles.
Trois onglets organisent le reste : **Compétences**, **Combat** et **Autres**
(sections répétables). Le choix de l'onglet est stocké dans l'attribut
`d10_tab`; les personnages qui avaient enregistré `core` affichent
**Compétences** jusqu'au prochain clic. L'en-tête reste visible. Les
thèmes `parchment` et `night` changent les couleurs sans modifier les champs
ni les jets.

View File

@ -9,6 +9,7 @@
- [x] Replace stacked characteristic and skill controls with compact themed grids; verify both variants and themes.
- [x] Split the generated sheet into Personnage, Compétences, Combat, and Autres tabs; verify action handlers and builds.
- [x] Remove unused legacy sheet sources and minitest, retain Mod scripts in scripts/, and keep the Ravenous model local.
- [x] Keep 01 Caractéristiques and 02 Ressources visible above the three remaining tabs; preserve the old core tab value.
## Live Roll20 checks after local verification

View File

@ -17,15 +17,15 @@
.sheet-d10 .sheet-identity { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet-d10 .sheet-identity label, .sheet-d10 .sheet-die-choice { display: grid; gap: 3px; margin: 0 !important; color: var(--d10-accent); font: bold 10px Arial,sans-serif; letter-spacing: .07em; text-transform: uppercase; }
.sheet-d10 .sheet-die-choice { align-self: end; }
.sheet-d10 .sheet-tab-nav { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 4px; margin: 14px 0 0; border-bottom: 2px solid var(--d10-accent); }
.sheet-d10 .sheet-tab-nav { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 4px; margin: 14px 0 0; border-bottom: 2px solid var(--d10-accent); }
.sheet-d10 .sheet-tab-nav button[type=action] { width: 100%; min-height: 38px; margin: 0 !important; padding: 7px 5px; color: var(--d10-accent); background: var(--d10-background); border: 1px solid var(--d10-border); border-bottom: 0; border-radius: 3px 3px 0 0; box-shadow: none; font: bold 12px Georgia,serif; text-shadow: none; }
.sheet-d10 .sheet-tab-nav button[type=action]:hover, .sheet-d10 .sheet-tab-nav button[type=action]:focus { background: var(--d10-panel); outline: 2px solid var(--d10-border); outline-offset: -2px; }
.sheet-d10 .sheet-page { display: none; }
.sheet-d10 .sheet-tab-state[value="core"] ~ .sheet-page-core,
.sheet-d10 .sheet-tab-state[value="core"] ~ .sheet-page-skills,
.sheet-d10 .sheet-tab-state[value="skills"] ~ .sheet-page-skills,
.sheet-d10 .sheet-tab-state[value="combat"] ~ .sheet-page-combat,
.sheet-d10 .sheet-tab-state[value="other"] ~ .sheet-page-other { display: block; }
.sheet-d10 .sheet-tab-state[value="core"] ~ .sheet-tab-nav .sheet-tab-core,
.sheet-d10 .sheet-tab-state[value="core"] ~ .sheet-tab-nav .sheet-tab-skills,
.sheet-d10 .sheet-tab-state[value="skills"] ~ .sheet-tab-nav .sheet-tab-skills,
.sheet-d10 .sheet-tab-state[value="combat"] ~ .sheet-tab-nav .sheet-tab-combat,
.sheet-d10 .sheet-tab-state[value="other"] ~ .sheet-tab-nav .sheet-tab-other { color: var(--d10-panel); background: var(--d10-accent); border-color: var(--d10-accent); }

View File

@ -23,9 +23,13 @@ class BuildTests(unittest.TestCase):
self.assertIn('sheet-rolltemplate-d10skillcheck', files['sheet.html'])
self.assertIn('class="sheet-stat-grid"', files['sheet.html'])
self.assertIn('class="sheet-skill-head"', files['sheet.html'])
self.assertEqual(files['sheet.html'].count('class="sheet-page sheet-page-'), 4)
self.assertIn('name="attr_d10_tab" value="core"', files['sheet.html'])
self.assertEqual(files['sheet.html'].count('class="sheet-page sheet-page-'), 3)
self.assertIn('name="attr_d10_tab" value="skills"', files['sheet.html'])
self.assertNotIn('name="act_tab_core"', files['sheet.html'])
self.assertLess(files['sheet.html'].index('01</span>'), files['sheet.html'].index('class="sheet-tab-nav"'))
self.assertLess(files['sheet.html'].index('02</span>'), files['sheet.html'].index('class="sheet-tab-nav"'))
self.assertIn('.sheet-tab-state[value="skills"] ~ .sheet-page-skills', files['sheet.css'])
self.assertIn('.sheet-tab-state[value="core"] ~ .sheet-page-skills', files['sheet.css'])
self.assertEqual(files['sheet.html'].count('class="sheet-skill-row'), info['skills'])
self.assertIn('.sheet-d10 .sheet-stat-grid { display: grid;', files['sheet.css'])
self.assertIn('.sheet-d10 .sheet-skill-head, .sheet-d10 .sheet-skill-row { display: grid;', files['sheet.css'])

View File

@ -2,7 +2,7 @@ import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import vm from 'node:vm';
const tabs = ['core', 'skills', 'combat', 'other'];
const tabs = ['skills', 'combat', 'other'];
for (const variant of ['base', 'cyberpunk']) {
const html = readFileSync(`build/${variant}/parchment/sheet.html`, 'utf8');
const script = html.match(/<script type="text\/worker">\s*([\s\S]*?)<\/script>/)?.[1];
@ -17,6 +17,7 @@ for (const variant of ['base', 'cyberpunk']) {
setAttrs: changes => Object.assign(attributes, changes),
});
assert.equal(handlers.size, tabs.length);
assert.ok(!handlers.has('clicked:tab_core'));
for (const tab of tabs) {
assert.match(html, new RegExp(`name="act_tab_${tab}"`));
assert.match(html, new RegExp(`class="sheet-page sheet-page-${tab}"`));

View File

@ -13,8 +13,7 @@ ROOT = Path(__file__).resolve().parents[1]
DATA = ROOT / 'data'
IDENT = re.compile(r'^[A-Za-z][A-Za-z0-9_-]*$')
COLOR = re.compile(r'^#[0-9a-fA-F]{6}$')
TABS = (('core', 'Personnage'), ('skills', 'Compétences'),
('combat', 'Combat'), ('other', 'Autres'))
TABS = (('skills', 'Compétences'), ('combat', 'Combat'), ('other', 'Autres'))
def read_yaml(path):
@ -128,11 +127,6 @@ def render(model, skills, variant, theme_name, theme):
'<label class="sheet-die-choice">Dé de jeu <select name="attr_dice">' + ''.join(
f'<option value="{n}"{" selected" if n == 10 else ""}>d{n}</option>'
for n in (4, 6, 8, 10, 12, 20)) + '</select></label></header>',
'<input type="hidden" class="sheet-tab-state" name="attr_d10_tab" value="core">',
'<nav class="sheet-tab-nav" aria-label="Sections de la feuille">',
*(f'<button type="action" class="sheet-tab-button sheet-tab-{key}" name="act_tab_{key}">{label}</button>'
for key, label in TABS),
'</nav><div class="sheet-page sheet-page-core">',
'<section class="sheet-panel"><div class="sheet-section-title"><span>01</span><h2>Caractéristiques</h2></div>',
'<div class="sheet-stat-grid">']
for item in model['attributes']:
@ -158,7 +152,14 @@ def render(model, skills, variant, theme_name, theme):
parts.append('</div>')
else:
parts.append('</div>')
parts.append('</section></div><div class="sheet-page sheet-page-combat"><section class="sheet-panel"><div class="sheet-section-title"><span>03</span><h2>Combat</h2></div><div class="sheet-combat-grid">')
parts.extend([
'</section>',
'<input type="hidden" class="sheet-tab-state" name="attr_d10_tab" value="skills">',
'<nav class="sheet-tab-nav" aria-label="Sections de la feuille">',
*(f'<button type="action" class="sheet-tab-button sheet-tab-{key}" name="act_tab_{key}">{label}</button>'
for key, label in TABS),
'</nav><div class="sheet-page sheet-page-combat"><section class="sheet-panel"><div class="sheet-section-title"><span>03</span><h2>Combat</h2></div><div class="sheet-combat-grid">',
])
for item in model.get('combat', []):
parts.append(f'<label class="sheet-combat-field">{esc(item["name"])}'
f'<input type="number" name="attr_{esc(item["id"])}" value="0"></label>')