sbuilder-mcp 0.100.1 → 0.100.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.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,26 @@ All notable changes to this project are documented in this file.
6
6
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
7
7
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8
8
 
9
+ ## [0.100.3] - 2026-10-29
10
+
11
+ ### Changed
12
+ - Element seeds, the starter theme presets and the `sb_store` overlay seeds now use `var(--wb-ts-<slug>-family, Inter)` instead of a hard-coded "Inter", following platform v1.0.187.
13
+ - The cart drawer seed now sets `maxWidth: "100%"`, including in the cart overlay seeds.
14
+
15
+ ### Fixed
16
+ - `sb_review` reports `link_colour` only for buttons, because links in text and heading elements now inherit the text colour and are underlined.
17
+ - `sb_review` reports `default_font` for nodes that still hold the old seeded "Inter" fallback, compared with the font family of the element's own text style, and never for `var()` values.
18
+
19
+ ## [0.100.2] - 2026-10-29
20
+
21
+ ### Changed
22
+ - `sb_look` with a `node_id` inside an overlay such as the cart drawer now measures the overlay's subtree in its open state.
23
+
24
+ ### Fixed
25
+ - `sb_look` reports `wider_than_viewport` for fixed, sticky or absolute boxes that overflow the viewport by more than 1px, so a 400px cart drawer on a 390px phone is no longer missed.
26
+ - `sb_review` reports `duplicate_binding_field` when two bindings target the same field, naming the binding that is displayed.
27
+ - `sb_bind` on a field with duplicate bindings replaces the first one and drops the later duplicates.
28
+
9
29
  ## [0.100.1] - 2026-10-29
10
30
 
11
31
  ### Changed
package/CHANGELOG.vi.md CHANGED
@@ -6,6 +6,26 @@ Mọi thay đổi đáng chú ý của dự án được ghi lại trong file n
6
6
  Định dạng dựa trên [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
7
7
  và dự án tuân theo [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8
8
 
9
+ ## [0.100.3] - 2026-10-29
10
+
11
+ ### Changed
12
+ - Seed của element, preset theme khởi đầu và seed overlay của `sb_store` nay dùng `var(--wb-ts-<slug>-family, Inter)` thay cho "Inter" cứng, theo platform v1.0.187.
13
+ - Seed cart drawer nay đặt `maxWidth: "100%"`, kể cả trong seed overlay giỏ hàng.
14
+
15
+ ### Fixed
16
+ - `sb_review` chỉ báo `link_colour` cho button, vì link trong text và heading nay kế thừa màu chữ và có gạch chân.
17
+ - `sb_review` báo `default_font` cho node còn giữ font gieo cũ "Inter" làm fallback, so với họ font của text style của chính element, và không bao giờ báo với giá trị `var()`.
18
+
19
+ ## [0.100.2] - 2026-10-29
20
+
21
+ ### Changed
22
+ - `sb_look` với `node_id` nằm trong overlay như cart drawer nay đo cây con của overlay ở trạng thái đang mở.
23
+
24
+ ### Fixed
25
+ - `sb_look` báo `wider_than_viewport` cho hộp fixed, sticky hoặc absolute tràn khung nhìn quá 1px, nên cart drawer 400px trên điện thoại 390px không còn bị bỏ sót.
26
+ - `sb_review` báo `duplicate_binding_field` khi hai binding cùng trỏ vào một field, kèm binding đang được hiển thị.
27
+ - `sb_bind` trên field có binding trùng sẽ thay binding đầu và bỏ các binding trùng phía sau.
28
+
9
29
  ## [0.100.1] - 2026-10-29
10
30
 
11
31
  ### Changed
@@ -1,6 +1,6 @@
1
1
  export const DEAD_KEY_SOURCE = {
2
- "files": 6038,
3
- "identifiers": 111008,
2
+ "files": 6041,
3
+ "identifiers": 111016,
4
4
  "seededKeys": 460,
5
5
  "dead": 0
6
6
  };
@@ -4080,7 +4080,7 @@ export const ELEMENTS = {
4080
4080
  "width": "fit-content",
4081
4081
  "height": "fit-content",
4082
4082
  "padding": "8px 16px",
4083
- "fontFamily": "Inter",
4083
+ "fontFamily": "var(--wb-ts-heading-4-family, Inter)",
4084
4084
  "color": "#000000"
4085
4085
  },
4086
4086
  "specials": {
@@ -10980,7 +10980,7 @@ export const ELEMENTS = {
10980
10980
  "width": "100%",
10981
10981
  "height": "fit-content",
10982
10982
  "textAlign": "left",
10983
- "fontFamily": "Inter",
10983
+ "fontFamily": "var(--wb-ts-text-1-family, Inter)",
10984
10984
  "gap": "16px",
10985
10985
  "padding": "0px",
10986
10986
  "margin": "0px",
@@ -12069,7 +12069,7 @@ export const ELEMENTS = {
12069
12069
  "backgroundColor": "var(--wb-sc-border, #f5f5f5)",
12070
12070
  "color": "var(--wb-sc-heading, #171717)",
12071
12071
  "textAlign": "left",
12072
- "fontFamily": "Inter",
12072
+ "fontFamily": "var(--wb-ts-text-2-family, Inter)",
12073
12073
  "fontSize": "14px",
12074
12074
  "padding": "12px 16px"
12075
12075
  },
@@ -12239,7 +12239,7 @@ export const ELEMENTS = {
12239
12239
  "width": "100%",
12240
12240
  "height": "fit-content",
12241
12241
  "textAlign": "left",
12242
- "fontFamily": "Inter",
12242
+ "fontFamily": "var(--wb-ts-text-1-family, Inter)",
12243
12243
  "lineHeight": "140%",
12244
12244
  "gap": "8px",
12245
12245
  "color": "#111111",
@@ -13061,6 +13061,7 @@ export const ELEMENTS = {
13061
13061
  "display": "flex",
13062
13062
  "flexDirection": "column",
13063
13063
  "width": "400px",
13064
+ "maxWidth": "100%",
13064
13065
  "gap": "8px",
13065
13066
  "padding": "20px 24px",
13066
13067
  "backgroundColor": "#ffffff",
@@ -17265,7 +17266,7 @@ export const ELEMENTS = {
17265
17266
  "childAllows": [],
17266
17267
  "defaults": {
17267
17268
  "style": {
17268
- "fontFamily": "Inter",
17269
+ "fontFamily": "var(--wb-ts-heading-6-family, Inter)",
17269
17270
  "color": "var(--wb-sc-heading, #000000)",
17270
17271
  "lineHeight": "1.3",
17271
17272
  "fontWeight": "700",
@@ -17389,7 +17390,7 @@ export const ELEMENTS = {
17389
17390
  }
17390
17391
  },
17391
17392
  "style": {
17392
- "fontFamily": "Inter",
17393
+ "fontFamily": "var(--wb-ts-text-1-family, Inter)",
17393
17394
  "fontSize": "16px",
17394
17395
  "color": "var(--wb-sc-link, #171717)",
17395
17396
  "lineHeight": "1.3",
@@ -33839,7 +33840,7 @@ export const ELEMENTS = {
33839
33840
  "color": "#111111",
33840
33841
  "fontSize": "16px",
33841
33842
  "textAlign": "left",
33842
- "fontFamily": "Inter",
33843
+ "fontFamily": "var(--wb-ts-text-1-family, Inter)",
33843
33844
  "--wb-cl-cols": "3",
33844
33845
  "--wb-cl-gap": "24px",
33845
33846
  "--wb-cl-grow": "0"
@@ -39776,7 +39777,7 @@ export const ELEMENT_SEEDS = {
39776
39777
  "fontSize": "16px",
39777
39778
  "lineHeight": "140%",
39778
39779
  "textAlign": "left",
39779
- "fontFamily": "Inter"
39780
+ "fontFamily": "var(--wb-ts-text-1-family, Inter)"
39780
39781
  },
39781
39782
  "config": {
39782
39783
  "kind": "price"
@@ -39789,7 +39790,7 @@ export const ELEMENT_SEEDS = {
39789
39790
  "fontSize": "16px",
39790
39791
  "lineHeight": "140%",
39791
39792
  "textAlign": "left",
39792
- "fontFamily": "Inter"
39793
+ "fontFamily": "var(--wb-ts-text-1-family, Inter)"
39793
39794
  },
39794
39795
  "config": {
39795
39796
  "kind": "compare_price"
@@ -31,6 +31,7 @@ export const OVERLAY_SEEDS = {
31
31
  "display": "flex",
32
32
  "flexDirection": "column",
33
33
  "width": "400px",
34
+ "maxWidth": "100%",
34
35
  "gap": "8px",
35
36
  "padding": "20px 24px",
36
37
  "backgroundColor": "#ffffff",
@@ -1470,7 +1471,7 @@ export const OVERLAY_SEEDS = {
1470
1471
  "fontSize": "16px",
1471
1472
  "lineHeight": "140%",
1472
1473
  "textAlign": "left",
1473
- "fontFamily": "Inter"
1474
+ "fontFamily": "var(--wb-ts-text-1-family, Inter)"
1474
1475
  },
1475
1476
  "config": {
1476
1477
  "kind": "price",
@@ -1538,7 +1539,7 @@ export const OVERLAY_SEEDS = {
1538
1539
  "fontSize": "16px",
1539
1540
  "lineHeight": "140%",
1540
1541
  "textAlign": "left",
1541
- "fontFamily": "Inter"
1542
+ "fontFamily": "var(--wb-ts-text-1-family, Inter)"
1542
1543
  },
1543
1544
  "config": {
1544
1545
  "kind": "compare_price",
@@ -1682,7 +1683,7 @@ export const OVERLAY_SEEDS = {
1682
1683
  "custom": {}
1683
1684
  },
1684
1685
  "style": {
1685
- "fontFamily": "Inter",
1686
+ "fontFamily": "var(--wb-ts-heading-6-family, Inter)",
1686
1687
  "color": "var(--wb-sc-heading, #000000)",
1687
1688
  "lineHeight": "1.3",
1688
1689
  "fontWeight": "700",
@@ -1707,7 +1708,7 @@ export const OVERLAY_SEEDS = {
1707
1708
  "custom": {}
1708
1709
  },
1709
1710
  "style": {
1710
- "fontFamily": "Inter",
1711
+ "fontFamily": "var(--wb-ts-text-1-family, Inter)",
1711
1712
  "fontSize": "16px",
1712
1713
  "color": "var(--wb-sc-link, #171717)",
1713
1714
  "lineHeight": "1.3",
@@ -2080,6 +2081,7 @@ export const CART_SEEDS = {
2080
2081
  "display": "flex",
2081
2082
  "flexDirection": "column",
2082
2083
  "width": "400px",
2084
+ "maxWidth": "100%",
2083
2085
  "gap": "8px",
2084
2086
  "padding": "20px 24px",
2085
2087
  "backgroundColor": "#ffffff",
@@ -2917,6 +2919,7 @@ export const CART_SEEDS = {
2917
2919
  "display": "flex",
2918
2920
  "flexDirection": "column",
2919
2921
  "width": "400px",
2922
+ "maxWidth": "100%",
2920
2923
  "gap": "8px",
2921
2924
  "padding": "20px 24px",
2922
2925
  "backgroundColor": "#ffffff",
@@ -1,7 +1,7 @@
1
1
  // GENERATED by scripts/gen-catalog.ts — do not edit by hand.
2
2
  // The platform commit every other generated file here describes.
3
3
  export const PLATFORM_SOURCE = {
4
- "commit": "69a6becbb8e36b80028b3b8c4ca1f92a4cc6d5bc",
5
- "committedAt": "2026-10-29T15:59:30+07:00",
4
+ "commit": "ab273ce14722dcc17f81176e01415a1892e5d878",
5
+ "committedAt": "2026-10-29T18:33:35+07:00",
6
6
  "dirty": false
7
7
  };
@@ -531,7 +531,7 @@ export const PAGE_LAYOUT_SEEDS = {
531
531
  "backgroundColor": "var(--wb-sc-border, #f5f5f5)",
532
532
  "color": "var(--wb-sc-heading, #171717)",
533
533
  "textAlign": "left",
534
- "fontFamily": "Inter",
534
+ "fontFamily": "var(--wb-ts-text-2-family, Inter)",
535
535
  "fontSize": "14px",
536
536
  "padding": "12px 16px"
537
537
  },
@@ -2183,7 +2183,7 @@ export const STORE_PAGE_SEEDS = {
2183
2183
  "fontSize": "16px",
2184
2184
  "lineHeight": "140%",
2185
2185
  "textAlign": "left",
2186
- "fontFamily": "Inter"
2186
+ "fontFamily": "var(--wb-ts-text-1-family, Inter)"
2187
2187
  },
2188
2188
  "config": {
2189
2189
  "kind": "price",
@@ -2251,7 +2251,7 @@ export const STORE_PAGE_SEEDS = {
2251
2251
  "fontSize": "16px",
2252
2252
  "lineHeight": "140%",
2253
2253
  "textAlign": "left",
2254
- "fontFamily": "Inter"
2254
+ "fontFamily": "var(--wb-ts-text-1-family, Inter)"
2255
2255
  },
2256
2256
  "config": {
2257
2257
  "kind": "compare_price",
@@ -2395,7 +2395,7 @@ export const STORE_PAGE_SEEDS = {
2395
2395
  "custom": {}
2396
2396
  },
2397
2397
  "style": {
2398
- "fontFamily": "Inter",
2398
+ "fontFamily": "var(--wb-ts-heading-6-family, Inter)",
2399
2399
  "color": "var(--wb-sc-heading, #000000)",
2400
2400
  "lineHeight": "1.3",
2401
2401
  "fontWeight": "700",
@@ -2420,7 +2420,7 @@ export const STORE_PAGE_SEEDS = {
2420
2420
  "custom": {}
2421
2421
  },
2422
2422
  "style": {
2423
- "fontFamily": "Inter",
2423
+ "fontFamily": "var(--wb-ts-text-1-family, Inter)",
2424
2424
  "fontSize": "16px",
2425
2425
  "color": "var(--wb-sc-link, #171717)",
2426
2426
  "lineHeight": "1.3",
@@ -263,7 +263,7 @@ export const STARTER_THEME = {
263
263
  "padding": "10px 24px",
264
264
  "textAlign": "center",
265
265
  "fontSize": "14px",
266
- "fontFamily": "Inter",
266
+ "fontFamily": "var(--wb-ts-text-2-family, Inter)",
267
267
  "lineHeight": "20px"
268
268
  },
269
269
  "responsive": {
@@ -556,7 +556,7 @@ export const STARTER_THEME = {
556
556
  "base": {
557
557
  "textAlign": "left",
558
558
  "lineHeight": "130%",
559
- "fontFamily": "Inter",
559
+ "fontFamily": "var(--wb-ts-heading-1-family, Inter)",
560
560
  "fontSize": "48px",
561
561
  "color": "var(--wb-sc-heading, var(--wb-color-heading))"
562
562
  },
@@ -642,7 +642,7 @@ export const STARTER_THEME = {
642
642
  "base": {
643
643
  "textAlign": "left",
644
644
  "lineHeight": "140%",
645
- "fontFamily": "Inter",
645
+ "fontFamily": "var(--wb-ts-text-1-family, Inter)",
646
646
  "fontSize": "16px",
647
647
  "color": "var(--wb-sc-text, var(--wb-color-text))"
648
648
  }
@@ -654,7 +654,7 @@ export const STARTER_THEME = {
654
654
  "base": {
655
655
  "textAlign": "left",
656
656
  "lineHeight": "140%",
657
- "fontFamily": "Inter",
657
+ "fontFamily": "var(--wb-ts-text-1-family, Inter)",
658
658
  "fontSize": "16px",
659
659
  "color": "var(--wb-sc-text, var(--wb-color-text))"
660
660
  }
@@ -30,9 +30,9 @@ export const FIX = {
30
30
  'A figure, a delivery or return promise, or a customer quote must be TRUE for this shop — ' +
31
31
  'if you do not know it, remove the element (sb_remove) rather than guess.',
32
32
  link_colour: 'Colour each link inline: sb_set id "<id>", namespace specials, keys { "textHtml": … } with ' +
33
- '<a href="…" style="color:inherit"> (or the brand colour) — no control or theme token reaches an <a> in text.',
34
- default_font: 'Wear the site\'s text font: sb_set id "<id>", namespace style, base true, keys { "fontFamily": ' +
35
- '"var(--wb-ts-text-2-family)" } — the variable tab-item and menu-item already use, so it follows the theme.',
33
+ '<a href="…" style="color:inherit"> — or drop the inner link and give the button its own href.',
34
+ default_font: 'Wear the theme\'s font again: sb_set id "<id>", namespace style, base true, keys { "fontFamily": ' +
35
+ '<the var(--wb-ts-…) the problem names> } — the element\'s seed today, so it follows the theme.',
36
36
  default_seed_copy: 'Write it in the shop\'s own language and ink: sb_set id "<id>", namespace specials, ' +
37
37
  'keys { "<key>": … }. It is a seeded satellite (an empty state, an element\'s chrome), ' +
38
38
  'so it only appears when the list is empty or the control is idle — sb_outline lists it ' +
@@ -80,7 +80,11 @@ export const FIX = {
80
80
  // "<key>" here is documentation, not a placeholder: this template is never
81
81
  // filled with a key, so the reader sees the form a field must take.
82
82
  dead_binding_field: 'Rebind with sb_bind and a field of the form "specials.<key>".',
83
+ duplicate_binding_field: 'Keep one: sb_bind id "<id>" field "<key>" with the source you want — it replaces the binding on ' +
84
+ 'that field and drops the duplicates.',
83
85
  off_canvas: 'Give it a width that can shrink — sb_set id "<id>", namespace style, keys { "maxWidth": "100%" } at this breakpoint.',
86
+ wider_than_viewport: 'Cap it at the screen: sb_set id "<id>", namespace style, keys { "maxWidth": "100%" }, ' +
87
+ 'breakpoint "mobile" (and each other width it overhangs at).',
84
88
  text_too_small: 'Raise it for this breakpoint: sb_set id "<id>", namespace style, keys { "fontSize": "16px" }.',
85
89
  title_bar_stranded: 'Put the action on the right edge: sb_set id "<id>", namespace style, keys ' +
86
90
  '{ "justifyContent": "space-between", "alignItems": "center" }, and sb_set id "<cell>", ' +
@@ -9,10 +9,10 @@ import { ELEMENTS, BINDING_SOURCES, BOUND_SPECIALS, FIRST_CHILD_ONLY, SATELLITE_
9
9
  import { fill } from './findings.js';
10
10
  import { hrefParamProblems, isRecordSource, isSameSitePath, parseRecordRefAxis, readRecordAggregates, recordAggKeyOf, recordAggregateParams, RECORD_FIELD_ID, RECORD_HTML_SOURCE, RECORD_SOURCE, RECORD_TILES, recordScope, } from './record.js';
11
11
  import { formFieldFindings, isFormDocument } from './formdoc.js';
12
- import { deadNavigation, hasPurchaseBinding, liveEventTable, PAYLOAD_NEEDS, soleNavigationClick } from './navhref.js';
12
+ import { deadNavigation, hasPurchaseBinding, liveEventTable, PAYLOAD_NEEDS, PRODUCT_ACTION_BINDING_ID, soleNavigationClick } from './navhref.js';
13
13
  import { unknownValueNote, unknownWriteNote, vocabularyFor, vocabularyForWrite } from './vocabulary.js';
14
14
  import { iconNote } from './icons.js';
15
- import { LINK_COLOUR, unstyledLinks } from './writecheck.js';
15
+ import { LINK_COLOUR, LINK_INHERITS, unstyledLinks } from './writecheck.js';
16
16
  /**
17
17
  * A defect somebody looking at the page would see.
18
18
  *
@@ -529,27 +529,30 @@ opts = {}) {
529
529
  });
530
530
  }
531
531
  }
532
- // A LINK IN RICH TEXT IS THE BROWSER'S BLUE — see writecheck LINK_COLOUR (TTG gap #50).
532
+ // A LINK IN A BUTTON'S RICH TEXT IS THE BROWSER'S BLUE — see writecheck LINK_COLOUR.
533
533
  const html = (n.specials ?? {}).textHtml;
534
- if (typeof html === 'string' && unstyledLinks(html)) {
534
+ if (typeof html === 'string' && !LINK_INHERITS.has(type) && unstyledLinks(html)) {
535
535
  out.push({ code: 'link_colour', nodeId: id, type, key: 'textHtml', problem: LINK_COLOUR.problem, fix: fill('link_colour', { id }) });
536
536
  }
537
- // THE ELEMENT'S OWN LITERAL FONT ON A THEMED SITE (TTG gap #51). Most
538
- // elements wear the theme's text style (`var(--wb-ts-…)`), but a few seed a
539
- // LITERAL family — accordion-item's "Inter" — so an accordion header added
540
- // to a site set in Be Vietnam Pro renders in Inter, and nothing said so.
541
- // Only when the node still holds exactly the seed and the theme's body font
542
- // is another family: a deliberate literal is the author's.
537
+ // A NODE STILL ON THE OLD LITERAL SEED FONT (TTG gap #51). Until web_builder
538
+ // v1.0.187 (e8900e4d9) a few elements seeded a LITERAL "Inter"; they now seed
539
+ // `var(--wb-ts-<slug>-family, Inter)`. A node created before that still holds
540
+ // the bare fallback, so on a site set in Be Vietnam Pro it renders in Inter.
541
+ // Flag only that exact residue — the stored value equals the fallback of the
542
+ // element's own seed var — against the family of the text style that var
543
+ // names. A var() is never flagged; a deliberate literal is the author's.
543
544
  const ff = n.style?.fontFamily;
544
545
  const seedFont = meta.defaults.style?.fontFamily;
546
+ const seed = typeof seedFont === 'string' ? /^var\(--wb-ts-([a-z0-9-]+)-family,\s*(.+)\)$/.exec(seedFont) : null;
547
+ const themed = seed ? opts.fonts?.[seed[1]] : undefined;
545
548
  // A family set at any breakpoint is the author's answer too.
546
549
  const perBp = Object.values(n.responsive ?? {}).some((r) => r?.style?.fontFamily !== undefined);
547
- if (opts.bodyFont && !perBp && typeof ff === 'string' && ff === seedFont && !ff.includes('var(') && family(ff) !== family(opts.bodyFont)) {
550
+ if (seed && themed && !perBp && typeof ff === 'string' && family(ff) === family(seed[2]) && !ff.includes('var(') && family(ff) !== family(themed)) {
548
551
  out.push({
549
552
  code: 'default_font',
550
553
  nodeId: id,
551
554
  type,
552
- problem: `Still the element's own literal font "${ff}", while the site's text is set in "${family(opts.bodyFont, true)}" — it renders in a typeface nothing else on the page uses.`,
555
+ problem: `Still the element's old literal seed font "${ff}", while the site's ${seed[1]} text style is "${family(themed, true)}" — it renders in a typeface nothing else on the page uses. The element now seeds ${seedFont}.`,
553
556
  fix: fill('default_font', { id }),
554
557
  });
555
558
  }
@@ -1537,6 +1540,30 @@ opts = {}) {
1537
1540
  });
1538
1541
  }
1539
1542
  }
1543
+ // TWO BINDINGS ON ONE FIELD (TTG gap #62). ApplyBindings
1544
+ // (render/scope/scope.go) walks them IN ORDER and each resolved source
1545
+ // overwrites the special, so the LAST renders and the rest are dead weight
1546
+ // that a reorder silently swaps. The purchase binding is not a field binding.
1547
+ const byField = new Map();
1548
+ for (const b of bindings) {
1549
+ if (!b.field || !b.source || b.id === PRODUCT_ACTION_BINDING_ID)
1550
+ continue;
1551
+ byField.set(b.field, [...(byField.get(b.field) ?? []), b.source]);
1552
+ }
1553
+ for (const [field, sources] of byField) {
1554
+ if (sources.length < 2)
1555
+ continue;
1556
+ const wins = sources[sources.length - 1];
1557
+ out.push({
1558
+ code: 'duplicate_binding_field',
1559
+ nodeId: id,
1560
+ type,
1561
+ key: field,
1562
+ problem: `${sources.length} bindings write ${field} (${sources.join(', ')}); the renderer applies them in ` +
1563
+ `order, so ${wins} renders and the others are dead weight.`,
1564
+ fix: fill('duplicate_binding_field', { id, key: field }),
1565
+ });
1566
+ }
1540
1567
  }
1541
1568
  // Tagged in ONE place rather than at eight push sites: whether a node sits
1542
1569
  // inside an overlay is a fact about where it is, not about what is wrong with
@@ -273,11 +273,12 @@ export function writeCheck(type, namespace, keys, opts = {}) {
273
273
  'never <p>/<div>, and put a separate block in its own node. A link goes to http(s), mailto, tel or a ' +
274
274
  'relative path; no comments.');
275
275
  }
276
- // A LINK IN RICH TEXT IS THE BROWSER'S BLUE. Nothing styles `a` inside a
277
- // text node — no element control, no theme token — so an <a> with no colour
278
- // of its own paints the user-agent default rgb(0,0,238) (measured live on a
279
- // #2e86ae site, TTG gap #50). The inline-rich gate keeps `style` color.
280
- if (namespace === 'specials' && typeof v === 'string' && rich.includes(k) && !bad.length && unstyledLinks(v)) {
276
+ // A LINK IN A BUTTON'S RICH TEXT IS THE BROWSER'S BLUE. Since web_builder
277
+ // v1.0.187 (a8097f59e) `.wb-text a` / `.wb-heading a` inherit the text
278
+ // colour, underlined — TTG gap #50 is closed there. `button` renders
279
+ // textHtml too (nodes.RichText) and its static CSS styles no `a`, so an <a>
280
+ // with no colour of its own still paints rgb(0,0,238) inside one.
281
+ if (namespace === 'specials' && typeof v === 'string' && rich.includes(k) && !bad.length && !LINK_INHERITS.has(type) && unstyledLinks(v)) {
281
282
  push(`link-colour:${type}.${k}`, 'link_colour', k, LINK_COLOUR.problem, LINK_COLOUR.fix);
282
283
  }
283
284
  if (namespace === 'specials') {
@@ -303,10 +304,12 @@ export function writeCheck(type, namespace, keys, opts = {}) {
303
304
  export function unstyledLinks(html) {
304
305
  return (html.match(/<a\b[^>]*>/gi) ?? []).filter((tag) => !/style\s*=\s*["'](?:[^"']*[;\s])?color\s*:/i.test(tag)).length;
305
306
  }
307
+ /** Elements whose static CSS gives an <a> in textHtml the text's own colour (web_builder a8097f59e). */
308
+ export const LINK_INHERITS = new Set(['heading', 'text']);
306
309
  export const LINK_COLOUR = {
307
- problem: "A link in this rich text has no colour of its own, so it renders in the browser's default link blue " +
308
- '(rgb(0,0,238)) with an underline — no element control or theme token reaches an <a> inside text.',
309
- fix: 'Give each <a> its colour inline: <a href="…" style="color:inherit"> (or the brand colour); the rich-text gate keeps a style color.',
310
+ problem: "A link in this button's rich text has no colour of its own, so it renders in the browser's default link blue " +
311
+ '(rgb(0,0,238)) — text and heading make a link inherit their colour; a button styles no <a>.',
312
+ fix: 'Give each <a> its colour inline: <a href="…" style="color:inherit">, or drop the inner link and give the button its own href.',
310
313
  };
311
314
  /**
312
315
  * `specials.formRules` on a form root, judged against the open form document.
@@ -29,6 +29,7 @@ import { LiveSession } from '../live/session.js';
29
29
  import { refuseAppBlockInterior } from '../domains/site/builder.js';
30
30
  import { soft } from '../domains/site/guard.js';
31
31
  import { hrefPatches, hasPurchaseBinding, liveEventTable, PAYLOAD_NEEDS, PRODUCT_ACTION_BINDING_ID, } from '../domains/site/navhref.js';
32
+ import { subtreeIds } from '../core/tree.js';
32
33
  import { offscreenNodes, offscreenRootOf } from '../domains/site/offscreen.js';
33
34
  import { searchStock, SearchUnavailable, NO_SEARCH_NEXT } from '../transport/stock.js';
34
35
  import { siteFor } from './context.js';
@@ -157,12 +158,21 @@ export function bindNode(doc, id, source, field, action, guard) {
157
158
  const at = node.bindings.findIndex((b) => b?.field === field && b.id !== PRODUCT_ACTION_BINDING_ID);
158
159
  if (at >= 0) {
159
160
  const prev = node.bindings[at];
161
+ // And drop any LATER binding on the same field (TTG gap #62): the renderer
162
+ // applies them in order and the last one wins, so replacing only the first
163
+ // would leave the old source rendering. Highest index first, so each
164
+ // `remove` addresses the list as it still stands.
165
+ const extra = node.bindings
166
+ .map((b, i) => (i > at && b?.field === field && b.id !== PRODUCT_ACTION_BINDING_ID ? i : -1))
167
+ .filter((i) => i >= 0)
168
+ .reverse();
160
169
  return [
161
170
  {
162
171
  op: 'set',
163
172
  path: ['nodes', id, 'bindings', String(at)],
164
173
  value: { id: prev.id ?? randomBytes(6).toString('hex'), source, field },
165
174
  },
175
+ ...extra.map((index) => ({ op: 'remove', path: ['nodes', id, 'bindings'], index })),
166
176
  ];
167
177
  }
168
178
  return [
@@ -431,7 +441,16 @@ export function registerLiveTools(server, ctx, session) {
431
441
  // and judging its geometry produced thirteen false off-canvas findings
432
442
  // per page on a site whose pages were correct.
433
443
  const skip = offscreenNodes(doc);
434
- const visual = node_id ? [] : measure(shots, skip, doc);
444
+ // A framed look measures nothing — EXCEPT the overlay it opened, the one
445
+ // surface no whole-page look ever shows open (TTG gap #60: a 400px drawer
446
+ // on a 390px phone reported no layout). Judged alone: the page beneath is
447
+ // what a whole-page look is for.
448
+ const opened = openOverlay ? new Set(subtreeIds(doc, openOverlay)) : undefined;
449
+ const visual = opened
450
+ ? measure(shots, new Set([...skip].filter((id) => !opened.has(id))), doc).filter((f) => opened.has(f.nodeId))
451
+ : node_id
452
+ ? []
453
+ : measure(shots, skip, doc);
435
454
  const layout = compactFindings(visual);
436
455
  const layoutNotice = visual.length > 0 ? ctx.notices.once('measure', MEASURE_NOTICE) : undefined;
437
456
  // The legend rides with the first look only; the shape does not change after.
@@ -49,8 +49,8 @@ import { FILTER_VALUE_TYPES, RESOURCE_KEYS, filterPatches, wantsRows } from '../
49
49
  * copies of a directive is how one of them quietly loses it. The fix for each
50
50
  * KIND is sent once under `fixes`, and the directive once per process.
51
51
  */
52
- export function reviewField(ctx, doc, formTypes, pageType, formDocType, formRedirects, siteLocale, bodyFont) {
53
- const all = reviewDesign(doc, { formTypes, pageType, formDocType, formRedirects, siteLocale, bodyFont });
52
+ export function reviewField(ctx, doc, formTypes, pageType, formDocType, formRedirects, siteLocale, fonts) {
53
+ const all = reviewDesign(doc, { formTypes, pageType, formDocType, formRedirects, siteLocale, fonts });
54
54
  if (all.length === 0)
55
55
  return {};
56
56
  // MAINTENANCE IS ADVICE, kept out of `findings`: it works for a visitor, so
@@ -2041,19 +2041,21 @@ export function registerPageTools(server, ctx) {
2041
2041
  catch {
2042
2042
  // Readiness is additional information, never the reason a review fails.
2043
2043
  }
2044
- // The site's body font, for `default_font` — a SITE theme only: the starter
2045
- // is set in Inter, so it can never disagree with an element's literal Inter.
2046
- let bodyFont;
2044
+ // The site's font per text style, for `default_font` — a SITE theme only: the
2045
+ // starter is set in Inter, so it can never disagree with an old literal Inter.
2046
+ const fonts = {};
2047
2047
  try {
2048
2048
  const { theme, from } = await siteTheme(ctx, session.site());
2049
- const f = theme.textStyles.find((t) => t.slug === 'text-2')?.base?.fontFamily;
2050
- if (from === 'site' && typeof f === 'string' && f && !f.includes('var('))
2051
- bodyFont = f;
2049
+ for (const t of from === 'site' ? theme.textStyles : []) {
2050
+ const f = t.base?.fontFamily;
2051
+ if (typeof f === 'string' && f && !f.includes('var('))
2052
+ fonts[t.slug] = f;
2053
+ }
2052
2054
  }
2053
2055
  catch {
2054
2056
  // A theme that cannot be read is a finding nobody gets, never a failed review.
2055
2057
  }
2056
- const field = reviewField(ctx, doc, formTypes, pageType, session.formType(), formRedirects, siteLocale, bodyFont);
2058
+ const field = reviewField(ctx, doc, formTypes, pageType, session.formType(), formRedirects, siteLocale, fonts);
2057
2059
  // Clean = no finding a visitor meets; `advice` (maintenance) rides beside the verdict.
2058
2060
  const clean = !field.findings;
2059
2061
  return text({
@@ -278,11 +278,13 @@ export function registerThemeTools(server, ctx) {
278
278
  for (const [id, decls] of Object.entries(presets ?? {})) {
279
279
  patchLayers(theme.presets.find((p) => p.id === id), decls, `presets.${id}`, changes);
280
280
  }
281
- // A FAMILY ON A TEXT STYLE REACHES NOTHING A PRESET PINS. heading-default,
282
- // text-default, text-dataset-default and button-default carry a literal
283
- // `fontFamily: "Inter"`, so changing the style's family changed nothing on
284
- // headings or buttons — measured on a live storefront. Named, not fixed:
285
- // which presets should follow is the caller's design decision.
281
+ // A FAMILY ON A TEXT STYLE REACHES NOTHING A PRESET PINS. A site theme saved
282
+ // before web_builder v1.0.187 carries a literal `fontFamily: "Inter"` on
283
+ // heading-default, text-default, text-dataset-default and button-default
284
+ // (the starter now seeds `var(--wb-ts-…-family, Inter)`), so changing the
285
+ // style's family changed nothing on headings or buttons — measured on a
286
+ // live storefront. Named, not fixed: which presets should follow is the
287
+ // caller's design decision.
286
288
  const families = new Set(Object.values(text_styles ?? {})
287
289
  .map((d) => d.fontFamily)
288
290
  .filter((f) => typeof f === 'string'));
@@ -33,10 +33,29 @@ export function measureShot(shot, skip = new Set(), doc) {
33
33
  // that is two dozen false positives long is a list nobody reads.
34
34
  if (skip.has(b.id))
35
35
  continue;
36
- // OFF-CANVAS. A negative x, or a right edge past the viewport, is content
37
- // the visitor cannot reach — and on a phone it also drags a horizontal
38
- // scrollbar across the whole page.
39
- if (b.x < -SLOP || b.x + b.w > shot.width + SLOP) {
36
+ // A box the browser does not show (a CLOSED drawer is `visibility:hidden`
37
+ // and translated off-screen by its own static CSS) is not a visitor's
38
+ // problem; the same drawer OPENED is (TTG gap #60).
39
+ if (b.hidden)
40
+ continue;
41
+ // A FLOATING BOX PAST THE VIEWPORT (TTG gap #60). A fixed drawer 400px wide
42
+ // on a 390px phone overhangs by 10px with no scrollbar to show it — headless
43
+ // has none, and a 24px padding hides most of it in the picture. Out of the
44
+ // flow nothing shrinks it, so the fix is a cap, said with the widths.
45
+ if ((b.position === 'fixed' || b.position === 'sticky' || b.position === 'absolute') &&
46
+ (b.x < -1 || b.x + b.w > shot.width + 1)) {
47
+ out.push({
48
+ code: 'wider_than_viewport',
49
+ nodeId: b.id,
50
+ width: shot.width,
51
+ problem: `${b.position} box ${b.w}px wide on a ${shot.width}px viewport, overhanging it (${b.x} → ${b.x + b.w}).`,
52
+ fix: fill('wider_than_viewport', { id: b.id }),
53
+ });
54
+ }
55
+ else if (b.x < -SLOP || b.x + b.w > shot.width + SLOP) {
56
+ // OFF-CANVAS. A negative x, or a right edge past the viewport, is content
57
+ // the visitor cannot reach — and on a phone it also drags a horizontal
58
+ // scrollbar across the whole page.
40
59
  out.push({
41
60
  code: 'off_canvas',
42
61
  nodeId: b.id,
@@ -74,6 +93,8 @@ export function measureShot(shot, skip = new Set(), doc) {
74
93
  continue;
75
94
  if (a.w === 0 || a.h === 0 || b.w === 0 || b.h === 0)
76
95
  continue;
96
+ if (a.hidden || b.hidden)
97
+ continue;
77
98
  // AND THE COMMENT ABOVE IS NOW IMPLEMENTED. It has always said that "an
78
99
  // absolutely-positioned decoration over a band is a design choice", and
79
100
  // nothing checked: `Box` carried no `position`, so the rule could not tell
@@ -364,6 +364,7 @@ async function shootOne(page, url, width, format, opts) {
364
364
  hasText: own.length > 0,
365
365
  position: cs.position,
366
366
  ...(layer ? { layer } : {}),
367
+ ...(cs.visibility !== 'visible' || el.closest('[aria-hidden="true"]') ? { hidden: true } : {}),
367
368
  };
368
369
  });
369
370
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbuilder-mcp",
3
- "version": "0.100.1",
3
+ "version": "0.100.3",
4
4
  "description": "MCP server that designs and operates a Store Builder site — pages, data, theme and publish — through the platform's own API and live-edit protocol.",
5
5
  "mcpName": "io.github.vuluu2k/sbuilder-mcp",
6
6
  "type": "module",