bricks-builder-mcp 3.12.2 → 3.12.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server.js +12 -3
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "bricks-builder-mcp",
4
- "version": "3.12.2",
4
+ "version": "3.12.3",
5
5
  "description": "Serveur MCP pour piloter Bricks Builder (WordPress) depuis Claude/Codex — édition de pages, gestion d'éléments, audit technique, audit design visuel, upload optimisé WebP. Communauté Discord : https://discord.gg/rX22zHRzH",
6
6
  "homepage": "https://discord.gg/rX22zHRzH",
7
7
  "main": "server.js",
package/server.js CHANGED
@@ -830,7 +830,7 @@ mcpServer.setRequestHandler(ListToolsRequestSchema, async () => {
830
830
  },
831
831
  {
832
832
  name: "get_element_schema",
833
- description: "Découvre les éléments Bricks disponibles et leurs contrôles natifs depuis le registre runtime Bricks. Sans `element`, retourne le catalogue compact. Avec `element` (ex: button, image, form), retourne les contrôles/settings de cet élément + les settings hérités communs si includeInherited=true.",
833
+ description: "Découvre les éléments Bricks disponibles et leurs contrôles natifs. Sans `element`, retourne le catalogue compact. Avec `element` (ex: button, image, form), retourne les contrôles/settings runtime si disponibles, sinon tente le schema officiel Bricks Academy en fallback + les settings hérités communs si includeInherited=true.",
834
834
  inputSchema: {
835
835
  type: "object",
836
836
  properties: {
@@ -2087,17 +2087,26 @@ mcpServer.setRequestHandler(CallToolRequestSchema, async (request) => {
2087
2087
  const allBrxe = Array.from(el.querySelectorAll('[id^="brxe-"], [class*="brxe-"]'));
2088
2088
  const emptyContainers = [];
2089
2089
  const MIN_AREA = 2500;
2090
+ const MEDIA_TAGS = new Set(['IMG', 'PICTURE', 'SVG', 'VIDEO', 'IFRAME', 'CANVAS', 'AUDIO', 'OBJECT', 'EMBED']);
2091
+ const INTERACTIVE_TAGS = new Set(['A', 'BUTTON', 'INPUT', 'SELECT', 'TEXTAREA']);
2090
2092
  allBrxe.forEach(b => {
2093
+ // Bricks 2.3 peut rendre l'élément Image directement en <img class="brxe-image">.
2094
+ // Dans ce cas l'élément EST le média, pas un wrapper vide.
2095
+ if (MEDIA_TAGS.has(b.tagName) || INTERACTIVE_TAGS.has(b.tagName)) return;
2091
2096
  const brect = b.getBoundingClientRect();
2092
2097
  if (brect.width < 50 || brect.height < 50) return;
2093
2098
  const area = brect.width * brect.height;
2094
2099
  if (area < MIN_AREA) return;
2095
2100
  const hasText = (b.textContent || '').trim().length > 0;
2096
- const hasMedia = b.querySelector('img, picture, svg, video, iframe') !== null;
2101
+ const hasMedia = b.querySelector('img, picture, svg, video, iframe, canvas, audio, object, embed') !== null;
2097
2102
  const hasInteractive = b.querySelector('a, button, input, select, textarea') !== null;
2098
2103
  const bcs = getComputedStyle(b);
2099
2104
  const hasBgImg = bcs.backgroundImage && bcs.backgroundImage !== 'none';
2100
- if (!hasText && !hasMedia && !hasInteractive && !hasBgImg) {
2105
+ const hasChildBgImg = !hasBgImg && Array.from(b.children).some(c => {
2106
+ const ccs = getComputedStyle(c);
2107
+ return ccs.backgroundImage && ccs.backgroundImage !== 'none';
2108
+ });
2109
+ if (!hasText && !hasMedia && !hasInteractive && !hasBgImg && !hasChildBgImg) {
2101
2110
  emptyContainers.push({
2102
2111
  id: b.id || '',
2103
2112
  classes: Array.from(b.classList).filter(c => c.startsWith('brxe-')),