fix: stop guessing a kind for composite Divi attribute paths
Review fix round 1 on the lit/divi-catalog task:
- AttrPathIndex::collectKinds() no longer records a kind from a
component.type === "group" node (a composite of several sub-kinds,
e.g. button.innerContent = text + link + target), and kinds() now
drops any attrName with more than one distinct candidate kind
instead of last-write-wins (e.g. imageIcon.innerContent had onoff +
icon + image sub-fields sharing one attrName). Both previously
produced a wrong-but-present kind, which is more dangerous for 2b's
sanitization routing than "unknown". Verified against the committed
blurb/button/fullwidth-header fixture entries and live against the
full 100-module catalog.
- AttrPathIndex::fromDefaults() now builds on AttrMap::flatten()
instead of a parallel walker.
- ModuleCatalog::shortName() replaces the duplicated
substr($name, strlen('divi/')) in DiviCatalogAbility.
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:
@@ -119,7 +119,8 @@ final class DiviCatalogAbility implements Ability
|
||||
if (! is_string($input['module'] ?? null) || $input['module'] === '') {
|
||||
$modules = [];
|
||||
foreach ($catalog->summary() as $module) {
|
||||
$modules[] = $module + ['shortform' => ShortformMap::has(substr($module['name'], strlen('divi/')))];
|
||||
$shortName = ModuleCatalog::shortName($module['name']);
|
||||
$modules[] = $module + ['shortform' => ShortformMap::has($shortName)];
|
||||
}
|
||||
|
||||
return ['modules' => $modules, 'notes' => $notes];
|
||||
@@ -133,7 +134,7 @@ final class DiviCatalogAbility implements Ability
|
||||
);
|
||||
}
|
||||
|
||||
$short = substr($name, strlen('divi/'));
|
||||
$short = ModuleCatalog::shortName($name);
|
||||
$item = ShortformMap::childType($short);
|
||||
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user