Files
FastD e352335822 Filter bar with hover layer, icon-only project links, design reports
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.
2026-10-15 05:50:52 +03:00

158 lines
7.3 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""Персист правки §10.28 в .pen: компонент ProjectLink = квадрат 48×48 (знак 24×24) без подписи,
официальный знак площадки — синяя подложка #0077FF (переменная `brand-mark`) + белый символ.
Зачем: Pencil MCP НЕ сохраняет .pen на диск — правки живут только в открытом редакторе.
Скрипт пишет те же значения в канон и в снимок design/, ничего больше не трогая.
Порядок и значения совпадают с тем, что уже сделано в редакторе через MCP (id подложки p40tIo).
Запуск: py design/brand-marks-2026-10-14/patch-pen-marks.py
Проверка: py design/brand-marks-2026-10-14/verify-pen-marks.py
"""
import json
import shutil
from pathlib import Path
ROOT = Path("G:/Project/Haevey_Monster_Team_Page")
FILES = [ROOT / "Harvey_Monster_Team_Page.pen", ROOT / "design" / "Harvey_Monster_Team_Page.pen"]
STAMP = "bak-brandmarks-20261014"
MASTER = "EByJw"
PLATE = "p40tIo" # id подложки, созданной в живом редакторе через MCP
MARK, LABEL = "z4oNC", "B9oDO"
PLATE_FILL = "$brand-mark"
BLUE = "#0077FF"
MASTER_PATCH = {"width": 48, "height": 48, "padding": [0, 0], "gap": 0,
"justifyContent": "center", "alignItems": "center"}
MARK_PATCH = {"width": 24, "height": 24}
# Знак площадки: синяя подложка + белый символ; сайт/видео — штриховой знак в цвете контура.
WIN_INSTANCES = {"PLyfk": "store", "O5Vf0": "gamepad-2"}
CARD_INSTANCES = {"C1esB": "store", "zqgsI": "gamepad-2"}
CARD_PATCH = {"width": 36, "height": 36, "padding": [0, 0], "gap": 0,
"justifyContent": "center", "alignItems": "center"}
CAPTIONS = {
"APqQ5": "ССЫЛКА ПРОЕКТА — ЗНАК БЕЗ ТЕКСТА: 48×48, знак 24×24. RuStore и VK — ОФИЦИАЛЬНЫЙ знак "
"площадки (синий квадрат #0077FF + белый символ; геометрия — src/js/main.js, "
"в .pen символ — подстановка lucide, D15). Сайт — глобус, видео — камера (штриховые)",
"X6kox": "ССЫЛКА ПРОЕКТА: default → hover → active → focus → disabled (знак без подписи, квадрат 48×48)",
"c9IKO7": "ССЫЛКА ПРОЕКТА — КОМПАКТ (мини-карточка: квадрат 36×36, знак 20×20; знак площадки тот же — "
"официальный, L=18 ед.)",
}
def find(node, nid):
if isinstance(node, dict):
if node.get("id") == nid:
return node
for c in node.get("children") or []:
r = find(c, nid)
if r is not None:
return r
return None
def walk(node, fn):
if isinstance(node, dict):
fn(node)
for c in node.get("children") or []:
walk(c, fn)
def count_nodes(doc):
n = [0]
walk(doc, lambda x: n.__setitem__(0, n[0] + 1))
return n[0]
def patch_file(path):
doc = json.loads(path.read_text(encoding="utf-8"))
before = json.dumps(doc, ensure_ascii=False, sort_keys=True)
nodes_before = count_nodes(doc)
changed = []
def setp(node, props, tag):
for k, v in props.items():
if node.get(k) != v:
node[k] = v
changed.append(tag + "." + k)
# 1. переменная фирменного синего (VK и RuStore совпадают)
doc.setdefault("variables", {})["brand-mark"] = {"type": "color", "value": BLUE}
changed.append("variables.brand-mark")
# 2. мастер: квадрат 48×48 без подписи, знак 24×24, подложка под знаком
master = find(doc, MASTER)
if master is None:
raise SystemExit("не найден компонент " + MASTER)
setp(master, MASTER_PATCH, MASTER)
children = master.setdefault("children", [])
plate = find(master, PLATE)
if plate is None:
plate = {"type": "rectangle", "id": PLATE, "name": "MarkPlate",
"width": 24, "height": 24, "cornerRadius": 7, "fill": PLATE_FILL, "enabled": False}
children.insert(0, plate)
changed.append("insert " + PLATE + " MarkPlate")
setp(plate, {"width": 24, "height": 24, "cornerRadius": 7, "fill": PLATE_FILL,
"enabled": False, "name": "MarkPlate"}, PLATE)
if children[0].get("id") != PLATE: # подложка — ПОД знаком
children.remove(plate)
children.insert(0, plate)
changed.append("reorder " + PLATE)
setp(find(master, MARK), MARK_PATCH, MARK)
setp(find(master, LABEL), {"enabled": False}, LABEL)
# 3. инстансы: знак площадки = синяя подложка + белый символ
for iid, icon in WIN_INSTANCES.items():
inst = find(doc, iid)
if inst is None:
raise SystemExit("не найден инстанс " + iid)
d = inst.setdefault("descendants", {})
d[MARK] = {"icon": icon, "fill": "#FFFFFF", "width": 24, "height": 24}
d[PLATE] = {"enabled": True, "width": 24, "height": 24, "cornerRadius": 7, "fill": PLATE_FILL}
changed.append(iid + ".descendants")
for iid, icon in CARD_INSTANCES.items():
inst = find(doc, iid)
if inst is None:
raise SystemExit("не найден инстанс " + iid)
setp(inst, CARD_PATCH, iid)
d = inst.setdefault("descendants", {})
d[MARK] = {"icon": icon, "fill": "#FFFFFF", "width": 20, "height": 20}
d[PLATE] = {"enabled": True, "width": 20, "height": 20, "cornerRadius": 6, "fill": PLATE_FILL}
changed.append(iid + ".descendants")
# 4. подписи строк матрицы состояний
for cid, text in CAPTIONS.items():
node = find(doc, cid)
if node is None:
raise SystemExit("не найдена подпись " + cid)
setp(node, {"content": text}, cid)
after = json.dumps(doc, ensure_ascii=False, sort_keys=True)
nodes_after = count_nodes(doc)
if before == after:
return {"file": path.name, "changed": [], "nodes": nodes_after, "bytes": path.stat().st_size, "skipped": True}
bak = path.with_suffix(".pen." + STAMP)
if not bak.exists():
shutil.copy2(path, bak)
path.write_text(json.dumps(doc, ensure_ascii=False, indent=1) + "\n", encoding="utf-8")
return {"file": path.name, "changed": changed, "nodes": nodes_after,
"nodes_before": nodes_before, "bytes": path.stat().st_size, "skipped": False}
if __name__ == "__main__":
for f in FILES:
r = patch_file(f)
print("===", r["file"])
if r["skipped"]:
print(" уже в целевом состоянии, пропуск")
continue
print(" изменено свойств:", len(r["changed"]))
print(" узлов:", r.get("nodes_before"), "→", r["nodes"], "(+", r["nodes"] - r.get("nodes_before", r["nodes"]), ")")
print(" размер:", r["bytes"], "Б; бэкап:", f.name + "." + STAMP)
for c in r["changed"]:
print(" ·", c)