webcake-storefront-mcp 1.19.1 → 1.20.0

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.
@@ -14,6 +14,7 @@
14
14
  // text) so a generated site matches whatever palette the theme already defines; callers can
15
15
  // override any slot via a Palette object.
16
16
  import { buildSection, walk } from "./page.js";
17
+ import { buildElement } from "./catalog.js";
17
18
  import { normalizeEvents } from "./events.js";
18
19
  const DEFAULT_PALETTE = {
19
20
  accent: "var(--color_02)",
@@ -273,19 +274,20 @@ export function headerSection(opts = {}) {
273
274
  { label: "Giỏ hàng", navTo: "cart" },
274
275
  ];
275
276
  const logo = { type: "text", opts: { text: opts.brand || "Shop", specials: { tag: "h2" }, style: { fontSize: "24px", fontWeight: "800", color: p.text } } };
277
+ // Real designer templates use a `menu` of `menu-item`s, NOT text links — and a menu-item's
278
+ // navigation lives in its SPECIALS (linkType/linkPage/pageId), not events. We build the
279
+ // items directly (via buildElement, so buildFromSpec doesn't grid-stack the menu) and leave
280
+ // a _navTo sentinel that wireNavigation resolves into linkType:"page" + page ids.
281
+ const menuItems = links.map((l) => buildElement("menu-item", {
282
+ specials: { name: l.label, ...(l.navTo ? { _navTo: l.navTo } : {}), ...(l.url ? { _navUrl: l.url } : {}) },
283
+ }));
276
284
  const nav = {
277
- type: "container",
278
- layout: "row",
279
- columnGap: 28,
280
- collapse: { bp4: 3 },
281
- children: links.map((l) => ({
282
- type: "text",
283
- opts: {
284
- text: l.label,
285
- ...(l.navTo || l.url ? { specials: { ...(l.navTo ? { _navTo: l.navTo } : {}), ...(l.url ? { _navUrl: l.url } : {}) } } : {}),
286
- style: { fontSize: "15px", fontWeight: "600", color: p.text, cursor: "pointer" },
287
- },
288
- })),
285
+ type: "menu",
286
+ opts: {
287
+ specials: { type: "horizontal", sync: false, fullField: false },
288
+ config: { showArrow: true, textColor: p.text, colorHover: p.accent, "--padX": "15px", justifyContent: "center", fontSize: "15px", fontWeight: "600" },
289
+ children: menuItems,
290
+ },
289
291
  };
290
292
  const actions = {
291
293
  type: "container",
@@ -365,19 +367,34 @@ export function footerSection(opts = {}) {
365
367
  export function wireNavigation(source, slugToId) {
366
368
  let wired = 0;
367
369
  const resolve = (slug) => slugToId[slug] || slugToId[slug.replace(/^\//, "")];
370
+ const isMenuItem = (t) => t === "menu-item" || t === "menu-anchor-item";
368
371
  walk(source, (node) => {
369
- // (a) text links carry the sentinel in specials (the text factory keeps it).
372
+ // (a) elements carry the sentinel in specials (text/menu-item factories keep specials).
370
373
  const sp = node && node.specials;
371
374
  if (sp && sp._navTo) {
372
375
  const id = resolve(sp._navTo);
373
376
  if (id) {
374
- node.events = normalizeEvents([{ action: "open_page", open_page_id: id }], node.type);
377
+ // A menu-item navigates via SPECIALS (linkType/linkPage/pageId), like real templates;
378
+ // every other element navigates via an events open_page entry.
379
+ if (isMenuItem(node.type)) {
380
+ sp.linkType = "page";
381
+ sp.linkPage = id;
382
+ sp.pageId = id;
383
+ }
384
+ else
385
+ node.events = normalizeEvents([{ action: "open_page", open_page_id: id }], node.type);
375
386
  wired++;
376
387
  }
377
388
  delete sp._navTo;
378
389
  }
379
390
  if (sp && sp._navUrl) {
380
- node.events = normalizeEvents([{ action: "open_link", link_target: sp._navUrl, link_target_url: sp._navUrl }], node.type);
391
+ if (isMenuItem(node.type)) {
392
+ sp.linkType = "custom";
393
+ sp.isCustom = true;
394
+ sp.link = sp._navUrl;
395
+ }
396
+ else
397
+ node.events = normalizeEvents([{ action: "open_link", link_target: sp._navUrl, link_target_url: sp._navUrl }], node.type);
381
398
  delete sp._navUrl;
382
399
  wired++;
383
400
  }
@@ -1,4 +1,11 @@
1
1
  [
2
+ {
3
+ "v": "1.20.0",
4
+ "d": "25/06/2026",
5
+ "type": "Changed",
6
+ "en": "The header generated by scaffold_global_sections now uses a menu element with menu-item children for navigation links, matching real production…",
7
+ "vi": "Header được tạo bởi scaffold_global_sections nay sử dụng phần tử menu với các phần tử con menu-item cho các liên kết điều hướng, khớp với cấu trúc…"
8
+ },
2
9
  {
3
10
  "v": "1.19.1",
4
11
  "d": "25/06/2026",
@@ -33,12 +40,5 @@
33
40
  "type": "Changed",
34
41
  "en": "get_http_function and get_site_custom_code now include a \"File / media uploads\" section in the embedded HTTP function guide, documenting three ways…",
35
42
  "vi": "get_http_function và get_site_custom_code nay bổ sung mục \"File / media uploads\" vào hướng dẫn HTTP function nhúng sẵn, tài liệu hóa ba cách tải…"
36
- },
37
- {
38
- "v": "1.17.0",
39
- "d": "24/06/2026",
40
- "type": "Added",
41
- "en": "New new_row tool builds a multi-column responsive row container where child elements are placed side by side (left to right); the row auto-collapses…",
42
- "vi": "Tool mới new_row tạo một container đa cột responsive với các phần tử con được đặt nằm ngang cạnh nhau (từ trái sang phải); hàng tự động thu gọn…"
43
43
  }
44
44
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webcake-storefront-mcp",
3
- "version": "1.19.1",
3
+ "version": "1.20.0",
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",