feat: lit/divi-design-restore stellt Farben und Variablen wieder her; nur theme_options folgt mit 4d (V10)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Jan-Niclas Loosen
2026-10-19 14:23:10 +02:00
co-authored by Claude Sonnet 5.5
parent bd2043564b
commit 88a939787d
4 changed files with 195 additions and 16 deletions
@@ -17,7 +17,7 @@ defined('ABSPATH') || exit;
* lit/divi-design-restore (spec §5, G6, ruling V10): writes a snapshot back through the change pipeline – dry run with
* the diff to the current state, confirm with design_rev, and first a snapshot of the current state, so a restore can
* be undone as well. The area comes from the snapshot ID; its RestorePlanner brings the rights, the Divi features and
* the plan. Areas without a planner are not restorable yet.
* the plan. Areas without a planner (theme_options until Etappe 4d) are not restorable yet.
*/
final class DiviDesignRestoreAbility implements Ability, RequiresDiviFeatures
{
@@ -50,7 +50,9 @@ final class DiviDesignRestoreAbility implements Ability, RequiresDiviFeatures
{
return 'Stellt einen Snapshot des Designsystems wieder her (snapshot_id aus lit/divi-design-snapshots oder '
. 'einer Änderungsantwort). Zuerst Probelauf (Unterschied zum aktuellen Stand, design_rev), nach Rückfrage '
. 'beim Nutzer confirm: true; vorher wird der aktuelle Stand selbst gesichert.';
. 'beim Nutzer confirm: true; vorher wird der aktuelle Stand selbst gesichert. Bereiche: presets, colors '
. '(Farben, die es im Snapshot nicht gibt, entfallen) und variables (Variablen, die erst nach dem Snapshot '
. 'entstanden, bleiben archiviert erhalten).';
}
public function inputSchema(): array
@@ -110,7 +112,7 @@ final class DiviDesignRestoreAbility implements Ability, RequiresDiviFeatures
if ($planner === null) {
return Errors::unsupported(
'Snapshots dieses Bereichs lassen sich noch nicht wiederherstellen.',
'Farben und Variablen folgen mit Etappe 4c, Theme-Optionen mit 4d.'
'Theme-Optionen folgen mit Etappe 4d.'
);
}
$snapshot = $this->snapshots->get($area, $id);
+6 -1
View File
@@ -13,6 +13,7 @@ use LIT\MCP\Integrations\Bootable;
use LIT\MCP\Integrations\Divi\Admin\DiviTab;
use LIT\MCP\Integrations\Divi\Cli\DiviCheckCommand;
use LIT\MCP\Integrations\Divi\BlockTree\Parser;
use LIT\MCP\Integrations\Divi\Design\ColorRestorePlanner;
use LIT\MCP\Integrations\Divi\Design\DesignSystemReader;
use LIT\MCP\Integrations\Divi\Design\DesignSystemWriter;
use LIT\MCP\Integrations\Divi\Design\DiviDesignSystemAbility;
@@ -22,6 +23,7 @@ use LIT\MCP\Integrations\Divi\Design\DiviPresetGetAbility;
use LIT\MCP\Integrations\Divi\Design\DiviDesignRestoreAbility;
use LIT\MCP\Integrations\Divi\Design\DiviDesignSnapshotsAbility;
use LIT\MCP\Integrations\Divi\Design\DiviDesignDetachAbility;
use LIT\MCP\Integrations\Divi\Design\GlobalColorsAdapter;
use LIT\MCP\Integrations\Divi\Design\GlobalVariablesAdapter;
use LIT\MCP\Integrations\Divi\Design\DiviPresetsAssignAbility;
use LIT\MCP\Integrations\Divi\Design\DiviPresetsDeleteAbility;
@@ -31,6 +33,7 @@ use LIT\MCP\Integrations\Divi\Design\PresetAssignment;
use LIT\MCP\Integrations\Divi\Design\PresetComposer;
use LIT\MCP\Integrations\Divi\Design\PresetRestorePlanner;
use LIT\MCP\Integrations\Divi\Design\SnapshotStore;
use LIT\MCP\Integrations\Divi\Design\VariableRestorePlanner;
use LIT\MCP\Integrations\Divi\Library\DiviLibraryStore;
use LIT\MCP\Integrations\Divi\Library\DiviRoles;
use LIT\MCP\Integrations\Divi\Library\GlobalEdits;
@@ -266,7 +269,9 @@ final class DiviIntegration implements Integration, Bootable
new DiviDesignRestoreAbility(
$this->designChange(),
new SnapshotStore(),
new PresetRestorePlanner($this->designWriter, DesignRights::unfilteredHtml())
new PresetRestorePlanner($this->designWriter, DesignRights::unfilteredHtml()),
new ColorRestorePlanner($this->designWriter, new GlobalColorsAdapter()),
new VariableRestorePlanner($this->designWriter, new GlobalVariablesAdapter())
),
new DiviPresetsAssignAbility(
$this->designWriter,