sbuilder-mcp 0.98.4 → 0.98.6
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 +25 -0
- package/CHANGELOG.vi.md +25 -0
- package/dist/catalog/element-search.js +10 -3
- package/dist/catalog/fieldskin.generated.js +137 -0
- package/dist/catalog/icons.generated.js +6 -0
- package/dist/domains/site/baseonly.js +12 -4
- package/dist/domains/site/builder.js +3 -3
- package/dist/domains/site/findings.js +2 -0
- package/dist/domains/site/formdoc.js +21 -0
- package/dist/domains/site/importmap.js +5 -0
- package/dist/domains/site/readiness-fetch.js +1 -0
- package/dist/domains/site/readiness.js +7 -1
- package/dist/domains/site/writecheck.js +65 -7
- package/dist/mcp/serial.js +36 -0
- package/dist/server.js +23 -0
- package/dist/tools/page.js +47 -4
- package/dist/vision/measure.js +6 -0
- package/dist/vision/shoot.js +35 -21
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,31 @@ 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.98.6] - 2026-10-29
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- `sb_add` and `sb_set` report a `hidden_band` check, once per process, when a node is hidden at base, because that hides it only at 1440px and wider, and name the per-breakpoint writes that hide it at every width.
|
|
13
|
+
- `sb_add`, `sb_set` and `sb_review` report `form_register_phone` for a register form whose phone field is not named `phone`.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
- `sb_set` and `sb_add` write `config.hidden` set at desktop to base, because the renderer reads only base for desktop and never read the desktop slot it was written to.
|
|
17
|
+
|
|
18
|
+
## [0.98.5] - 2026-10-29
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
- `sb_look` boxes carry a `layer` field, and a box inside a fixed, sticky or absolute layer is compared for overlap only with boxes in the same layer.
|
|
22
|
+
- `sb_traits_for` lists the skin tables such as `pay_card_skin` that the catalog generates for field controls.
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
- Every tool that touches the open document runs in the order its requests arrive, so concurrent calls no longer interleave.
|
|
26
|
+
- `sb_page_open` is now required before the read commands that work on the open page, which wait for it.
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
- `sb_publish` reports pages it republished only through the cascade under `cascaded` and keeps their drafts in `unpublished_drafts` until they are published by name, because the cascade no longer hides a draft that is not live.
|
|
30
|
+
- `sb_set` and `sb_add` no longer treat icon-picker control names as config keys, and report `unknown_key` for `config.icon` on an icon element with a pointer to `specials.name`.
|
|
31
|
+
- `seed_override` for `mobile.flexDirection: column` on a flex-block flips a row stored at base, and the importer's packed-row note names the mobile row.
|
|
32
|
+
- `sb_review` no longer flags the merged sign-in and sign-up page on `/account` as a duplicate auth page.
|
|
33
|
+
|
|
9
34
|
## [0.98.4] - 2026-10-29
|
|
10
35
|
|
|
11
36
|
### Fixed
|
package/CHANGELOG.vi.md
CHANGED
|
@@ -6,6 +6,31 @@ 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.98.6] - 2026-10-29
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- `sb_add` và `sb_set` báo check `hidden_band` (một lần mỗi process) khi node bị ẩn ở base, vì cách đó chỉ ẩn từ 1440px trở lên, và nêu các cách ghi theo từng breakpoint để ẩn ở mọi độ rộng.
|
|
13
|
+
- `sb_add`, `sb_set` và `sb_review` báo `form_register_phone` với form đăng ký có trường số điện thoại không tên `phone`.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
- `sb_set` và `sb_add` ghi `config.hidden` đặt ở desktop vào base, vì renderer chỉ đọc base cho desktop và không bao giờ đọc slot desktop mà giá trị này từng được ghi vào.
|
|
17
|
+
|
|
18
|
+
## [0.98.5] - 2026-10-29
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
- Hộp trong `sb_look` có thêm trường `layer`, và hộp nằm trong lớp fixed, sticky hoặc absolute chỉ được so overlap với hộp cùng lớp.
|
|
22
|
+
- `sb_traits_for` liệt kê các bảng skin như `pay_card_skin` mà catalog sinh ra cho các control của field.
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
- Mọi tool chạm vào tài liệu đang mở chạy theo đúng thứ tự request tới, nên các lời gọi đồng thời không còn xen kẽ nhau.
|
|
26
|
+
- `sb_page_open` giờ là điều kiện trước của các lệnh đọc trên trang đang mở, và các lệnh đó chờ nó hoàn tất.
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
- `sb_publish` báo các trang chỉ được publish lại qua cascade trong `cascaded` và giữ bản nháp của chúng trong `unpublished_drafts` cho tới khi publish đích danh, vì cascade không còn che bản nháp chưa lên live.
|
|
30
|
+
- `sb_set` và `sb_add` không còn coi tên control của bộ chọn icon là config key, và báo `unknown_key` cho `config.icon` trên phần tử icon kèm gợi ý dùng `specials.name`.
|
|
31
|
+
- `seed_override` cho `mobile.flexDirection: column` trên flex-block lật hàng đang ghi ở base, và ghi chú hàng packed của importer nói rõ hàng mobile.
|
|
32
|
+
- `sb_review` không còn báo trang `/account` gộp đăng nhập và đăng ký là trang auth trùng lặp.
|
|
33
|
+
|
|
9
34
|
## [0.98.4] - 2026-10-29
|
|
10
35
|
|
|
11
36
|
### Fixed
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ELEMENTS, TRAIT_WRITES, WRITE_PRECONDITIONS } from './elements.generated.js';
|
|
2
2
|
import { FORM_TEMPLATES } from './checkout.generated.js';
|
|
3
|
+
import { FIELD_SKIN_BY_CONTROL } from './fieldskin.generated.js';
|
|
3
4
|
import { isBaseOnlyConfig } from '../domains/site/baseonly.js';
|
|
4
5
|
import { bindableFields } from '../domains/site/writecheck.js';
|
|
5
6
|
import { animationValues, animationVocabulary, elementVocabularies, sharedVocabularies, vocabulariesForWrites, } from '../domains/site/vocabulary.js';
|
|
@@ -234,6 +235,11 @@ export function searchWithTemplates(query, elements) {
|
|
|
234
235
|
*/
|
|
235
236
|
export function describeControl(key) {
|
|
236
237
|
const d = TRAIT_WRITES[key];
|
|
238
|
+
// A skin panel is one FieldSkinRows widget over one knob table — generated,
|
|
239
|
+
// so it is declared even though the trait registry never names it.
|
|
240
|
+
const skin = FIELD_SKIN_BY_CONTROL[key];
|
|
241
|
+
if (!d && skin)
|
|
242
|
+
return { writes: skin.map((k) => ({ target: 'config', writeKey: k })) };
|
|
237
243
|
if (!d) {
|
|
238
244
|
return {
|
|
239
245
|
writes: null,
|
|
@@ -279,10 +285,11 @@ export function traitsFor(type, control) {
|
|
|
279
285
|
].filter((k) => isBaseOnlyConfig(type, k));
|
|
280
286
|
const declared = {};
|
|
281
287
|
for (const c of el.controls) {
|
|
282
|
-
|
|
288
|
+
const desc = describeControl(c);
|
|
289
|
+
if (!desc.writes)
|
|
283
290
|
continue;
|
|
284
|
-
const base =
|
|
285
|
-
declared[c] = { ...
|
|
291
|
+
const base = desc.writes.some((w) => w.target === 'config' && isBaseOnlyConfig(type, w.writeKey));
|
|
292
|
+
declared[c] = { ...desc, ...(base ? { responsive: false } : {}) };
|
|
286
293
|
}
|
|
287
294
|
const preconditions = WRITE_PRECONDITIONS.filter((p) => p.types.includes(type)).map(({ types: _, ...p }) => p);
|
|
288
295
|
const bindable = bindableFields(type);
|
|
@@ -310,3 +310,140 @@ export const FIELD_SKIN_BY_NODE = {
|
|
|
310
310
|
"panelShadowColor"
|
|
311
311
|
]
|
|
312
312
|
};
|
|
313
|
+
/**
|
|
314
|
+
* The config keys each skin CONTROL writes — one `FieldSkinRows` widget over one
|
|
315
|
+
* knob table (`editor/src/trait/widgets.ts`). The trait registry describes none
|
|
316
|
+
* of these controls, so without this `sb_traits_for` called them undeclared.
|
|
317
|
+
*/
|
|
318
|
+
export const FIELD_SKIN_BY_CONTROL = {
|
|
319
|
+
"field_skin": [
|
|
320
|
+
"fieldBg",
|
|
321
|
+
"fieldBorderColor",
|
|
322
|
+
"fieldBorderWidth",
|
|
323
|
+
"fieldRadius",
|
|
324
|
+
"fieldPadY",
|
|
325
|
+
"fieldPadX"
|
|
326
|
+
],
|
|
327
|
+
"field_text_skin": [
|
|
328
|
+
"fieldTextColor",
|
|
329
|
+
"fieldFontSize",
|
|
330
|
+
"fieldPlaceholderColor"
|
|
331
|
+
],
|
|
332
|
+
"field_state_skin": [
|
|
333
|
+
"fieldFocusColor",
|
|
334
|
+
"fieldErrorColor"
|
|
335
|
+
],
|
|
336
|
+
"field_area_skin": [
|
|
337
|
+
"fieldAreaMinHeight"
|
|
338
|
+
],
|
|
339
|
+
"search_panel_skin": [
|
|
340
|
+
"panelBg",
|
|
341
|
+
"panelBorderColor",
|
|
342
|
+
"panelBorderWidth",
|
|
343
|
+
"panelRadius",
|
|
344
|
+
"panelOffset"
|
|
345
|
+
],
|
|
346
|
+
"search_panel_shadow": [
|
|
347
|
+
"panelShadowY",
|
|
348
|
+
"panelShadowBlur",
|
|
349
|
+
"panelShadowColor"
|
|
350
|
+
],
|
|
351
|
+
"form_message_skin": [
|
|
352
|
+
"formSentColor",
|
|
353
|
+
"formSentSize",
|
|
354
|
+
"formErrorSize"
|
|
355
|
+
],
|
|
356
|
+
"radio_skin": [
|
|
357
|
+
"choiceRowGap",
|
|
358
|
+
"choiceColGap",
|
|
359
|
+
"choiceGap",
|
|
360
|
+
"choiceSize",
|
|
361
|
+
"choiceBorderWidth",
|
|
362
|
+
"choiceBorderColor",
|
|
363
|
+
"choiceBg",
|
|
364
|
+
"choiceAccent",
|
|
365
|
+
"choiceTextColor",
|
|
366
|
+
"choiceFontSize",
|
|
367
|
+
"choiceDot"
|
|
368
|
+
],
|
|
369
|
+
"checkbox_skin": [
|
|
370
|
+
"choiceRowGap",
|
|
371
|
+
"choiceColGap",
|
|
372
|
+
"choiceGap",
|
|
373
|
+
"choiceSize",
|
|
374
|
+
"choiceBorderWidth",
|
|
375
|
+
"choiceBorderColor",
|
|
376
|
+
"choiceBg",
|
|
377
|
+
"choiceAccent",
|
|
378
|
+
"choiceTextColor",
|
|
379
|
+
"choiceFontSize",
|
|
380
|
+
"choiceRadius",
|
|
381
|
+
"choiceMarkWidth"
|
|
382
|
+
],
|
|
383
|
+
"timeslot_skin": [
|
|
384
|
+
"slotBg",
|
|
385
|
+
"slotBorderColor",
|
|
386
|
+
"slotBorderWidth",
|
|
387
|
+
"slotRadius",
|
|
388
|
+
"slotPadY",
|
|
389
|
+
"slotPadX",
|
|
390
|
+
"slotGap",
|
|
391
|
+
"slotMinWidth",
|
|
392
|
+
"slotMinHeight",
|
|
393
|
+
"slotAccent",
|
|
394
|
+
"slotHoverColor",
|
|
395
|
+
"slotSelectedWeight",
|
|
396
|
+
"slotTextColor",
|
|
397
|
+
"slotFontSize"
|
|
398
|
+
],
|
|
399
|
+
"slot_marker_skin": [
|
|
400
|
+
"slotMarkerSize",
|
|
401
|
+
"slotMarkerDot",
|
|
402
|
+
"slotMarkerGap"
|
|
403
|
+
],
|
|
404
|
+
"file_skin": [
|
|
405
|
+
"fileGap",
|
|
406
|
+
"filePlaceholderWeight"
|
|
407
|
+
],
|
|
408
|
+
"field_chrome": [
|
|
409
|
+
"fieldStackGap",
|
|
410
|
+
"fieldReqColor",
|
|
411
|
+
"fieldHintOpacity",
|
|
412
|
+
"fieldLabelColor",
|
|
413
|
+
"fieldLabelSize",
|
|
414
|
+
"fieldLabelWeight",
|
|
415
|
+
"fieldHintColor",
|
|
416
|
+
"fieldHintSize",
|
|
417
|
+
"fieldLabelPosition",
|
|
418
|
+
"fieldLabelPosition",
|
|
419
|
+
"fieldLabelPosition",
|
|
420
|
+
"fieldLabelPosition",
|
|
421
|
+
"fieldLabelWidth"
|
|
422
|
+
],
|
|
423
|
+
"pay_card_skin": [
|
|
424
|
+
"payCardBg",
|
|
425
|
+
"payCardBorderColor",
|
|
426
|
+
"payCardBorderWidth",
|
|
427
|
+
"payCardRadius",
|
|
428
|
+
"payCardPadY",
|
|
429
|
+
"payCardPadX",
|
|
430
|
+
"payCardGap",
|
|
431
|
+
"payCardRowGap"
|
|
432
|
+
],
|
|
433
|
+
"pay_state_skin": [
|
|
434
|
+
"payCardAccent",
|
|
435
|
+
"payCardSelectedBg",
|
|
436
|
+
"payCardHoverColor",
|
|
437
|
+
"payCardHoverBg"
|
|
438
|
+
],
|
|
439
|
+
"pay_text_skin": [
|
|
440
|
+
"payCardText",
|
|
441
|
+
"payCardNameWeight",
|
|
442
|
+
"payCardDescOpacity",
|
|
443
|
+
"payCardBodyGap"
|
|
444
|
+
],
|
|
445
|
+
"pay_marker_skin": [
|
|
446
|
+
"payMarkerSize",
|
|
447
|
+
"payMarkerDot"
|
|
448
|
+
]
|
|
449
|
+
};
|
|
@@ -114,3 +114,9 @@ export const ICON_KEYS = {
|
|
|
114
114
|
}
|
|
115
115
|
]
|
|
116
116
|
};
|
|
117
|
+
/**
|
|
118
|
+
* Every inspector control that IS an icon picker (`widgets.ts`). Its name is a
|
|
119
|
+
* WIDGET, not a key: the `icon` control writes `specials.name` on an `icon`,
|
|
120
|
+
* so `config.icon` there is stored and read by nothing (the star renders).
|
|
121
|
+
*/
|
|
122
|
+
export const ICON_CONTROLS = ["breadcrumb_icon", "button_icon", "chat_launcher_icon", "divider_icon", "field_icon", "icon", "list_dataset_nav", "list_item_icon", "popup_close"];
|
|
@@ -45,17 +45,25 @@ const EXCEPTIONS = new Set(BASE_ONLY_EXCEPTIONS);
|
|
|
45
45
|
export function isBaseOnlyConfig(type, key) {
|
|
46
46
|
return BASE_ONLY.has(key) && !EXCEPTIONS.has(`${type}:${key}`);
|
|
47
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* `config.hidden` AT DESKTOP IS THE BASE KEY. It does not cascade: desktop reads
|
|
50
|
+
* `node.config.hidden` and every narrower band only its own slot
|
|
51
|
+
* (render/css.go hiddenAt, editor trait/display.ts isHiddenAt), so
|
|
52
|
+
* `responsive.desktop.config.hidden` — where a default sb_set landed — is read by
|
|
53
|
+
* nothing. Not reported as base-only: it is not, at any other breakpoint.
|
|
54
|
+
*/
|
|
55
|
+
const atBase = (type, key, bp) => isBaseOnlyConfig(type, key) || (key === 'hidden' && bp === 'desktop');
|
|
48
56
|
/**
|
|
49
57
|
* Split a config write into the keys that must land at base and the rest.
|
|
50
58
|
*
|
|
51
59
|
* Both halves are returned even when one is empty, so the caller writes the same
|
|
52
60
|
* two patch groups every time rather than branching on which case it is in.
|
|
53
61
|
*/
|
|
54
|
-
export function splitBaseOnly(type, keys) {
|
|
62
|
+
export function splitBaseOnly(type, keys, bp) {
|
|
55
63
|
const base = {};
|
|
56
64
|
const responsive = {};
|
|
57
65
|
for (const [k, v] of Object.entries(keys)) {
|
|
58
|
-
if (
|
|
66
|
+
if (atBase(type, k, bp))
|
|
59
67
|
base[k] = v;
|
|
60
68
|
else
|
|
61
69
|
responsive[k] = v;
|
|
@@ -63,11 +71,11 @@ export function splitBaseOnly(type, keys) {
|
|
|
63
71
|
return { base, responsive };
|
|
64
72
|
}
|
|
65
73
|
/** The same split for `unset`, which shares the slot a write lands in. */
|
|
66
|
-
export function splitBaseOnlyKeys(type, keys) {
|
|
74
|
+
export function splitBaseOnlyKeys(type, keys, bp) {
|
|
67
75
|
const base = [];
|
|
68
76
|
const responsive = [];
|
|
69
77
|
for (const k of keys) {
|
|
70
|
-
if (
|
|
78
|
+
if (atBase(type, k, bp))
|
|
71
79
|
base.push(k);
|
|
72
80
|
else
|
|
73
81
|
responsive.push(k);
|
|
@@ -169,7 +169,7 @@ export function addSubtree(doc, parentId, spec, index, guard) {
|
|
|
169
169
|
if (responsive) {
|
|
170
170
|
responsive = {};
|
|
171
171
|
for (const [bp, slot] of Object.entries(s.responsive)) {
|
|
172
|
-
const split = splitBaseOnly(s.type, slot.config ?? {});
|
|
172
|
+
const split = splitBaseOnly(s.type, slot.config ?? {}, bp);
|
|
173
173
|
if (Object.keys(split.base).length)
|
|
174
174
|
config = { ...config, ...split.base };
|
|
175
175
|
responsive[bp] = { ...slot, ...(slot.config ? { config: split.responsive } : {}) };
|
|
@@ -508,9 +508,9 @@ export function setKeys(doc, id, keys, opts) {
|
|
|
508
508
|
// routing precedent: the caller's intent is not in doubt, but a caller who
|
|
509
509
|
// reads the node back must not have to hunt for the keys.
|
|
510
510
|
const type = doc.node(id).data.type;
|
|
511
|
-
const split = namespace === 'config' ? splitBaseOnly(type, keys) : { base: {}, responsive: keys };
|
|
511
|
+
const split = namespace === 'config' ? splitBaseOnly(type, keys, bp) : { base: {}, responsive: keys };
|
|
512
512
|
const unsetSplit = namespace === 'config'
|
|
513
|
-
? splitBaseOnlyKeys(type, opts.unset ?? [])
|
|
513
|
+
? splitBaseOnlyKeys(type, opts.unset ?? [], bp)
|
|
514
514
|
: { base: [], responsive: opts.unset ?? [] };
|
|
515
515
|
return [
|
|
516
516
|
...Object.entries(split.responsive).map(([k, v]) => ({
|
|
@@ -179,6 +179,8 @@ export const FIX = {
|
|
|
179
179
|
form_booking_dates: 'Keep one date (an appointment) or two (a stay: check-in then check-out) — sb_remove id ' +
|
|
180
180
|
'"<id>", or ask for it as text. Booking rules (closedDates, min/maxStayNights, capacity) ' +
|
|
181
181
|
'read only the first two date fields.',
|
|
182
|
+
form_register_phone: 'sb_set id "<id>", namespace specials, keys { "name": "phone", "mapTo": "customer.phone", "inputType": "tel" } ' +
|
|
183
|
+
'— the palette\'s contact-phone row, the one name the sign-up reads.',
|
|
182
184
|
};
|
|
183
185
|
/** The template for `code`, with every `<name>` in `vars` substituted. */
|
|
184
186
|
export function fill(code, vars) {
|
|
@@ -170,6 +170,27 @@ export function formFieldFindings(d, formType) {
|
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
+
// A REGISTER form stores a phone only from the control named exactly `phone`
|
|
174
|
+
// (web_builder 6427c495b, runtime form.ts authValues — the palette's
|
|
175
|
+
// contact-phone row): any other name answers 200 and saves phone "". Silent
|
|
176
|
+
// when some field already posts as `phone`; the re-entry box is not a phone.
|
|
177
|
+
if (formType === 'register') {
|
|
178
|
+
const fields = formFields(d).filter((n) => collectsValue(n.data.type));
|
|
179
|
+
const phoneish = fields.find((n) => {
|
|
180
|
+
const s = n.specials ?? {};
|
|
181
|
+
return s.mapTo === 'customer.phone' || (s.inputType === 'tel' && s.mapTo !== 'customer.confirmPhone');
|
|
182
|
+
});
|
|
183
|
+
if (phoneish && !fields.some((n) => postedName(n) === 'phone')) {
|
|
184
|
+
out.push({
|
|
185
|
+
code: 'form_register_phone',
|
|
186
|
+
nodeId: phoneish.id,
|
|
187
|
+
type: phoneish.data.type,
|
|
188
|
+
key: 'name',
|
|
189
|
+
problem: `A register form saves the customer's phone only from the field named "phone"; this one posts as ` +
|
|
190
|
+
`"${postedName(phoneish)}", so every sign-up stores an empty phone.`,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
}
|
|
173
194
|
return out;
|
|
174
195
|
}
|
|
175
196
|
/** A posted-name suggestion from a label: "Dịch vụ" → "dich_vu". */
|
|
@@ -558,6 +558,11 @@ function shape(c, t) {
|
|
|
558
558
|
gap: '24px',
|
|
559
559
|
...(c.align === 'center' ? { justifyContent: 'center' } : {}),
|
|
560
560
|
},
|
|
561
|
+
// SAID AT MOBILE because `flex-block` SEEDS `mobile.flexDirection:
|
|
562
|
+
// column`, which this row's base `row` does not reach — so every
|
|
563
|
+
// packed row (a menu, a pair of buttons) stacked at 390 instead of
|
|
564
|
+
// wrapping, the opposite of what the comment above promises (TTG #26).
|
|
565
|
+
responsive: { mobile: { style: { flexDirection: 'row' } } },
|
|
561
566
|
// `width: auto` IS THE LOAD-BEARING HALF, and leaving it out looked
|
|
562
567
|
// like the whole idea had failed. `flex-block` seeds `width: 100%`
|
|
563
568
|
// from its element defaults, and `flex: 0 0 auto` only says "do not
|
|
@@ -151,6 +151,7 @@ export async function gatherReadiness(ctx, siteId, pageNodes, openPageId) {
|
|
|
151
151
|
pages: pageList?.pages ?? null,
|
|
152
152
|
menuLinks,
|
|
153
153
|
openPageType: open && open.isDefaultTemplate !== false ? open.type : undefined,
|
|
154
|
+
openType: open?.type,
|
|
154
155
|
products,
|
|
155
156
|
liveGateways,
|
|
156
157
|
shippingMethods,
|
|
@@ -389,8 +389,14 @@ export function readinessGaps(input) {
|
|
|
389
389
|
//
|
|
390
390
|
// COUNTED BY DISTINCT TYPE, not by how many form nodes there are. A form split
|
|
391
391
|
// across segments is several nodes of ONE type and is not this defect.
|
|
392
|
+
//
|
|
393
|
+
// NOT ON /account (TTG gap #28): the platform sends both jobs THERE — a
|
|
394
|
+
// members-only page redirects an anonymous visitor to /account
|
|
395
|
+
// (storefront/membersonly.go), and a form-link to the login or register page
|
|
396
|
+
// TYPE with no such page lands on "/account — the account page every store
|
|
397
|
+
// has, which carries its own sign-in and sign-up" (storefront/pagetyperoute.go).
|
|
392
398
|
const authTypes = new Set(['login', 'register', 'forgot', 'reset', 'verify']);
|
|
393
|
-
if (input.forms && input.forms.length > 0) {
|
|
399
|
+
if (input.forms && input.forms.length > 0 && input.openType !== 'account') {
|
|
394
400
|
const typeOf = new Map(input.forms
|
|
395
401
|
.filter((f) => !!f?.id && !!f?.type)
|
|
396
402
|
.map((f) => [f.id, f.type]));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BASE_ONLY_CONFIG, BOUND_SPECIALS, CONFIG_VALUES, ELEMENT_VALUES, ELEMENTS, HOVER_HOMES, SATELLITE_RULES, TRAIT_WRITES, WRITE_PRECONDITIONS, } from '../../catalog/elements.generated.js';
|
|
2
|
-
import { FIELD_SKIN_BY_NODE } from '../../catalog/fieldskin.generated.js';
|
|
2
|
+
import { FIELD_SKIN_BY_CONTROL, FIELD_SKIN_BY_NODE } from '../../catalog/fieldskin.generated.js';
|
|
3
3
|
import { FORM_RULE_VOCAB } from '../../catalog/formrules.generated.js';
|
|
4
4
|
import { fill } from './findings.js';
|
|
5
5
|
import { collectsValue, formFieldFindings, formFields, nameFromLabel } from './formdoc.js';
|
|
6
|
-
import { ICON_KEYS } from '../../catalog/icons.generated.js';
|
|
6
|
+
import { ICON_CONTROLS, ICON_KEYS } from '../../catalog/icons.generated.js';
|
|
7
7
|
import { TRANSLATABLE_SPECIALS } from '../../catalog/translations.generated.js';
|
|
8
8
|
import { INLINE_RICH } from '../../catalog/richtext.generated.js';
|
|
9
9
|
import { iconNote } from './icons.js';
|
|
@@ -74,9 +74,13 @@ function keysOf(type) {
|
|
|
74
74
|
add('specials', TRANSLATABLE_SPECIALS[type]);
|
|
75
75
|
// A control the trait registry does not describe is often an inspector row
|
|
76
76
|
// named after the key it writes (`{ key: 'quickviewId', visible: false }` on
|
|
77
|
-
// list-dataset), so its NAME counts as a key in either namespace
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
// list-dataset), so its NAME counts as a key in either namespace — unless the
|
|
78
|
+
// control is a WIDGET whose writes are generated: the `icon` picker writes
|
|
79
|
+
// `specials.name`, so counting `icon` made `config.icon` look known and the
|
|
80
|
+
// star rendered (TTG gap #24).
|
|
81
|
+
const named = el.controls.filter((c) => !ICON_CONTROLS.includes(c) && !FIELD_SKIN_BY_CONTROL[c]);
|
|
82
|
+
add('config', named);
|
|
83
|
+
add('specials', named);
|
|
80
84
|
for (const v of [...Object.values(ELEMENT_VALUES[type] ?? {}), ...Object.values(ELEMENT_VALUES['*'] ?? {})]) {
|
|
81
85
|
add(v.target, [v.writeKey]);
|
|
82
86
|
}
|
|
@@ -229,8 +233,10 @@ export function writeCheck(type, namespace, keys, opts = {}) {
|
|
|
229
233
|
'declared controls or any generated vocabulary. It is stored as written; if nothing reads ' +
|
|
230
234
|
'it, the write changes nothing on the page.', ks[other].has(k)
|
|
231
235
|
? `${type} reads ${other}.${k} — write it in namespace "${other}".`
|
|
232
|
-
:
|
|
233
|
-
|
|
236
|
+
: /icon/i.test(k) && ICON_KEYS[type]?.length
|
|
237
|
+
? `${type} keeps its glyph in ${ICON_KEYS[type].map((i) => `${i.ns}.${i.key}`).join(' / ')} — write the icon name there.`
|
|
238
|
+
: `Check the spelling against sb_traits_for "${type}"; a CSS property belongs in namespace ` +
|
|
239
|
+
'"style". Ignore this if the key is newer than this catalog.');
|
|
234
240
|
continue;
|
|
235
241
|
}
|
|
236
242
|
const icon = iconNote(type, namespace, k, v);
|
|
@@ -435,6 +441,34 @@ export function cascadeTail(node, written, id) {
|
|
|
435
441
|
}
|
|
436
442
|
return out;
|
|
437
443
|
}
|
|
444
|
+
/**
|
|
445
|
+
* `config.hidden` IS PER BAND AND NEVER CASCADES (render/css.go hiddenAt,
|
|
446
|
+
* editor trait/display.ts isHiddenAt): base hides the node at ≥1440px ONLY, and
|
|
447
|
+
* laptop / tablet / mobile each read their own slot alone. An agent hiding at
|
|
448
|
+
* base expects it gone everywhere, so say which bands still show it — once per
|
|
449
|
+
* process, since the fact is the same for every node. `node` is AS IT WILL BE.
|
|
450
|
+
*/
|
|
451
|
+
export function hiddenBand(node, id) {
|
|
452
|
+
if (node.config?.hidden !== true)
|
|
453
|
+
return [];
|
|
454
|
+
const shown = ['laptop', 'tablet', 'mobile'].filter((bp) => node.responsive?.[bp]?.config?.hidden !== true);
|
|
455
|
+
if (!shown.length)
|
|
456
|
+
return [];
|
|
457
|
+
return [
|
|
458
|
+
{
|
|
459
|
+
once: 'hidden-band',
|
|
460
|
+
note: {
|
|
461
|
+
code: 'hidden_band',
|
|
462
|
+
...(id ? { id } : {}),
|
|
463
|
+
key: 'config.hidden',
|
|
464
|
+
problem: 'config.hidden does not cascade: at base it hides the node at ≥1440px only; laptop (1025–1439), ' +
|
|
465
|
+
`tablet (768–1024) and mobile (≤767) each read their own slot, so ${shown.join(', ')} still show it.`,
|
|
466
|
+
fix: `To hide it at every width, also write hidden:true at breakpoint ${shown.map((b) => `"${b}"`).join(', ')} — ` +
|
|
467
|
+
'one sb_set with edits[] (sb_add: responsive.<bp>.config). To drop it from the page instead, sb_remove it.',
|
|
468
|
+
},
|
|
469
|
+
},
|
|
470
|
+
];
|
|
471
|
+
}
|
|
438
472
|
/** The same, for every node of a nested `sb_add` spec, as each will be born. */
|
|
439
473
|
export function specCheck(spec, idOf) {
|
|
440
474
|
const out = [];
|
|
@@ -445,6 +479,8 @@ export function specCheck(spec, idOf) {
|
|
|
445
479
|
const born = d?.specials ?? {};
|
|
446
480
|
if (s.config)
|
|
447
481
|
out.push(...writeCheck(s.type, 'config', s.config));
|
|
482
|
+
// Born as addSubtree stores it: a desktop-slot `hidden` lands at base.
|
|
483
|
+
out.push(...hiddenBand({ config: { hidden: s.responsive?.desktop?.config?.hidden ?? s.config?.hidden }, responsive: s.responsive }, id));
|
|
448
484
|
for (const slot of Object.values(s.responsive ?? {}))
|
|
449
485
|
if (slot.config)
|
|
450
486
|
out.push(...writeCheck(s.type, 'config', slot.config));
|
|
@@ -458,6 +494,28 @@ export function specCheck(spec, idOf) {
|
|
|
458
494
|
}
|
|
459
495
|
if (s.specials)
|
|
460
496
|
out.push(...writeCheck(s.type, 'specials', s.specials, { specials: { ...born, ...s.specials } }));
|
|
497
|
+
// The element's OWN seed flipping the axis the caller wrote at base, at a
|
|
498
|
+
// width the caller left unsaid: flex-block seeds `mobile.flexDirection:
|
|
499
|
+
// column` (the editor drops it the same way), so a row written at base
|
|
500
|
+
// stacks at 390 (TTG gap #26). The axis only — a seeded mobile gap is spacing.
|
|
501
|
+
for (const [bp, slot] of Object.entries((d?.responsive ?? {}))) {
|
|
502
|
+
for (const [k, v] of Object.entries(slot?.style ?? {})) {
|
|
503
|
+
if (k !== 'flexDirection' || !s.style || !(k in s.style) || s.style[k] === v)
|
|
504
|
+
continue;
|
|
505
|
+
if ((s.responsive?.[bp]?.style ?? {})[k] !== undefined)
|
|
506
|
+
continue;
|
|
507
|
+
out.push({
|
|
508
|
+
once: `seed-override:${s.type}.${bp}.${k}`,
|
|
509
|
+
note: {
|
|
510
|
+
code: 'seed_override',
|
|
511
|
+
...(id ? { id } : {}),
|
|
512
|
+
key: `style.${k}`,
|
|
513
|
+
problem: `${s.type} seeds responsive.${bp}.style.${k} = ${JSON.stringify(v)} (as the editor does), so the ${JSON.stringify(s.style[k])} written at base does not hold at ${bp}.`,
|
|
514
|
+
fix: `If it should, say it: responsive: { ${bp}: { style: { ${k}: ${JSON.stringify(s.style[k])} } } } in the spec, or sb_set breakpoint "${bp}".`,
|
|
515
|
+
},
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
}
|
|
461
519
|
for (const c of s.children ?? [])
|
|
462
520
|
walk(c);
|
|
463
521
|
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { CallToolRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* ONE OPEN DOCUMENT, ONE CALL AT A TIME, IN ARRIVAL ORDER.
|
|
4
|
+
*
|
|
5
|
+
* `PageSession` holds a single open document, and `sb_page_open` replaces it
|
|
6
|
+
* only once its source read answers. A client batching `sb_page_open X` with
|
|
7
|
+
* `sb_outline` / `sb_node_read` ran the read in that gap and answered from the
|
|
8
|
+
* PREVIOUS page — measured on TTG (gap #30): the checkout form's outline after
|
|
9
|
+
* opening /tao-tai-khoan. Two parallel writes race the same way on one save.
|
|
10
|
+
*
|
|
11
|
+
* The slot is taken where the REQUEST arrives, not in the tool callback: the
|
|
12
|
+
* SDK validates arguments asynchronously first, and a schema that takes more
|
|
13
|
+
* ticks (sb_page_open's) let a later sb_outline enter its callback earlier.
|
|
14
|
+
* Tools in `free` touch no open document (the catalog, the API sheet, the media
|
|
15
|
+
* library) and stay parallel. Call before the first `registerTool`, which is
|
|
16
|
+
* when McpServer installs its `tools/call` handler.
|
|
17
|
+
*
|
|
18
|
+
* ponytail: one FIFO for every session tool, so a slow sb_look delays the next
|
|
19
|
+
* sb_set; a per-document lock only matters if two documents are ever open.
|
|
20
|
+
*/
|
|
21
|
+
export function serializeToolCalls(server, free) {
|
|
22
|
+
let tail = Promise.resolve();
|
|
23
|
+
const inner = server.server;
|
|
24
|
+
const set = inner.setRequestHandler.bind(inner);
|
|
25
|
+
inner.setRequestHandler = ((schema, handler) => {
|
|
26
|
+
if (schema !== CallToolRequestSchema)
|
|
27
|
+
return set(schema, handler);
|
|
28
|
+
return set(schema, ((req, extra) => {
|
|
29
|
+
if (free(req.params.name))
|
|
30
|
+
return handler(req, extra);
|
|
31
|
+
const run = tail.then(() => handler(req, extra));
|
|
32
|
+
tail = run.catch(() => undefined);
|
|
33
|
+
return run;
|
|
34
|
+
}));
|
|
35
|
+
});
|
|
36
|
+
}
|
package/dist/server.js
CHANGED
|
@@ -18,6 +18,7 @@ import { registerImportTools } from './tools/importpage.js';
|
|
|
18
18
|
import { registerUndoTools } from './tools/undo.js';
|
|
19
19
|
import { registerThemeTools } from './tools/theme.js';
|
|
20
20
|
import { registerTranslateTools } from './tools/translate.js';
|
|
21
|
+
import { serializeToolCalls } from './mcp/serial.js';
|
|
21
22
|
/**
|
|
22
23
|
* Sent on every handshake, so it is short, and says nothing a tool description
|
|
23
24
|
* already says. Counts come from the generated source records, never literals.
|
|
@@ -48,6 +49,25 @@ export function pkgVersion() {
|
|
|
48
49
|
return '0.0.0';
|
|
49
50
|
}
|
|
50
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Tools that never touch the open document, so they need not wait their turn.
|
|
54
|
+
* Anything not named here is serialized — the safe default for a new tool.
|
|
55
|
+
*/
|
|
56
|
+
const SESSION_FREE = new Set([
|
|
57
|
+
'sb_connect',
|
|
58
|
+
'sb_site_list',
|
|
59
|
+
'sb_api_find',
|
|
60
|
+
'sb_api_call',
|
|
61
|
+
'sb_page_update',
|
|
62
|
+
'sb_code',
|
|
63
|
+
'sb_theme',
|
|
64
|
+
'sb_catalog_search',
|
|
65
|
+
'sb_traits_for',
|
|
66
|
+
'sb_templates',
|
|
67
|
+
'sb_page_list',
|
|
68
|
+
'sb_media_list',
|
|
69
|
+
'sb_media_upload',
|
|
70
|
+
]);
|
|
51
71
|
export function buildContext() {
|
|
52
72
|
const base = process.env.SB_API ?? 'http://localhost:8080';
|
|
53
73
|
return {
|
|
@@ -70,6 +90,9 @@ export function createServer(ctx = buildContext()) {
|
|
|
70
90
|
server.server.oninitialized = () => {
|
|
71
91
|
setAgentClient(server.server.getClientVersion(), pkgVersion());
|
|
72
92
|
};
|
|
93
|
+
// Every tool that can reach the open document runs in arrival order — see
|
|
94
|
+
// mcp/serial.ts. Before the first registerTool, which installs tools/call.
|
|
95
|
+
serializeToolCalls(server, (name) => SESSION_FREE.has(name));
|
|
73
96
|
registerSessionTools(server, ctx);
|
|
74
97
|
registerApiTools(server, ctx);
|
|
75
98
|
const pageSession = registerPageTools(server, ctx);
|
package/dist/tools/page.js
CHANGED
|
@@ -22,7 +22,7 @@ import { request, redact, watchPageWrites, onPageSourceWrite, onGlobalWrite, onF
|
|
|
22
22
|
import { SPEC_GLOBAL_ID, SPEC_GLOBAL_REV, SPEC_OVERLAY_ID, SPEC_OVERLAY_REV, subtreeIds } from '../core/tree.js';
|
|
23
23
|
import { siteToken } from './credentialpick.js';
|
|
24
24
|
import { validateForSave } from '../domains/site/validate.js';
|
|
25
|
-
import { cascadeTail, formDocChecks, sayChecks, specCheck, writeCheck } from '../domains/site/writecheck.js';
|
|
25
|
+
import { cascadeTail, formDocChecks, hiddenBand, sayChecks, specCheck, writeCheck } from '../domains/site/writecheck.js';
|
|
26
26
|
import { reviewDesign, REVIEW_NOTICE } from '../domains/site/review.js';
|
|
27
27
|
import { exampleCopy } from '../domains/site/examplecopy.js';
|
|
28
28
|
import { compactFindings } from '../domains/site/findings.js';
|
|
@@ -1713,7 +1713,17 @@ export function registerPageTools(server, ctx) {
|
|
|
1713
1713
|
applyPatches(probe, patches.filter((p) => p.path[0] === 'nodes' && p.path[1] === e.id));
|
|
1714
1714
|
return cascadeTail(probe.nodes[e.id], { [bp]: e.keys }, e.id);
|
|
1715
1715
|
});
|
|
1716
|
-
|
|
1716
|
+
// config.hidden at base/desktop hides ≥1440px only — judged on the node
|
|
1717
|
+
// AS IT WILL BE, so a batch that hides every band says nothing.
|
|
1718
|
+
const hidden = batch.flatMap((e) => {
|
|
1719
|
+
const bp = e.breakpoint ?? 'desktop';
|
|
1720
|
+
if (e.namespace !== 'config' || e.state || e.keys.hidden !== true || (!e.base && bp !== 'desktop') || !d.doc.nodes[e.id])
|
|
1721
|
+
return [];
|
|
1722
|
+
const probe = { nodes: { [e.id]: JSON.parse(JSON.stringify(d.doc.nodes[e.id])) } };
|
|
1723
|
+
applyPatches(probe, patches.filter((p) => p.path[0] === 'nodes' && p.path[1] === e.id));
|
|
1724
|
+
return hiddenBand(probe.nodes[e.id], e.id);
|
|
1725
|
+
});
|
|
1726
|
+
const found = sayChecks([...checked, ...tail, ...hidden, ...session.formChecks(patches)], say);
|
|
1717
1727
|
const checks = found.length ? { checks: found } : {};
|
|
1718
1728
|
// A FIELD-SKIN KNOB ON THE WRONG NODE renders nowhere. The FORM dresses
|
|
1719
1729
|
// every field it holds with the input vocabulary; a payment card, choice
|
|
@@ -2591,6 +2601,16 @@ export function registerPageTools(server, ctx) {
|
|
|
2591
2601
|
: {}),
|
|
2592
2602
|
});
|
|
2593
2603
|
});
|
|
2604
|
+
// DRAFTS A CASCADE HID, per site, for this process (TTG gap #27). A cascade
|
|
2605
|
+
// re-renders a live page from the version it LAST published (the platform's
|
|
2606
|
+
// publishSourceFor, by design) and writes a fresh published row — and the
|
|
2607
|
+
// page list's `publishedAt` is denormalised from that row, so the draft that
|
|
2608
|
+
// did NOT go live now reads older than "published". Remembered here until the
|
|
2609
|
+
// page is published by name.
|
|
2610
|
+
// ponytail: in-process; a new process sees only timestamps again. Exact would
|
|
2611
|
+
// compare each page's updatedAt with its live version's createdAt
|
|
2612
|
+
// (GET …/versions, isLive) — a heavy listing per page.
|
|
2613
|
+
const cascadeMasked = new Map();
|
|
2594
2614
|
server.registerTool('sb_publish', {
|
|
2595
2615
|
description: 'Compile the draft into the live page, and report which revision went live (id, ' +
|
|
2596
2616
|
'publishedAt, fromVersionId). PUBLISH CASCADES: a page sharing a global section with ' +
|
|
@@ -2641,6 +2661,10 @@ export function registerPageTools(server, ctx) {
|
|
|
2641
2661
|
});
|
|
2642
2662
|
const state = (p) => driftOf(p.updatedAt, p.publishedAt).state;
|
|
2643
2663
|
drafts = others.filter((p) => state(p) === 'draft_ahead').map(row);
|
|
2664
|
+
for (const m of cascadeMasked.get(site_id)?.values() ?? []) {
|
|
2665
|
+
if (m.pageId !== page_id && !drafts.some((d) => d.pageId === m.pageId))
|
|
2666
|
+
drafts.push(m);
|
|
2667
|
+
}
|
|
2644
2668
|
const unborn = others.filter((p) => state(p) === 'never_published').map(row);
|
|
2645
2669
|
fresh = unborn.filter((r) => !heldFromFirstPublish(r.type));
|
|
2646
2670
|
held = unborn.filter((r) => heldFromFirstPublish(r.type));
|
|
@@ -2655,7 +2679,7 @@ export function registerPageTools(server, ctx) {
|
|
|
2655
2679
|
...(left.length
|
|
2656
2680
|
? {
|
|
2657
2681
|
unpublished_drafts: left,
|
|
2658
|
-
drafts_note: 'Draft saved after its last publish (updatedAt past publishedAt — no platform flag says so
|
|
2682
|
+
drafts_note: 'Draft not live: saved after its last publish (updatedAt past publishedAt), or held back by a cascade this process saw — no platform flag says so. publish_drafts:true publishes them too.',
|
|
2659
2683
|
}
|
|
2660
2684
|
: {}),
|
|
2661
2685
|
...(unborn.length
|
|
@@ -2710,6 +2734,18 @@ export function registerPageTools(server, ctx) {
|
|
|
2710
2734
|
// `continue`). sb_page_create followed by sb_publish does exactly that:
|
|
2711
2735
|
// the call succeeds, the page never flips to published, and the URL 404s.
|
|
2712
2736
|
const landed = published.some((p) => p.pageId === page_id);
|
|
2737
|
+
// A page in the answer that was NOT asked for is a CASCADE: rendered from
|
|
2738
|
+
// its last published version, so its draft is exactly as unpublished as
|
|
2739
|
+
// before. It stays under unpublished_drafts, and is remembered.
|
|
2740
|
+
const asked = new Set(body.pageIds);
|
|
2741
|
+
const cascaded = published.map((p) => String(p.pageId)).filter((id) => !asked.has(id));
|
|
2742
|
+
const masked = cascadeMasked.get(site_id) ?? new Map();
|
|
2743
|
+
cascadeMasked.set(site_id, masked);
|
|
2744
|
+
for (const id of asked)
|
|
2745
|
+
masked.delete(id);
|
|
2746
|
+
for (const d of drafts)
|
|
2747
|
+
if (cascaded.includes(d.pageId))
|
|
2748
|
+
masked.set(d.pageId, d);
|
|
2713
2749
|
// A 200 PROVES A ROW WAS STORED, NOT THAT A VISITOR IS BEING SERVED IT.
|
|
2714
2750
|
// The storefront answers `cache-control: public, max-age=60`, so the two
|
|
2715
2751
|
// legitimately differ for up to a minute — long enough for a caller to
|
|
@@ -2740,9 +2776,16 @@ export function registerPageTools(server, ctx) {
|
|
|
2740
2776
|
};
|
|
2741
2777
|
}
|
|
2742
2778
|
}
|
|
2779
|
+
const cascadeNote = cascaded.length
|
|
2780
|
+
? ctx.notices.once('publish-cascade', 'cascaded: pages republished because they share a changed global section or overlay. The ' +
|
|
2781
|
+
'platform renders each from the version it LAST published (fromVersionId unchanged), never ' +
|
|
2782
|
+
'from its draft — and bumps its publishedAt, so a draft still waiting is listed under ' +
|
|
2783
|
+
'unpublished_drafts here, not by the timestamps.')
|
|
2784
|
+
: undefined;
|
|
2743
2785
|
return text({
|
|
2744
2786
|
published,
|
|
2745
|
-
...
|
|
2787
|
+
...(cascaded.length ? { cascaded, ...(cascadeNote ? { cascade_note: cascadeNote } : {}) } : {}),
|
|
2788
|
+
...draftNote(drafts.filter((d) => !asked.has(d.pageId)), fresh.filter((d) => !published.some((p) => p.pageId === d.pageId))),
|
|
2746
2789
|
...(live ? { live } : {}),
|
|
2747
2790
|
...(published.length !== (res.total ?? published.length) ? { total: res.total } : {}),
|
|
2748
2791
|
...(landed
|
package/dist/vision/measure.js
CHANGED
|
@@ -92,6 +92,12 @@ export function measureShot(shot, skip = new Set(), doc) {
|
|
|
92
92
|
continue;
|
|
93
93
|
if (b.position && b.position !== 'static' && b.position !== 'relative')
|
|
94
94
|
continue;
|
|
95
|
+
// And a box INSIDE such a layer floats with it: a static button in a fixed
|
|
96
|
+
// CTA meets whatever content is under the viewport corner on every page.
|
|
97
|
+
// Two boxes in the same layer are still compared — a header's own nav
|
|
98
|
+
// colliding is a real defect, pinned or not.
|
|
99
|
+
if ((a.layer ?? '') !== (b.layer ?? ''))
|
|
100
|
+
continue;
|
|
95
101
|
const pairKey = `${a.id}|${b.id}`;
|
|
96
102
|
if (seen.has(pairKey))
|
|
97
103
|
continue;
|
package/dist/vision/shoot.js
CHANGED
|
@@ -332,27 +332,41 @@ async function shootOne(page, url, width, format, opts) {
|
|
|
332
332
|
// node. `type` is read off the leading `wb-` class, which is the only type
|
|
333
333
|
// signal the render emits; the caller already knows the real types from
|
|
334
334
|
// sb_outline, so this is a convenience, not a contract.
|
|
335
|
-
const boxes = (await page.evaluate(() =>
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
const
|
|
339
|
-
|
|
340
|
-
.
|
|
341
|
-
.
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
335
|
+
const boxes = (await page.evaluate(() => {
|
|
336
|
+
// No named inner function: a transpiler's `__name` wrapper would not exist
|
|
337
|
+
// in the page (the vision skill's evaluate trap).
|
|
338
|
+
const anon = new Map();
|
|
339
|
+
return [...document.querySelectorAll('[id]')]
|
|
340
|
+
.filter((el) => el.id === 'ROOT' || /^[a-z]{2}_[0-9a-f]{8}$/.test(el.id))
|
|
341
|
+
.map((el) => {
|
|
342
|
+
const r = el.getBoundingClientRect();
|
|
343
|
+
const wb = String(el.className || '')
|
|
344
|
+
.split(/\s+/)
|
|
345
|
+
.find((c) => c.startsWith('wb-'));
|
|
346
|
+
const cs = getComputedStyle(el);
|
|
347
|
+
const own = (el.textContent ?? '').trim();
|
|
348
|
+
let layer;
|
|
349
|
+
for (let e = el; e && layer === undefined; e = e.parentElement) {
|
|
350
|
+
if (!['absolute', 'fixed', 'sticky'].includes(getComputedStyle(e).position))
|
|
351
|
+
continue;
|
|
352
|
+
if (!e.id && !anon.has(e))
|
|
353
|
+
anon.set(e, `@${anon.size}`);
|
|
354
|
+
layer = e.id || anon.get(e);
|
|
355
|
+
}
|
|
356
|
+
return {
|
|
357
|
+
id: el.id,
|
|
358
|
+
type: wb ? wb.slice(3) : '',
|
|
359
|
+
x: Math.round(r.x),
|
|
360
|
+
y: Math.round(r.y),
|
|
361
|
+
w: Math.round(r.width),
|
|
362
|
+
h: Math.round(r.height),
|
|
363
|
+
fontPx: Math.round(parseFloat(cs.fontSize) || 0),
|
|
364
|
+
hasText: own.length > 0,
|
|
365
|
+
position: cs.position,
|
|
366
|
+
...(layer ? { layer } : {}),
|
|
367
|
+
};
|
|
368
|
+
});
|
|
369
|
+
}));
|
|
356
370
|
// ZOOM. A designer does not judge a card by looking at the whole page, and
|
|
357
371
|
// a full-page shot of a long storefront makes one card a few pixels tall.
|
|
358
372
|
// The clip comes from the SAME measurement pass the boxes do, so what is
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sbuilder-mcp",
|
|
3
|
-
"version": "0.98.
|
|
3
|
+
"version": "0.98.6",
|
|
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",
|