Files
kantarciandClaude Opus 5.5 08998de533 Offer 98 icons in a dialog and style a button icon under Design
The icon set grows from 33 to 98 drawings in seven categories (arrows,
contact, commerce, files and media, people and security, house and trade,
general), including truck, cart, euro, camera, tools and solar. icons.js is
the single source; npm run build:icons writes the Twig drawings and the
validator list, and a test keeps them equal.

Choosing an icon no longer fills the panel with tiles: the panel shows the
current icon with "Change", which opens a modal with category tabs and named
tiles, keyboard navigable, closing with Escape. Button, icon and icon card
share it.

A new style group "Symbol" targets the icon inside a button per device and
on hover: colour, background, size, padding, radius, rotation, plus the gap
to the text. Schema v26 adds hover motion (slide, reveal) and an icon-only
button whose label stays as the accessible name and keeps the line height.
ADR 109.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 10:01:18 +02:00

20 lines
1.3 KiB
JavaScript

// Schreibt den Symbolsatz aus public/assets/icons.js in die Twig-Vorlage der Website und in die
// erlaubte Liste des Validators. Eine Quelle, drei Abnehmer; tests/icons.test.mjs prüft das Ergebnis.
// Aufruf: node scripts/build-icons.mjs
import { readFile, writeFile } from 'node:fs/promises';
import { ICON_PATHS } from '../public/assets/icons.js';
const twigFile = new URL('../templates/blocks/icon.html.twig', import.meta.url);
const twig = await readFile(twigFile, 'utf8');
const entries = Object.entries(ICON_PATHS).map(([name, path]) => ` ${/-/.test(name) ? `'${name}'` : name}: '${path}'`).join(',\n');
const nextTwig = twig.replace(/\{% set paths = \{\n[\s\S]*?\n\} %\}/, `{% set paths = {\n${entries}\n} %}`);
if (nextTwig === twig && !twig.includes(entries)) throw new Error('Die Symbolliste in icon.html.twig wurde nicht gefunden.');
await writeFile(twigFile, nextTwig);
const validatorFile = new URL('../src/Content/DocumentValidator.php', import.meta.url);
const validator = await readFile(validatorFile, 'utf8');
const list = Object.keys(ICON_PATHS).map(name => `'${name}'`).join(', ');
const nextValidator = validator.replace(/public const ICONS = \[[^\]]*\];/, `public const ICONS = [${list}];`);
await writeFile(validatorFile, nextValidator);
console.log(`${Object.keys(ICON_PATHS).length} Symbole geschrieben.`);