Filters: the panel is a bar (status segment, always visible) plus a body that lives as a layer under it - collapsed by default, expands on hover/focus/tap and never moves the case grid; the reset control appears only when a facet is limited; width capped at 720px (measured 45px slack against 477px before). Facet research report is included. Links: project links in the mini card and in the project window are icon-only buttons with a uniform slot (16px card / 18px window) and the accessible name in aria-label; studio contacts (mail, VK, RuStore) live outside the cards. Team and page: real photos from the public TITANS team page go to the member window while the card keeps the mascot; the portfolio gains the First Step Radio card and genre values, the process block became an individual-approach section, plus a cookie bar and a removable ticker. Design folders under design/ keep reports, measurements, scripts and the .pen; probe and before/after screenshot dumps, editor backups and caches are removed. Background-variant and palette previews stay until the client picks one.
195 lines
10 KiB
Python
195 lines
10 KiB
Python
"""Проверка макетов волны `t_15835792` (2026-10-15): рамка у ссылок-иконок.
|
||
|
||
Читает ОБА .pen (канон и снимок `design/`), разрешает наследование свойств компонента
|
||
`ProjectLink` для каждого инстанса и проверяет правило отгруженного состояния:
|
||
|
||
* база компонента `ProjectLink` — без рамки (как `.btn--mark{border:0}` в `src/index.html`);
|
||
* штриховые глифы темы (глобус `PL_site`, камера) — без рамки, слот знака 24×24, слот кнопки 48×48;
|
||
* знаки площадок (`PL_rustore`, `PL_vk`) и состояния `default/hover/disabled` — без рамки;
|
||
* рамку и заливку несёт ТОЛЬКО зелёный CTA (`PL_primary`: 2 px `$brand` + заливка `$brand`),
|
||
а контур фокуса (`PL_focus`) — 2 px `$brand-deep`;
|
||
* узла с камерой (`video`) в макетах нет — сверяется фактом (в прод-контенте все поля
|
||
`video:` пусты, поэтому камера не рисуется и на странице).
|
||
|
||
Дополнительно сверяет изменённые узлы канона с дампом живого редактора Pencil
|
||
(`pen/mcp-dump-2026-10-15.json`, снят MCP `execute`/`Get` после правки).
|
||
|
||
Запуск: py design/glyph-frame-2026-10-15/verify-pen-frame.py
|
||
Exit 0 = все проверки прошли.
|
||
"""
|
||
import json
|
||
import sys
|
||
from pathlib import Path
|
||
|
||
ROOT = Path(__file__).resolve().parents[2]
|
||
FILES = {
|
||
"канон": ROOT / "Harvey_Monster_Team_Page.pen",
|
||
"снимок": ROOT / "design" / "Harvey_Monster_Team_Page.pen",
|
||
}
|
||
DUMP = Path(__file__).resolve().parent / "pen" / "mcp-dump-2026-10-15.json"
|
||
|
||
FAILS = []
|
||
OUT = []
|
||
|
||
|
||
def w(s=""):
|
||
OUT.append(s)
|
||
print(s)
|
||
|
||
|
||
def flat(doc):
|
||
out = {}
|
||
|
||
def walk(n):
|
||
out[n.get("id")] = n
|
||
for c in n.get("children") or []:
|
||
walk(c)
|
||
|
||
for c in doc["children"]:
|
||
walk(c)
|
||
return out
|
||
|
||
|
||
def eff(by, ref):
|
||
"""Рамка инстанса: свои свойства поверх свойств мастера (для самого мастера — свои же)."""
|
||
node = by[ref]
|
||
master = by[node["ref"]] if node.get("ref") else node
|
||
width = node.get("strokeWidth", master.get("strokeWidth"))
|
||
colour = node.get("stroke", master.get("stroke"))
|
||
return {"w": width or 0, "c": colour, "fill": node.get("fill", master.get("fill")),
|
||
"own_w": "strokeWidth" in node, "own_c": "stroke" in node}
|
||
|
||
|
||
EXPECT = {
|
||
"EByJw": ("мастер ProjectLink", 0, None),
|
||
"xv726": ("PL_site (штриховой глиф темы)", 0, None),
|
||
"PLyfk": ("PL_rustore (знак площадки)", 0, None),
|
||
"O5Vf0": ("PL_vk (знак площадки)", 0, None),
|
||
"ESknH": ("PL_default", 0, None),
|
||
"lkOok": ("PL_hover", 0, None),
|
||
"HZiiG": ("PL_disabled (в проде состояния нет)", 0, None),
|
||
"C1esB": ("PLC_rustore (компакт)", 0, None),
|
||
"zqgsI": ("PLC_vk (компакт)", 0, None),
|
||
"z4XWl": ("PL_primary (зелёный CTA)", 2, "$brand"),
|
||
"JIqc4": ("PL_focus (контур фокуса)", 2, "$brand-deep"),
|
||
}
|
||
KNOWN = {"tn69z": "PL_active — 3 px #00562C: унаследованное состояние волны t_a33fce2f (в проде у :active рамки нет) — остаточный риск R-b21"}
|
||
OPTIONAL = {"HZiiG": "PL_disabled — состояния у ссылки в проде нет; в снимке узла нет, и это принято (в каноне он пока есть — R-b21)"}
|
||
FILE_EXCEPT = {("снимок", "z4XWl"): (0, None)} # в снимке у CTA рамки нет; вид тот же (рамка цвета заливки невидима)
|
||
SKIP_AGREE = {"z4XWl": "PL_primary: канон несёт 2 px `$brand` (рамка цвета заливки — невидима), снимок — 0; вид в обоих файлах одинаков (в проде рамка CTA — 2 px `transparent`), поэтому расхождение не считается"}
|
||
|
||
|
||
def main():
|
||
w("# Проверка .pen: рамка у ссылок-иконок (волна `t_15835792`, 2026-10-15)")
|
||
w()
|
||
docs, tables = {}, {}
|
||
for label, path in FILES.items():
|
||
doc = json.loads(path.read_bytes().decode("utf-8"))
|
||
by = flat(doc)
|
||
docs[label] = (path, doc, by)
|
||
w("- %s `%s`: %d Б, узлов %d" % (label, path.name, path.stat().st_size, len(by)))
|
||
w()
|
||
|
||
for label, (path, doc, by) in docs.items():
|
||
w("## %s" % label)
|
||
w()
|
||
w("| Узел | Что | Рамка | Цвет | Ожидалось | Итог |")
|
||
w("|---|---|---|---|---|---|")
|
||
rows = {}
|
||
for ref, (name, exp_w, exp_c) in EXPECT.items():
|
||
if ref not in by:
|
||
if ref in OPTIONAL:
|
||
w("| `%s` | %s | — | — | — | узла нет (принято) |" % (ref, name))
|
||
else:
|
||
FAILS.append("%s: нет узла %s (%s)" % (label, ref, name))
|
||
continue
|
||
e = eff(by, ref)
|
||
exp_w, exp_c = FILE_EXCEPT.get((label, ref), (exp_w, exp_c))
|
||
ok = e["w"] == exp_w and (exp_c is None or e["c"] == exp_c)
|
||
rows[ref] = e
|
||
if not ok:
|
||
FAILS.append("%s/%s: рамка %s %s, ожидалось %s %s" % (label, ref, e["w"], e["c"], exp_w, exp_c))
|
||
w("| `%s` | %s | %s | `%s` | %s px%s | %s |" % (
|
||
ref, name, ("%.0f px" % e["w"]) if e["w"] else "нет", e["c"] or "—", exp_w,
|
||
"" if exp_c is None else " `%s`" % exp_c, "✓" if ok else "**✗**"))
|
||
tables[label] = rows
|
||
for ref, note in KNOWN.items():
|
||
if ref in by:
|
||
e = eff(by, ref)
|
||
w("| `%s` | %s | %s | `%s` | — | записано |" % (ref, note.split(" — ")[0], e["w"], e["c"] or "—"))
|
||
w()
|
||
|
||
master = by["EByJw"]
|
||
for key, want in (("width", 48), ("height", 48)):
|
||
if master.get(key) != want:
|
||
FAILS.append("%s: мастер ProjectLink %s = %s, ожидалось %s" % (label, key, master.get(key), want))
|
||
glyph = by.get("z4oNC") or {}
|
||
if glyph.get("width") != 24 or glyph.get("height") != 24:
|
||
FAILS.append("%s: слот знака %s×%s, ожидался 24×24" % (label, glyph.get("width"), glyph.get("height")))
|
||
w("- мастер: %s×%s, знак `z4oNC` %s×%s (`%s`), текст подписи выключен: %s" % (
|
||
master.get("width"), master.get("height"), glyph.get("width"), glyph.get("height"), glyph.get("icon"),
|
||
(by.get("B9oDO") or {}).get("enabled")))
|
||
icons = [n.get("icon") for n in by.values() if n.get("type") == "icon"]
|
||
cameras = [i for i in icons if str(i).lower() in ("video", "camera", "camcorder")]
|
||
globes = [i for i in icons if i == "globe"]
|
||
w("- иконочных узлов %d; из них камера: %s; глобус: %d (%s)" % (
|
||
len(icons), ("нет — узла с камерой в макете не существует" if not cameras else "**" + str(cameras) + "**"),
|
||
len(globes), ", ".join(sorted(n.get("id") for n in by.values() if n.get("type") == "icon" and n.get("icon") == "globe"))))
|
||
if cameras:
|
||
FAILS.append("%s: появился иконочный узел камеры" % label)
|
||
if len(globes) != 1:
|
||
FAILS.append("%s: узлов глобуса %d, ожидался один (мастер ProjectLink)" % (label, len(globes)))
|
||
w()
|
||
|
||
w("## Канон против живого редактора Pencil (дамп MCP)")
|
||
w()
|
||
dump = json.loads(DUMP.read_bytes().decode("utf-8"))
|
||
by = docs["канон"][2]
|
||
mism = 0
|
||
for key in ("master", "primary", "focus", "site", "cap"):
|
||
live = dump[key]
|
||
disk = {k: v for k, v in by[live["id"]].items() if k != "children"}
|
||
for prop, value in live.items():
|
||
if prop in ("children",):
|
||
continue
|
||
if disk.get(prop) != value:
|
||
mism += 1
|
||
FAILS.append("канон/%s.%s: диск %r ≠ живой редактор %r" % (live["id"], prop, disk.get(prop), value))
|
||
for item in dump["family"]:
|
||
disk = {k: v for k, v in by[item["id"]].items() if k != "children"}
|
||
for prop, key in (("s", "strokeWidth"), ("c", "stroke")):
|
||
if prop in item and disk.get(key) != item[prop]:
|
||
mism += 1
|
||
FAILS.append("канон/%s.%s: диск %r ≠ живой редактор %r" % (item["id"], key, disk.get(key), item[prop]))
|
||
w("- сверено узлов: %d (мастер, primary, focus, site, подпись) + %d в семье; расхождений: %d" % (
|
||
5, len(dump["family"]), mism))
|
||
w()
|
||
|
||
w("## Канон и снимок согласованы")
|
||
w()
|
||
for ref in EXPECT:
|
||
if ref in SKIP_AGREE:
|
||
continue
|
||
a, b = tables["канон"].get(ref), tables["снимок"].get(ref)
|
||
if a and b and (a["w"] != b["w"]):
|
||
FAILS.append("канон/снимок разошлись у %s: %s против %s" % (ref, a["w"], b["w"]))
|
||
w("- `%s`: **%s px против %s px**" % (ref, a["w"], b["w"]))
|
||
w("- числа рамок в семье совпадают: %s" % ("да" if not any("разошлись" in f for f in FAILS) else "**нет**"))
|
||
for ref, why in SKIP_AGREE.items():
|
||
w("- `%s` вне сверки — %s" % (ref, why))
|
||
for ref, why in OPTIONAL.items():
|
||
w("- `%s` — %s" % (ref, why))
|
||
w()
|
||
|
||
w("## Итог")
|
||
w()
|
||
w("- Провалено проверок: **%d**" % len(FAILS))
|
||
for f in FAILS:
|
||
w(" - FAIL: %s" % f)
|
||
(Path(__file__).resolve().parent / "verify-pen-frame.md").write_text("\n".join(OUT) + "\n", encoding="utf-8")
|
||
return 1 if FAILS else 0
|
||
|
||
|
||
if __name__ == "__main__":
|
||
sys.exit(main())
|