webcake-storefront-mcp 1.34.0 → 1.34.1

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.
package/dist/api.js CHANGED
@@ -122,7 +122,10 @@ export class WebcakeCmsApi {
122
122
  const settings = typeof site?.settings === "string" ? JSON.parse(site.settings || "{}") : site?.settings;
123
123
  return settings?.breakpoints || null;
124
124
  })
125
- .catch(() => null);
125
+ .catch(() => {
126
+ this._siteBps = null; // don't cache a failed lookup — retry on the next save
127
+ return null;
128
+ });
126
129
  return this._siteBps;
127
130
  }
128
131
  /** Update auth token (in-memory) */
@@ -4,7 +4,7 @@
4
4
  // their children in a CSS grid driven by runtime.config (grid / columns / rows) and each
5
5
  // child's runtime.config (columnStart/End, rowStart/End, constraintX/Y). The helpers here
6
6
  // produce that structure the same way the builder does, so generated pages render.
7
- import { buildElement, isKnownType, ELEMENT_TYPES, CONTAINER_TYPE_SET } from "./catalog.js";
7
+ import { buildElement, isKnownType, ELEMENT_TYPES } from "./catalog.js";
8
8
  import { randomString } from "./factory.js";
9
9
  import { validateEvents } from "./events.js";
10
10
  import { validateBindings } from "./bindings.js";
@@ -350,6 +350,8 @@ export function validatePage(source) {
350
350
  }
351
351
  });
352
352
  // Third pass (needs ancestry): structures the renderer silently mishandles. Warnings only.
353
+ // Child check uses LEAF_TYPES, not "factory has no children": swiper, grid-product, post-list,
354
+ // member-bar… render children even though their factories create none.
353
355
  const checkTree = (node, ancestors) => {
354
356
  if (!node || typeof node !== "object")
355
357
  return;
@@ -357,7 +359,7 @@ export function validatePage(source) {
357
359
  const kids = Array.isArray(node.children) ? node.children : [];
358
360
  if (!ancestors.length && type && type !== "section" && type !== "popup")
359
361
  warnings.push(`Top-level node "${node.id}" is a ${type}: pages render only sections at the top level — wrap it in a section.`);
360
- if (kids.length && type && isKnownType(type) && !CONTAINER_TYPE_SET.has(type))
362
+ if (kids.length && LEAF_TYPES.has(type))
361
363
  warnings.push(`"${node.id}" (${type}) has ${kids.length} child node(s), but ${type} is not a container — they won't render.`);
362
364
  if (type === "submit-button" && !ancestors.some((t) => /form/.test(t)))
363
365
  warnings.push(`Submit button "${node.id}" is not inside a form — it has nothing to submit.`);
@@ -375,6 +377,19 @@ export function validatePage(source) {
375
377
  stats: { sections: source.sections.length, total_elements: total, element_types: typeCounts },
376
378
  };
377
379
  }
380
+ /**
381
+ * Expand one node's `runtime.{style,config}` into the per-breakpoint keys the storefront
382
+ * renderer reads (bp1..bp4). Mirrors builderx_spa's syncBreakpoint: the authored
383
+ * (desktop) values are copied onto every breakpoint. Sections additionally get their
384
+ * centred 3-column grid recomputed per breakpoint via genGridByBp (the side-margin
385
+ * widths shrink on smaller screens). Nodes already in breakpoint shape are left as-is,
386
+ * so this is safe to run over a mixed source (e.g. add_section onto an existing page).
387
+ */
388
+ /** Renderer builders that never draw children (builderx_api lib/qwik/html) — deliberately short. */
389
+ const LEAF_TYPES = new Set([
390
+ "text", "image", "button", "line", "video", "input", "email", "password", "text-area", "select",
391
+ "text-dataset", "image-dataset", "submit-button",
392
+ ]);
378
393
  /** The site's breakpoints if they're a usable map that differs from the standard four, else null. */
379
394
  function customBreakpoints(site) {
380
395
  if (!site || typeof site !== "object")
@@ -393,15 +408,19 @@ function customBreakpoints(site) {
393
408
  * breakpoint containing its min width; sections regenerate their grid for that width. */
394
409
  function remapToSiteBreakpoints(node, site) {
395
410
  const std = Object.entries(BREAKPOINTS);
396
- const pick = (minW) => (std.find(([, [lo, hi]]) => minW >= lo && minW <= hi) || std[std.length - 1])[0];
397
411
  const out = {};
398
- for (const [key, [minW]] of Object.entries(site)) {
399
- const from = node[pick(minW)];
412
+ for (const [key, [minW, maxW]] of Object.entries(site)) {
413
+ // The open-ended (widest) breakpoint is the desktop view: a site cut down to one breakpoint
414
+ // ({bp1:[320,1e9]}) must not get the phone layout everywhere.
415
+ const openEnded = maxW >= BREAKPOINTS.bp1[1];
416
+ const src = openEnded ? "bp1" : (std.find(([, [lo, hi]]) => minW >= lo && minW <= hi) || std[std.length - 1])[0];
417
+ const from = node[src];
400
418
  if (!from)
401
419
  continue;
402
420
  out[key] = clone(from);
421
+ const gridWidth = openEnded ? Math.max(minW, BREAKPOINTS.bp1[0]) : minW;
403
422
  if (node.type === "section")
404
- out[key].config.columns = clone(genGridByBp(minW).columns);
423
+ out[key].config.columns = clone(genGridByBp(gridWidth).columns);
405
424
  }
406
425
  for (const k of BREAKPOINT_KEYS)
407
426
  delete node[k];
@@ -1,4 +1,11 @@
1
1
  [
2
+ {
3
+ "v": "1.34.1",
4
+ "d": "14/10/2026",
5
+ "type": "Fixed",
6
+ "en": "validate_page's \"not a container\" warning now only fires for true leaf elements (text, image, button, inputs, datasets, etc.); container-like…",
7
+ "vi": "Cảnh báo \"not a container\" của validate_page nay chỉ xuất hiện với các element leaf thật sự (text, image, button, các input, dataset...); các…"
8
+ },
2
9
  {
3
10
  "v": "1.34.0",
4
11
  "d": "14/10/2026",
@@ -33,12 +40,5 @@
33
40
  "type": "Changed",
34
41
  "en": "The server now serves a raster PNG icon (/favicon.ico, /favicon.png, /icon.png, /apple-touch-icon.png) alongside the existing SVG favicon, and…",
35
42
  "vi": "Server nay phục vụ thêm icon dạng raster PNG (/favicon.ico, /favicon.png, /icon.png, /apple-touch-icon.png) bên cạnh favicon SVG hiện có, và khai…"
36
- },
37
- {
38
- "v": "1.31.13",
39
- "d": "09/10/2026",
40
- "type": "Added",
41
- "en": "create_product, update_product, create_product_category, update_product_category, and create_blog_category accept a new seo object to write…",
42
- "vi": "create_product, update_product, create_product_category, update_product_category và create_blog_category nay nhận thêm đối tượng seo để ghi…"
43
43
  }
44
44
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webcake-storefront-mcp",
3
- "version": "1.34.0",
3
+ "version": "1.34.1",
4
4
  "description": "MCP server for the WebCake/StoreCake storefront builder — page CRUD, page authoring, products, orders, and more",
5
5
  "mcpName": "io.github.vuluu2k/webcake-storefront-mcp",
6
6
  "license": "MIT",