diff --git a/README.md b/README.md index 93c69cf..4ec1919 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,11 @@ La variante base a deux onglets principaux, **Compétences** et **Combat**. Dans Compétences, quatre sous-onglets séparent **Combat et combat libre**, **Compétences libres**, **Magie** et **Équipement**. Les lignes répétables gardent leurs noms d'attributs et de section. La variante cyberpunk conserve -les onglets **Compétences**, **Combat** et **Autres**. Le choix principal est -stocké dans `d10_tab`, celui des sous-onglets base dans `d10_skill_tab`. +les onglets **Compétences**, **Combat** et **Autres**. Ses compétences fixes ont +trois sous-onglets issus des sections du catalogue YAML : **Physique**, +**Intellectuelles** et **Social**. Les champs répétables restent dans **Autres**. +Le choix principal est stocké dans `d10_tab`, celui des sous-onglets base dans +`d10_skill_tab` et celui des catégories cyberpunk dans `d10_category_tab`. Les personnages qui avaient enregistré `core` ou, pour la variante base, `other` 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 diff --git a/TASKS.md b/TASKS.md index 65b8d07..7c75912 100644 --- a/TASKS.md +++ b/TASKS.md @@ -14,6 +14,7 @@ - [x] Divide base skills into fight/free fight, free skills, magic, and equipment subtabs; keep cyberpunk navigation and stored fields. - [x] Restore original cyberpunk health and armor figures, add integrity maximum per location, and hide number spinners. - [x] Restore readable labels in night-theme repeating rows after Roll20 restructures their fieldsets. +- [x] Add cyberpunk skill category subtabs for the full catalogue, preserving fixed skills and repeating fields. ## Live Roll20 checks after local verification diff --git a/data/cyberpunk_skills.yaml b/data/cyberpunk_skills.yaml index b52fef6..ce224eb 100644 --- a/data/cyberpunk_skills.yaml +++ b/data/cyberpunk_skills.yaml @@ -1,5 +1,6 @@ sections: -- name: Physique +- id: physique + name: Physique groups: - name: Combat skills: @@ -152,7 +153,8 @@ sections: - id: essaimdedrones name: Essaim de Drones parent: pilotagededrones -- name: Intellectuelles +- id: intellectuelles + name: Intellectuelles groups: - name: Techniques skills: @@ -376,7 +378,8 @@ sections: - id: stratgie name: Stratégie parent: thoriemilitaire -- name: Social +- id: social + name: Social groups: - name: Sociales skills: diff --git a/data/sheet_model.yaml b/data/sheet_model.yaml index 277408c..0906e09 100644 --- a/data/sheet_model.yaml +++ b/data/sheet_model.yaml @@ -35,6 +35,7 @@ variants: cyberpunk: title: Système D10 Cyberpunk skills: cyberpunk_skills.yaml + skill_category_tabs: true attributes: - {id: Force, name: Force} - {id: Agilite, name: Agilité} diff --git a/templates/sheet.css b/templates/sheet.css index 20ecc04..d783a57 100644 --- a/templates/sheet.css +++ b/templates/sheet.css @@ -33,6 +33,7 @@ .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); } .sheet-d10.sheet-variant-base .sheet-tab-state[value="other"] ~ .sheet-tab-nav .sheet-tab-skills { color: var(--d10-panel); background: var(--d10-accent); border-color: var(--d10-accent); } .sheet-d10 .sheet-skill-tab-nav { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 5px; margin: 2px 0 12px; } +.sheet-d10 .sheet-category-tab-nav { grid-template-columns: repeat(3,minmax(0,1fr)); } .sheet-d10 .sheet-skill-tab-nav button[type=action] { min-height: 37px; margin: 0 !important; padding: 6px 4px; color: var(--d10-accent); background: var(--d10-background); border: 1px solid var(--d10-border); border-radius: 3px; box-shadow: none; font: bold 11px Georgia,serif; text-shadow: none; } .sheet-d10 .sheet-skill-tab-nav button[type=action]:hover, .sheet-d10 .sheet-skill-tab-nav button[type=action]:focus { background: var(--d10-panel); outline: 2px solid var(--d10-border); outline-offset: -2px; } .sheet-d10 .sheet-skill-pane { display: none; } diff --git a/tests/test_build.py b/tests/test_build.py index d7906ff..2e1e70f 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -44,7 +44,10 @@ class BuildTests(unittest.TestCase): markup.index(f'class="repeating_{section}"')) self.assertEqual(markup.count(f'class="repeating_{section}"'), 1) else: - self.assertNotIn('class="sheet-skill-pane sheet-skill-pane-', files['sheet.html']) + self.assertEqual(files['sheet.html'].count('class="sheet-skill-pane sheet-category-pane-'), 3) + self.assertIn('name="attr_d10_category_tab" value="physique"', files['sheet.html']) + for tab in ('physique', 'intellectuelles', 'social'): + self.assertIn(f'.sheet-category-tab-state[value="{tab}"] ~ .sheet-category-pane-{tab}', files['sheet.css']) 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']) self.assertIn('.sheet-d10 .sheet-body-maps { display: grid; grid-template-columns: repeat(2,minmax(0,1fr));', files['sheet.css']) @@ -115,9 +118,11 @@ class BuildTests(unittest.TestCase): theme = build.read_yaml(build.DATA / 'themes.yaml')['themes']['night'] model = {**source['variants']['cyberpunk'], 'version': 1} build.validate(model, skills, theme) - bad = {'sections': [{'name': 'Test', 'groups': [{'name': 'Test', 'skills': [ + bad = {'sections': [{'id': 'test', 'name': 'Test', 'groups': [{'name': 'Test', 'skills': [ {'id': 'one', 'name': 'One'}, {'id': 'one', 'name': 'Duplicate'}]}]}]} with self.assertRaisesRegex(ValueError, 'duplicate skill'): + build.validate({**model, 'skill_category_tabs': False}, bad, theme) + with self.assertRaisesRegex(ValueError, 'at least two unique'): build.validate(model, bad, theme) with self.assertRaisesRegex(ValueError, 'invalid theme color'): build.validate(model, skills, {**theme, 'accent': 'red'}) diff --git a/tests/test_tabs.mjs b/tests/test_tabs.mjs index 2861556..e574244 100644 --- a/tests/test_tabs.mjs +++ b/tests/test_tabs.mjs @@ -5,6 +5,7 @@ import vm from 'node:vm'; for (const variant of ['base', 'cyberpunk']) { const tabs = variant === 'base' ? ['skills', 'combat'] : ['skills', 'combat', 'other']; const skillTabs = variant === 'base' ? ['fight', 'free', 'magic', 'equipment'] : []; + const categoryTabs = variant === 'cyberpunk' ? ['physique', 'intellectuelles', 'social'] : []; const html = readFileSync(`build/${variant}/parchment/sheet.html`, 'utf8'); const script = html.match(/\n' return html_text, css