feat: design-system filters and global module ids in node-get/outline (S19)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
2026-09-27 00:44:58 +02:00
co-authored by Claude Opus 5.5
parent 858aa6a182
commit a3a807051f
8 changed files with 187 additions and 19 deletions
+14 -3
View File
@@ -59,7 +59,8 @@ final class Outline
/**
* @return list<array{id: string, type: string, label: string, excerpt: string, info: string,
* presets: list<string>, children: int, editable: bool, depth: int, truncated: bool}>
* presets: list<string>, children: int, editable: bool, depth: int, truncated: bool,
* global_id: ?string}>
*/
public function rows(NodeIndex $index, ?string $rootId = null, ?int $maxDepth = null, ?int $limit = null): array
{
@@ -114,6 +115,7 @@ final class Outline
foreach ($rows as $row) {
$line = str_repeat(' ', (int) $row['depth']) . $row['id'] . ' ' . $row['type'];
$line .= $row['label'] !== '' ? ' "' . $row['label'] . '"' : '';
$line .= ($row['global_id'] ?? null) !== null ? ' [global ' . $row['global_id'] . ']' : '';
$line .= $row['info'] !== '' ? ' [' . $row['info'] . ']' : '';
$line .= $row['presets'] !== [] ? ' {Preset: ' . implode(', ', $row['presets']) . '}' : '';
$line .= $row['excerpt'] !== '' ? ' – ' . $row['excerpt'] : '';
@@ -127,15 +129,23 @@ final class Outline
/**
* @return array{id: string, type: string, label: string, excerpt: string, info: string,
* presets: list<string>, children: int, editable: bool, depth: int, truncated: bool}
* presets: list<string>, children: int, editable: bool, depth: int, truncated: bool,
* global_id: ?string}
*/
private function row(Block $block, string $id, int $depth): array
{
$editable = $block->isDivi() && ! $block->isOpaque();
$global = NodeSummary::globalRef($block);
$type = $block->isDivi() ? $block->shortName() : $block->name();
if ($global !== null && $global['block_name'] !== '') {
$type = str_starts_with($global['block_name'], 'divi/')
? substr($global['block_name'], 5)
: $global['block_name'];
}
return [
'id' => $id,
'type' => $block->isDivi() ? $block->shortName() : $block->name(),
'type' => $type,
'label' => NodeSummary::label($block),
'excerpt' => NodeSummary::excerpt($block),
'info' => $editable ? NodeSummary::info($block) : '',
@@ -147,6 +157,7 @@ final class Outline
'editable' => $editable,
'depth' => $depth,
'truncated' => false,
'global_id' => $global['id'] ?? null,
];
}
}