refactor: ein Helfer für Gruppen-Kurznamen (NodeSummary::groupShortName), ESCAPED_LETTER_REGEX am UsageQuery-Interface, Docblock DiviComposition::presets; Tests für Muster, Kurzname und Gruppen-Überdeckung

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Jan-Niclas Loosen
2026-10-18 17:40:21 +02:00
co-authored by Claude Sonnet 5.5
parent 6d7c59e3fa
commit e7793fd595
13 changed files with 70 additions and 16 deletions
@@ -115,9 +115,8 @@ class DiviComposition
/**
* The one PresetAssignment of this composition (D7, rulings R2, R3): the book comes lazily from Divi's stored
* presets, ids must pass the choke point unchanged.
*
* @internal Public for tests; code uses composer() / warnings().
* presets, ids must pass the choke point unchanged. Public: DiviIntegration::presetAssignment() hands it to
* the site-wide tools (lit/divi-presets-assign), which need the same instance as the write tools.
*/
public function presets(): PresetAssignment
{
@@ -202,10 +202,9 @@ final class DiviNodeGetAbility implements Ability
{
$groups = [];
foreach (NodeSummary::groupPresets($block) as $groupId => $group) {
$name = $group['groupName'];
$groups[] = [
'group_id' => $groupId,
'group' => str_starts_with($name, 'divi/') ? substr($name, 5) : $name,
'group' => NodeSummary::groupShortName($group['groupName']),
'presets' => array_map(
static fn (string $presetId): array => ['id' => $presetId, 'name' => $names[$presetId] ?? ''],
$group['presetIds']
@@ -38,7 +38,8 @@ final class DiviUpdateAbility extends DiviWriteAbility
return 'Ändert vorhandene Divi-Knoten: changes = Liste von {id, set: {Kurzform-Felder}, attrs: {Attributpfad: '
. '{Breakpoint: Wert}}, preset, group_presets, clear_overrides, label}. null entfernt einen Wert. '
. 'preset = Name/ID oder Liste (Stapel, bis ' . PresetAssignment::MAX_STACK . '; bei gleicher Priorität '
. 'gewinnt das letzte Preset im Stapel); group_presets = {Gruppe: Preset}, z. B. {"font-body": "Fließtext"}. Überdecken lokale Werte '
. 'gewinnt das letzte Preset im Stapel); group_presets = {Gruppe: Preset}, z. B. '
. '{"font-body": "Fließtext"}. Überdecken lokale Werte '
. 'ein Preset, meldet die Antwort das; clear_overrides: true entfernt sie (nach set/attrs). Nicht '
. 'genannte Einstellungen bleiben unverändert. Jeder Knoten nur einmal pro Aufruf; denselben Pfad nicht '
. 'zugleich über set und attrs. tree_rev aus lit-divi-outline ist Pflicht; alles oder nichts.';