Files
Harvey_Team_Page/design/pen-sync/validate-frame-b.py
T
FastD da710c4686 Accents, page edits and planet tuning; drop Pencil backups
Design: add the orange second accent from the UZURON palette and split the
colour roles (orange marks, green acts) in both themes; soften the dark green
and lift the dark cards toward the page background. Background options for the
next review are in design/background-options-2026-10-13/.

Page: replace the process block with an individual-approach section; drop the
budget form field; rename the contact field to a preferred channel; add a
submit confirmation dialog, studio links (mail, VK, RuStore), the First Step
Radio card, portfolio filters by platform, stack, genre and status, a cookie
bar and a removable hero ticker. Cards keep the mascot face; the member window
gains the real photo and the city.

Planet: fold the speed knobs into SPEED_TAU and SPEED_MIN with a hard stop
below the threshold; the pill is the only hover target and the summary card is
inert.

Repo: remove .pen backups from the index, ignore backups and Python artefacts,
drop generated pen-sync exports.
2026-10-13 22:08:24 +03:00

142 lines
9.2 KiB
Python
Raw 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.
"""Проверка .pen после синхронизации с продом (kanban t_ca027aab, обновлено t_1533ba29).
Структурные инварианты (не «на глаз»): переменные варианта B с обеими темами, состав и порядок
секций фрейма B = продакшн `src/index.html` 2026-10-13, счётчики карточек/плашек/полей, наличие
плашки планеты (§10.11) и тумблера темы, тёмный фрейм-близнец с осью темы `dark` и своими id,
а также ДВУХЦВЕТНАЯ СХЕМА: оранжевые носители (eyebrow, маркер планеты) и константа подписи.
Запуск: python design/pen-sync/validate-frame-b.py
Exit 0 — все проверки прошли; exit 1 — печатает провалы.
"""
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"]
FRAME_ID = "W0IwN"
EXPECTED_SECTIONS = ["Navbar", "Hero", "Hero Ticker", "Секция Работы", "Секция Подход",
"Секция Команда", "Секция Контакты", "Footer"]
# Палитра 2026-10-13: поверхности сближены, зелёная заливка приглушена, введён оранжевый акцент.
B_TOKEN_LIGHT = {"b-bg": "#F5EEE2", "b-card": "#FFFCF7", "b-field": "#FFFFFF",
"b-hairline": "#E6DCCE", "b-text-1": "#211E18",
"b-brand": "#00CC66", "b-accent": "#FFA400", "b-accent-deep": "#9C5800"}
B_TOKEN_DARK = {"b-bg": "#181109", "b-card": "#1F160D", "b-field": "#261C11",
"b-hairline": "#332719", "b-text-1": "#F8F2E7",
"b-brand": "#22B46B", "b-accent": "#D1911A", "b-accent-deep": "#E7A223"}
B_TOKEN_CONST = {"b-on-brand": "#04180C", "b-on-accent": "#2A1500", "b-on-deep": "#04180C"}
# Носители второго акцента в макете (spec.md §10.26.1): маркировка = оранжевый.
ACCENT_CARRIERS = {"Точка объекта": "$b-accent", "Платформы объекта": "$b-accent-deep",
"Eyebrow": "$b-accent-deep"}
problems = []
def check(cond, msg):
print((" ok " if cond else " FAIL ") + msg)
if not cond:
problems.append(msg)
def walk(node):
yield node
for c in node.get("children") or []:
yield from walk(c)
def ids(node, acc):
for n in walk(node):
if n.get("id") in acc:
problems.append("duplicate id " + str(n.get("id")))
acc.add(n.get("id"))
return acc
for path in FILES:
doc = json.load(open(path, encoding="utf-8"))
print(f"\n===== {path.name} ({path.parent.name}) · version {doc['version']} · token {doc['fileToken'][:8]}…")
frame = next((c for c in doc["children"] if c.get("id") == FRAME_ID), None)
check(frame is not None, "фрейм B Editorial Agency (W0IwN) на месте")
if frame is None:
continue
names = [c["name"] for c in frame["children"]]
check(names == EXPECTED_SECTIONS, f"состав секций = прод ({len(names)}): {names}")
check(frame.get("theme", {}).get("mode") == "light", "светлый фрейм помечен theme=mode:light")
for tok, want in B_TOKEN_LIGHT.items():
val = doc["variables"].get(tok, {}).get("value")
light = next((v["value"] for v in val if v.get("theme", {}).get("mode") == "light"), None) if isinstance(val, list) else val
dark = next((v["value"] for v in val if v.get("theme", {}).get("mode") == "dark"), None) if isinstance(val, list) else None
check(light == want, f"переменная {tok}: light {light} == {want}")
check(dark == B_TOKEN_DARK.get(tok), f"переменная {tok}: dark {dark} == {B_TOKEN_DARK.get(tok)}")
check(doc.get("themes", {}).get("mode") == ["light", "dark"], "ось темы mode: light+dark зарегистрирована")
for tok, want in B_TOKEN_CONST.items():
val = doc["variables"].get(tok, {}).get("value")
check(val == want, f"переменная {tok} (константа) = {val} == {want}")
nodes = list(walk(frame))
by_name = {}
for n in nodes:
by_name.setdefault(n.get("name"), []).append(n)
for name, want in ACCENT_CARRIERS.items():
found = by_name.get(name) or []
check(bool(found) and all(n.get("fill") == want for n in found),
f"носитель второго акцента «{name}»: fill == {want} (найдено {len(found)})")
def count(prefix):
return sum(1 for n in nodes if (n.get("name") or "").startswith(prefix))
hero = by_name.get("Hero", [{}])[0]
check(len([n for n in nodes if n.get("name") == "H1"]) == 1, "hero: H1 один")
check(len([n for n in nodes if n.get("name") == "Оффер"]) == 1, "hero: оффер один")
check(len([n for n in nodes if n.get("name") == "Ряд CTA"]) == 1, "hero: ряд CTA один")
check(len([n for n in nodes if n.get("name") == "Арт планеты"]) == 1, "hero: арт планеты один")
check(len([n for n in nodes if n.get("name") == "Плашка проекта"]) == 1, "hero: плашка планеты (§10.11) есть")
check(len([n for n in nodes if n.get("name") == "Полоса «Студия полного цикла»"]) == 1,
"hero: полоса «Студия полного цикла» есть")
check(count("Стат ") == 4, f"полоса: 4 стата (найдено {count('Стат ')})")
check(len([n for n in nodes if (n.get("name") or "").startswith("Плашка «")]) == 3,
"hero: 3 плашки «о нас»")
check(len([n for n in nodes if n.get("name") == "Тумблер темы"]) == 1, "navbar: тумблер темы есть")
check(len([n for n in nodes if (n.get("name") or "").startswith("Ссылка ")]) == 4, "navbar: 4 ссылки")
case_titles = {"World Wide Wheels", "Moba", "BattleCaps", "TITANS", "Буквика", "Ассоциации"}
cases = [n for n in nodes if n.get("name") in {"Карточка " + t for t in case_titles}]
check(len(cases) == 6, f"портфолио: 6 карточек (4 в работе + 2 выпущенные), найдено {len(cases)}")
check({n["name"].removeprefix("Карточка ") for n in cases} == case_titles,
"портфолио: состав карточек = 6 проектов прода")
check(len([n for n in nodes if n.get("name") == "Портфолио 2×2"]) == 1, "портфолио: сетка 2×2 есть")
check(len([n for n in nodes if n.get("name") == "Выпущенные игры"]) == 1, "портфолио: ряд выпущенных игр есть")
check(len([n for n in nodes if (n.get("name") or "").startswith("Участник ")]) == 5, "команда: 5 карточек")
check(len([n for n in nodes if (n.get("name") or "").startswith("Вопрос «")]) == 5, "контакты: 5 вопросов FAQ")
check(len([n for n in nodes if (n.get("name") or "").startswith("Поле ")]) == 3, "форма: 3 поля")
check(len([n for n in nodes if n.get("name") == "Карточка формы"]) == 1, "форма: карточка одна")
check(len([n for n in nodes if n.get("name") == "Footer"]) == 1, "футер есть")
check(len([n for n in nodes if n.get("name") == "Hero Ticker"]) == 1, "тикер есть")
check(len([n for n in nodes if n.get("type") == "text" and not n.get("fill")]) == 0,
"у всех текстов задан fill")
dark = next((c for c in doc["children"] if c.get("name") == "B Editorial Agency — Dark"), None)
check(dark is not None, "тёмный фрейм-близнец есть")
check(dark and isinstance(dark.get("id"), str) and dark["id"] != FRAME_ID,
f"id тёмного фрейма свой (есть {dark and dark.get('id')}; id светлого = {FRAME_ID})")
if dark:
check(dark.get("theme", {}).get("mode") == "dark", "тёмный фрейм помечен theme=mode:dark")
check([c["name"] for c in dark["children"]] == names, "тёмный фрейм повторяет состав секций")
light_ids = {n.get("id") for n in walk(frame)}
dark_ids = {n.get("id") for n in walk(dark)}
check(not (light_ids & dark_ids), "id светлого и тёмного фреймов не пересекаются")
check(len(list(walk(dark))) == len(nodes), f"одинаковый размер дерева ({len(nodes)} узлов)")
check(len([n for n in walk(dark) if n.get("name") == "Плашка проекта"]) == 1, "тёмный фрейм: плашка планеты есть")
acc = ids(frame, set())
ids(dark, acc) if dark else None
print(f" файл: узлов в фрейме B = {len(nodes)}, переменных = {len(doc['variables'])}, фреймов = {len(doc['children'])}")
print("\n" + ("ВСЕ ПРОВЕРКИ ПРОЙДЕНЫ" if not problems else f"ПРОВАЛОВ: {len(problems)}"))
for p in problems:
print(" -", p)
sys.exit(1 if problems else 0)