bricks-builder-mcp 3.11.4 → 3.11.5

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 +10 -16
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "bricks-builder-mcp",
4
- "version": "3.11.4",
4
+ "version": "3.11.5",
5
5
  "description": "Serveur MCP pour piloter Bricks Builder (WordPress) depuis Claude — édition de pages, gestion d'éléments, réordonnancement des sections, vérification visuelle (verify_element), 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
@@ -2310,42 +2310,36 @@ mcpServer.setRequestHandler(CallToolRequestSchema, async (request) => {
2310
2310
 
2311
2311
  // === Empty containers ===
2312
2312
  if (cfg.empty_containers) {
2313
- // v3.11.4debug : on remonte le outerHTML pour identifier les faux positifs
2314
- let debugCount = 0;
2313
+ // v3.11.5Bricks 2.3 rend ses images comme des <img class="brxe-image" id="brxe-{id}">
2314
+ // (pas un wrapper). Idem pour vidéos/iframes/svg. On skip ces balises : elles SONT le média.
2315
+ const MEDIA_TAGS = new Set(['IMG', 'PICTURE', 'SVG', 'VIDEO', 'IFRAME', 'CANVAS', 'AUDIO', 'OBJECT', 'EMBED']);
2316
+ const INTERACTIVE_TAGS = new Set(['A', 'BUTTON', 'INPUT', 'SELECT', 'TEXTAREA']);
2315
2317
  allBrxe.forEach(b => {
2318
+ // Skip si l'élément EST déjà un média ou un interactif natif
2319
+ if (MEDIA_TAGS.has(b.tagName) || INTERACTIVE_TAGS.has(b.tagName)) return;
2316
2320
  const rect = b.getBoundingClientRect();
2317
2321
  if (rect.width < 50 || rect.height < 50) return;
2318
2322
  const area = rect.width * rect.height;
2319
2323
  if (area < 2500) return;
2320
2324
  const hasText = (b.textContent || '').trim().length > 0;
2321
- const hasMedia = b.querySelector('img, picture, svg, video, iframe, canvas') !== null;
2325
+ const hasMedia = b.querySelector('img, picture, svg, video, iframe, canvas, audio, object, embed') !== null;
2322
2326
  const hasInteractive = b.querySelector('a, button, input, select, textarea') !== null;
2323
2327
  const bcs = getComputedStyle(b);
2324
2328
  const hasBgImg = bcs.backgroundImage && bcs.backgroundImage !== 'none';
2325
- // v3.11.4 détecte AUSSI les background-image sur les descendants directs (Bricks rend souvent
2326
- // l'image en CSS bg sur un enfant, pas sur le wrapper)
2329
+ // Détecte aussi les background-image sur les descendants directs (cas Bricks le bg est sur un sub-div)
2327
2330
  const hasChildBgImg = !hasBgImg && Array.from(b.children).some(c => {
2328
2331
  const ccs = getComputedStyle(c);
2329
2332
  return ccs.backgroundImage && ccs.backgroundImage !== 'none';
2330
2333
  });
2331
2334
  if (!hasText && !hasMedia && !hasInteractive && !hasBgImg && !hasChildBgImg) {
2332
- const issue = {
2335
+ issues.push({
2333
2336
  type: 'empty_container',
2334
2337
  severity: 'warning',
2335
2338
  element: b.id || (Array.from(b.classList).find(c => c.startsWith('brxe-')) || '?'),
2336
2339
  label: `Container vide ${Math.round(rect.width)}×${Math.round(rect.height)}px`,
2337
2340
  hint: "Bloc visible sans contenu — souvent un wrapper écrasé par align-items: stretch. Fixer aspect-ratio ou ajouter du contenu.",
2338
2341
  bbox: absBbox(rect),
2339
- };
2340
- // DEBUG : 3 premiers seulement (sinon trop verbeux)
2341
- if (debugCount < 3) {
2342
- issue._debugOuterHTML = (b.outerHTML || '').substring(0, 400);
2343
- issue._debugTagName = b.tagName;
2344
- issue._debugChildrenCount = b.children.length;
2345
- issue._debugChildren = Array.from(b.children).slice(0, 3).map(c => `<${c.tagName.toLowerCase()}${c.id ? '#' + c.id : ''}${c.className ? '.' + (typeof c.className === 'string' ? c.className.split(' ').slice(0,2).join('.') : '') : ''}>`);
2346
- debugCount++;
2347
- }
2348
- issues.push(issue);
2342
+ });
2349
2343
  }
2350
2344
  });
2351
2345
  }