Files
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

578 lines
36 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.
"""Сборка фрейма B Editorial Agency в .pen под ОТГРУЖЕННЫЙ вариант B (kanban t_ca027aab).
Что делает:
1. Дописывает в канон переменные варианта B (`b-*`) со светлыми И тёмными значениями
(ось темы `mode`: light/dark) + переменные теней, чтобы тёмный фрейм был копией
светлого с `theme:{mode:'dark'}`, а не вторым набором заливок.
2. Пересобирает детей фрейма `W0IwN` (B Editorial Agency) под продакшн `src/index.html`
2026-10-12: navbar + тумблер темы, hero (H1 + оффер + CTA + планета + плашка §10.11 +
полоса «Студия полного цикла» + плашки «о нас»), тикер, «Наши проекты» (2 колонки:
4 в работе + 2 выпущенные), «Подход» (без конвейера — п.16 правок 2026-10-12),
«Команда» (5), «Контакты» (FAQ + форма), футер.
3. Создаёт фрейм-близнец `B Editorial Agency — Dark` (та же структура, `theme:{mode:'dark'}`).
4. Пишет канон (`Harvey_Monster_Team_Page.pen`) и снимок (`design/Harvey_Monster_Team_Page.pen`),
сохраняя `fileToken` каждого файла.
5. Выгружает в `design/pen-sync/out/` JS-сниппеты для повтора тех же правок в живом канвасе
(Pencil MCP `execute` пишет только в память приложения — на диск сериализует этот скрипт).
Запуск: python design/pen-sync/rebuild-frame-b.py
"""
import copy
import json
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
CANON = ROOT / "Harvey_Monster_Team_Page.pen"
SNAPSHOT = ROOT / "design" / "Harvey_Monster_Team_Page.pen"
OUT = Path(__file__).with_name("out")
FRAME_ID = "W0IwN"
DARK_X, DARK_Y = 768, 8153 # FindEmptySpace({1440x4400, direction:'bottom'}) от фрейма B
FRAME_X, FRAME_Y, FRAME_W = 768, 4017, 1440
DARK_ID = "dRoot1" # id тёмного фрейма-близнеца (в светлом дереве префикс "b", в тёмном — "d")
# ------------------------------------------------------------------ токены (вариант B, прод §10.1/§10.9.1)
SHADOWS = {
"b-shadow-card": ("#3A302326", "#00000073"),
"b-shadow-tab": ("#3A302333", "#00000080"),
"b-shadow-nav": ("#3A302338", "#0000008C"),
"b-shadow-rest": ("#3A302314", "#00000059"),
}
VARS = {
"b-bg": ("#F5EEE2", "#181109"),
"b-card": ("#FFFCF7", "#1F160D"),
"b-field": ("#FFFFFF", "#261C11"),
"b-hairline": ("#E6DCCE", "#332719"),
"b-line-strong": ("#847863", "#A28B6E"),
"b-text-1": ("#211E18", "#F8F2E7"),
"b-text-2": ("#5A5344", "#D5C4AC"),
"b-text-3": ("#6A6453", "#AA9679"),
# Зелёная семья — действие/подтверждение. В тёмной теме приглушена (−32 п.п. насыщенности
# заливки), как в проде (spec.md §10.26): на какао чистая насыщенность «кричит».
"b-brand": ("#00CC66", "#22B46B"),
"b-brand-strong": ("#00A857", "#1DA561"),
"b-brand-active": ("#00914C", "#1A9E60"),
"b-brand-deep": ("#007A3F", "#49CA85"),
"b-brand-ink": ("#006B37", "#49CA85"),
"b-brand-soft": ("#00CC6621", "#22B46B29"),
# Оранжевая семья — маркировка (eyebrow, маркер планеты, выбранный фильтр), палитра UZURON.
"b-accent": ("#FFA400", "#D1911A"),
"b-accent-deep": ("#9C5800", "#E7A223"),
"b-danger": ("#C5221F", "#FF7A6B"),
"b-nav": ("#F5EEE2F0", "#181109F0"),
"b-ghost-hover": ("#00CC6617", "#49CA851F"),
"b-disabled-bg": ("#B7C6BD", "#3A3228"),
"b-disabled-text": ("#5C6B62", "#8B8172"),
"b-backdrop": ("#18130C8C", "#0805029E"),
"b-media-1": ("#EAF4EE", "#1B2414"),
"b-media-2": ("#DFEBE4", "#20211A"),
"b-media-3": ("#EDEBE6", "#262017"),
"b-media-4": ("#F2E7D8", "#291C11"),
}
CONST_VARS = {
"b-on-brand": "#04180C", # подпись на зелёных заливках
"b-on-deep": "#04180C",
"b-on-accent": "#2A1500", # подпись на оранжевой заливке
"b-transparent": "#00CC6600",
}
# ------------------------------------------------------------------ контент (из прода: content/ → src/data/*.js, index.html)
H1 = "Игры и сервисы под ключ"
OFFER = "Разрабатываем игры, мобильные приложения и веб-сервисы."
CTA_PRIMARY = "Оставить заявку"
CTA_GHOST = "Наши работы"
TICKER = ["Игры", "Приложения", "Веб-сервисы", "От прототипа до релиза", "Своя команда"]
ABOUT_TITLE = "Студия полного цикла"
ABOUT_LEAD = ("Аутсорс-студия полного цикла: пять руководителей направлений ведут продукт от идеи "
"до релиза и поддержки — внутри студии, без передачи на сторону.")
STATS = [("5", "Направлений"), ("4", "Проекта"), ("12+", "Технологий"), ("100%", "Свой продакшн")]
ABOUT_ACC = ["Кто мы", "Стек и технологии", "Подход к работе"]
# плашка планеты (§10.11, объект 0 — грузовик, World Wide Wheels; §10.25 — параметры объекта)
TAG_NAME = "World Wide Wheels"
TAG_BADGE = "PC · VR"
TAG_SUMMARY = ("Симулятор дальнобойщика в метавселенной Узурон: грузоперевозки, поломки в дороге, "
"усталость, погода и разбитые трассы. Alpha-разработка (патчи 0.013–0.022, 2025), "
"VR-управление как опция.")
TAG_CHIPS = ["PC", "VR", "Unreal Engine 5"]
PLANET_HINT = "Наведите мышку или потяните планету"
SECTION_WORK = dict(eyebrow="Работы", h2="Наши проекты",
lead="Собственные разработки студии: четыре проекта в работе и две выпущенные игры. "
"Платформы и стек указаны; скриншоты и метрики добавим по мере готовности.")
SECTION_PROCESS = dict(eyebrow="Подход", h2="Индивидуальный подход под каждый проект",
lead="Готового конвейера у нас нет: состав команды, этапы, сроки и формат отчётности "
"зависят от задачи, платформы и бюджета. Маршрут работ собираем под конкретный "
"проект и согласуем до старта.")
SECTION_TEAM = dict(eyebrow="Команда", h2="Руководители направлений",
lead="Полный цикл внутри студии — от стратегии до релиза.")
SECTION_CONTACTS = dict(eyebrow="Контакты", h2="Обсудим ваш проект", lead=None)
PROJECTS = [
dict(title="World Wide Wheels", badge="Разработка", platforms=["PC", "VR"], stack=["Unreal Engine 5"], media=1),
dict(title="Moba", badge="Разработка", platforms=[], stack=[], media=2),
dict(title="BattleCaps", badge="Разработка", platforms=["PC"], stack=["Unreal Engine 5"], media=3),
dict(title="TITANS", badge="Разработка", platforms=["PC", "Android"], stack=["Unreal Engine 5"], media=4),
dict(title="Буквика", badge="Релиз", platforms=["Android", "VK"], stack=[], media=1),
dict(title="Ассоциации", badge="Релиз", platforms=["VK"], stack=[], media=2),
]
TEAM = [
(1, "Тимур", "Frontend · стратегия разработки"),
(2, "Мария", "Product Manager"),
(3, "Ден", "3D / Animation / Visualization"),
(4, "Коля", "Backend, network setup"),
(5, "Сергей", "Strategy, analytics, planning"),
]
FAQ = [
("Сколько стоит разработка игры?",
"Стоимость зависит от жанра, платформ и состава команды. Ориентир — от 300 000 ₽ за MVP. "
"Точную оценку даём после брифа."),
("Какие сроки разработки?", None),
("Работаете ли вы по NDA?", None),
("Какие форматы сотрудничества?", None),
("Что нужно для старта?", None),
]
FORM_FIELDS = [
("Имя", "Как к вам обращаться?"),
("Предпочтительное средство связи", "Telegram, email, телефон, VK — любой удобный канал"),
("Опишите задачу", "Коротко о проекте: что делаем, для кого, сроки"),
]
FOOTER_COPY = "© 2026 Harvey Monster Team"
FOOTER_SLOGAN = "От прототипа до релиза и поддержки"
PROJECT_NOTE = "Скриншоты и метрики добавим по мере готовности."
# ------------------------------------------------------------------ хелперы узлов
def font_head(**kw):
return dict(fontFamily="$font-heading", **kw)
def font_body(**kw):
return dict(fontFamily="$font-body", **kw)
def F(name, **kw):
return dict(type="frame", name=name, **kw)
def T(name, content, **kw):
return dict(type="text", name=name, content=content, **kw)
def CHIP(label, pad=None, **kw):
"""Чип факта (platforms/stack): .chip — карточная подложка, граница --line-strong,
подпись — ВНУТРИ (иначе фрейм пустой и схлопывается в 0×0)."""
return F("Чип " + label, layout="horizontal", alignItems="center", fill="$b-card",
stroke="$b-line-strong", strokeWidth=1, cornerRadius=999,
padding=pad or [8, 14], gap=6,
children=[T("Чип-подпись " + label, label, fill="$b-text-2", fontSize=12,
fontWeight="600", letterSpacing=1, **font_head())], **kw)
def BADGE(label):
return F("Бейдж " + label, layout="horizontal", alignItems="center", fill="$b-brand-soft",
cornerRadius=999, padding=[4, 12]), T("Бейдж-подпись " + label, label,
fill="$b-brand-deep", fontSize=11,
fontWeight="700", letterSpacing=1, **font_head())
def SHADOW(kind, blur):
return dict(type="shadow", shadowType="outer", color="$b-shadow-" + kind, blur=blur)
def STAT(value, label):
return F(f"Стат {value} {label}", layout="vertical", gap=3, alignItems="start", children=[
T("Значение", value, fill="$b-text-1", fontSize=22, fontWeight="800", lineHeight=1, **font_head()),
T("Подпись", label.upper(), fill="$b-text-3", fontSize=10, fontWeight="600",
letterSpacing=1, **font_head()),
])
def ACC_ITEM(title):
return F("Плашка «" + title + "»", width="fill_container", layout="horizontal",
justifyContent="space_between", alignItems="center", gap=16, fill="$b-card",
stroke="$b-hairline", strokeWidth=1, cornerRadius="$radius-md", padding=[16, 18],
effect=SHADOW("rest", 12), children=[
T("Триггер", title, fill="$b-text-1", fontSize=15, fontWeight="600", **font_head()),
T("Знак", "+", fill="$b-brand-deep", fontSize=20, fontWeight="700", **font_head()),
])
def SECTION_HEAD(eyebrow, h2, lead):
kids = [
T("Eyebrow", eyebrow.upper(), fill="$b-accent-deep", fontSize=13, fontWeight="700",
letterSpacing=2.5, **font_head()),
T("Заголовок", h2, fill="$b-text-1", fontSize=44, fontWeight="800", letterSpacing=1,
lineHeight=1.1, textGrowth="fixed-width", width="fill_container", **font_head()),
]
if lead:
kids.append(T("Лид", lead, fill="$b-text-2", fontSize=18, lineHeight=1.55,
textGrowth="fixed-width", width="fill_container", **font_body()))
return F("Section Head", layout="vertical", gap=14, width="fill_container", children=kids)
def CASE_CARD(p, n):
chips_row = lambda labels, fallback, empty: F(
f"Ряд {fallback}", layout="horizontal", gap=8, children=(
[CHIP(label) for label in labels] if labels
else [T("Нет данных", empty, fill="$b-text-3", fontSize=12.5, **font_body())]))
shots = F("Кадры", width=210, layout="vertical", gap=10, children=[
F("Кадр 1", width="fill_container", height=158, fill="$b-bg", cornerRadius="$radius-md",
layout="vertical", alignItems="center", justifyContent="center", padding=12, children=[
T("Плейсхолдер", f"{n} / 1", fill="$b-text-3", fontSize=12.5, **font_body())]),
T("Подпись кадра", "Скриншот — ждём от команды", fill="$b-text-3", fontSize=12.5, **font_body())])
facts = F("Факты", width="fill_container", layout="vertical", gap=14, children=[
chips_row(p["platforms"], "Платформы", "Платформы уточняются"),
chips_row(p["stack"], "Стек", "Стек уточняется"),
T("Заметка", PROJECT_NOTE, fill="$b-text-3", fontSize=12.5, lineHeight=1.45,
textGrowth="fixed-width", width="fill_container", **font_body()),
F("Действие", layout="horizontal", alignItems="center", justifyContent="center",
fill="$b-transparent", stroke="$b-brand-deep", strokeWidth=2, cornerRadius="$radius-md",
padding=[10, 18], children=[
T("Действие-подпись", "Подробнее", fill="$b-brand-deep", fontSize=12,
fontWeight="700", letterSpacing=1, **font_head())]),
])
badge = BADGE(p["badge"])
return F(f"Карточка {p['title']}", width="fill_container", layout="vertical", fill="$b-card",
cornerRadius="$radius-lg", clip=True, effect=SHADOW("card", 14), children=[
F("Шапка карточки", width="fill_container", layout="horizontal",
justifyContent="space_between", alignItems="center", gap=12,
padding=[20, 20, 0, 20], children=[
T("Название", p["title"], fill="$b-text-1", fontSize=20, fontWeight="700",
letterSpacing=1, **font_head()),
dict(badge[0], children=[badge[1]])]),
F("Тело карточки", width="fill_container", layout="horizontal", gap=20,
padding=20, alignItems="start", children=[shots, facts])])
def TEAM_CARD(photo_i, name, role):
return F(f"Участник {name}", width="fill_container", layout="vertical", alignItems="center",
gap=12, fill="$b-card", cornerRadius="$radius-lg", padding=[26, 16],
effect=SHADOW("card", 14), children=[
F("Аватар", width=96, height=96, cornerRadius=48,
fill=dict(type="image", enabled=True, url=f"Work_files/Char/{photo_i}.png", mode="cover")),
T("Имя", name.upper(), fill="$b-text-1", fontSize=16, fontWeight="700",
letterSpacing=1, **font_head()),
T("Роль", role, fill="$b-text-2", fontSize=13, lineHeight=1.45, textAlign="center",
textGrowth="fixed-width", width="fill_container", **font_body())])
def FAQ_ITEM(q, a, sign):
kids = [F("Строка вопроса", layout="horizontal", justifyContent="space_between",
alignItems="center", gap=16, width="fill_container", children=[
T("Вопрос", q, fill="$b-text-1", fontSize=15, fontWeight="600", **font_head()),
T("Знак", sign, fill="$b-brand-deep", fontSize=20, fontWeight="700", **font_head())])]
if a:
kids.append(T("Ответ", a, fill="$b-text-2", fontSize=15, lineHeight=1.55,
textGrowth="fixed-width", width="fill_container", **font_body()))
return F("Вопрос «" + q + "»", width="fill_container", layout="vertical", gap=10, fill="$b-card",
stroke="$b-hairline", strokeWidth=1, cornerRadius="$radius-md", padding=[16, 18],
effect=SHADOW("rest", 12), children=kids)
def FIELD(label, placeholder):
return F("Поле " + label, layout="vertical", gap=8, width="fill_container", children=[
T("Подпись поля", label.upper(), fill="$b-text-2", fontSize=13, fontWeight="700",
letterSpacing=1, **font_head()),
F("Инпут", width="fill_container", height=48, layout="horizontal", alignItems="center", fill="$b-field",
stroke="$b-line-strong", strokeWidth=2, cornerRadius="$radius-md", padding=[14, 16],
children=[T("Плейсхолдер", placeholder, fill="$b-text-3", fontSize=15, **font_body())])])
def BUTTON(label, primary=True, ghost=False, width=None):
props = dict(layout="horizontal", alignItems="center", justifyContent="center", gap=8,
cornerRadius="$radius-md", padding=[12, 26], name="Кнопка " + label)
if width:
props["width"] = width
if primary:
props.update(fill="$b-brand", effect=SHADOW("card", 10))
color = "$b-on-brand"
else:
props.update(fill="$b-transparent", stroke="$b-brand-deep", strokeWidth=2)
color = "$b-brand-deep"
return F(props.pop("name"), children=[T("Подпись кнопки", label.upper() if primary else label,
fill=color, fontSize=14, fontWeight="700",
letterSpacing=1, **font_head())], **props)
def SECTIONS():
"""Дети фрейма B: девять секций отгруженного варианта B (порядок = порядок DOM прода)."""
out = []
# --- Navbar (L5, sticky-слой; в статичном макете — верхний лист)
out.append(F("Navbar", width="fill_container", layout="horizontal", justifyContent="space_between",
alignItems="center", gap=24, padding=[18, 120], fill="$b-nav",
effect=SHADOW("nav", 20), children=[
T("Логотип", "HARVEY MONSTER TEAM", fill="$b-text-1", fontSize=20,
fontWeight="800", letterSpacing=2, **font_head()),
F("Ссылки", layout="horizontal", gap=6, alignItems="center", children=[
F("Ссылка " + l, layout="horizontal", alignItems="center", padding=[0, 14],
height=44, children=[
T("Надпись " + l, l.upper(), fill="$b-text-2", fontSize=13,
fontWeight="600", letterSpacing=1, **font_head())])
for l in ["Работы", "Подход", "Команда", "Контакты"]]),
F("Правая группа", layout="horizontal", gap=16, alignItems="center", children=[
F("Тумблер темы", width=44, height=44, layout="none", fill="$b-card",
stroke="$b-line-strong", strokeWidth=1, cornerRadius=999, children=[
dict(type="icon", name="Иконка темы", library="lucide", icon="moon",
x=12, y=12, width=20, height=20, fill="$b-text-2")]),
BUTTON(CTA_PRIMARY)]),
]))
# --- Hero: база (H1 + оффер + CTA + планета) + полоса «Студия полного цикла» + плашки «о нас»
tag_pill = F("Пилюля плашки", layout="horizontal", alignItems="center", gap=8, fill="$b-card",
stroke="$b-line-strong", strokeWidth=1, cornerRadius=999, padding=[7, 15],
effect=SHADOW("card", 12), children=[
F("Точка объекта", width=8, height=8, cornerRadius=999, fill="$b-accent"),
T("Имя объекта", TAG_NAME.upper(), fill="$b-text-1", fontSize=12.5,
fontWeight="700", letterSpacing=1, **font_head()),
T("Платформы объекта", TAG_BADGE, fill="$b-accent-deep", fontSize=10,
fontWeight="600", **font_head())])
tag_detail = F("Карточка плашки", width=300, layout="vertical", gap=7, fill="$b-card",
stroke="$b-hairline", strokeWidth=1, cornerRadius="$radius-md", padding=[10, 12],
effect=SHADOW("tab", 18), children=[
T("Сводка объекта", TAG_SUMMARY, fill="$b-text-2", fontSize=12.5, lineHeight=1.5,
textGrowth="fixed-width", width="fill_container", **font_body()),
F("Чипы объекта", layout="horizontal", gap=6, children=[
*[F("Чип плашки " + c, layout="horizontal", alignItems="center",
fill="$b-card", stroke="$b-line-strong", strokeWidth=1,
cornerRadius=999, padding=[3, 9], children=[
T("Чип-подпись плашки " + c, c.upper(), fill="$b-text-2",
fontSize=10, fontWeight="700", letterSpacing=1, **font_head())])
for c in TAG_CHIPS]])])
hero_visual = F("Hero Visual", width=562, height=560, layout="none", children=[
F("Арт планеты", x=21, y=0, width=520, height=404, cornerRadius="$radius-lg",
fill=dict(type="image", enabled=True, url="Work_files/Planet/planet_static.png", mode="contain")),
# y: 360 → 345 (2026-10-13, t_a1b262da): стек поднят, чтобы пилюля не налезала
# на «Подсказку планеты» (перекрытие 14 px в волнах до правки)
F("Плашка проекта", x=131, y=345, width=300, layout="vertical", gap=8, alignItems="center",
children=[tag_detail, tag_pill]),
# y: 492 → 530 (2026-10-13, t_a1b262da): низ композиции, зазор 8 px до пилюли (493–522).
# Правая граница 530 выбрана так, чтобы подсказка (h 30) осталась внутри 560 px Hero Visual.
F("Подсказка планеты", x=105, y=530, layout="horizontal", alignItems="center",
fill="$b-card", stroke="$b-line-strong", strokeWidth=1, cornerRadius=999, padding=[8, 14],
children=[T("Текст подсказки", PLANET_HINT, fill="$b-text-3", fontSize=12, **font_body())])])
hero_base = F("Hero Grid", width="fill_container", layout="horizontal", gap=48,
alignItems="center", children=[
F("Hero Copy", width="fill_container", layout="vertical", gap=18, alignItems="start",
children=[
T("H1", H1, fill="$b-text-1", fontSize=54, fontWeight="800", letterSpacing=1,
lineHeight=1.1, textGrowth="fixed-width", width="fill_container", **font_head()),
T("Оффер", OFFER, fill="$b-text-2", fontSize=18, lineHeight=1.5,
textGrowth="fixed-width", width="fill_container", **font_body()),
F("Ряд CTA", layout="horizontal", gap=12, children=[
BUTTON(CTA_PRIMARY), BUTTON(CTA_GHOST, primary=False)])]),
hero_visual])
hero_about = F("Полоса «Студия полного цикла»", width="fill_container", layout="horizontal",
gap=40, alignItems="center", fill="$b-card", cornerRadius="$radius-lg",
padding=[22, 26], effect=SHADOW("card", 14), children=[
F("Вступление полосы", width="fill_container", layout="vertical", gap=10,
alignItems="start", children=[
T("Титул полосы", ABOUT_TITLE, fill="$b-text-1", fontSize=24,
fontWeight="700", letterSpacing=1, **font_head()),
T("Лид полосы", ABOUT_LEAD, fill="$b-text-2", fontSize=14, lineHeight=1.55,
textGrowth="fixed-width", width="fill_container", **font_body())]),
F("Статы", layout="horizontal", gap=22, children=[
F("Статы колонка 1", layout="vertical", gap=12, children=[
STAT(*STATS[0]), STAT(*STATS[2])]),
F("Статы колонка 2", layout="vertical", gap=12, children=[
STAT(*STATS[1]), STAT(*STATS[3])])])])
about_acc = F("Плашки «о нас»", width="fill_container", layout="vertical", gap=12,
children=[ACC_ITEM(t) for t in ABOUT_ACC])
out.append(F("Hero", width="fill_container", layout="vertical", gap=26,
padding=[44, 120, 36, 120], children=[hero_base, hero_about, about_acc]))
# --- Тикер «о нас» (§10.10): «лист» между hero и работами
ticker_kids = []
for i, item in enumerate(TICKER):
if i:
ticker_kids.append(T("Разделитель " + str(i), "·", fill="$b-brand-deep", fontSize=12, **font_head()))
ticker_kids.append(T("Тикер " + item, item.upper(), fill="$b-text-2", fontSize=14,
fontWeight="600", letterSpacing=1, **font_head()))
out.append(F("Hero Ticker", width="fill_container", layout="horizontal", gap=22,
alignItems="center", fill="$b-card", stroke="$b-hairline", strokeWidth=1,
padding=[13, 120], clip=True, children=ticker_kids))
# --- Работы: 2 колонки (4 в работе) + ряд выпущенных (2)
def col(cases):
return F("Колонка кейсов", width="fill_container", layout="vertical", gap=24,
children=[CASE_CARD(p, i) for i, p in cases])
out.append(F("Секция Работы", width="fill_container", layout="vertical", gap=32, padding=[88, 120],
children=[SECTION_HEAD(**SECTION_WORK),
F("Портфолио 2×2", width="fill_container", layout="horizontal", gap=24,
children=[col([(1, PROJECTS[0]), (3, PROJECTS[2])]),
col([(2, PROJECTS[1]), (4, PROJECTS[3])])]),
F("Выпущенные игры", width="fill_container", layout="horizontal", gap=24,
children=[CASE_CARD(PROJECTS[4], 1), CASE_CARD(PROJECTS[5], 1)])]))
# --- Подход (п.16 правок 2026-10-12: фиксированного конвейера нет — только шапка и лид)
out.append(F("Секция Подход", width="fill_container", layout="vertical", gap=28, padding=[88, 120],
children=[SECTION_HEAD(**SECTION_PROCESS)]))
# --- Команда: 5 карточек в ряд
out.append(F("Секция Команда", width="fill_container", layout="vertical", gap=32, padding=[88, 120],
children=[SECTION_HEAD(**SECTION_TEAM),
F("Ряд команды", width="fill_container", layout="horizontal", gap=20,
children=[TEAM_CARD(*t) for t in TEAM])]))
# --- Контакты: FAQ + форма
form_card = F("Карточка формы", width="fill_container", layout="vertical", gap=16, fill="$b-card",
cornerRadius="$radius-lg", padding=24, effect=SHADOW("tab", 18), children=[
T("Титул формы", "Оставить заявку", fill="$b-text-1", fontSize=20,
fontWeight="700", letterSpacing=1, **font_head()),
T("Подзаголовок формы", "Опишите задачу — ответим в ближайшее время.",
fill="$b-text-2", fontSize=14, **font_body()),
*[FIELD(*f) for f in FORM_FIELDS],
BUTTON("Отправить заявку")])
out.append(F("Секция Контакты", width="fill_container", layout="vertical", gap=32, padding=[88, 120],
children=[SECTION_HEAD(**SECTION_CONTACTS),
F("Колонки контактов", width="fill_container", layout="horizontal", gap=40,
alignItems="start", children=[
F("FAQ", width="fill_container", layout="vertical", gap=12,
children=[FAQ_ITEM(q, a, "×" if a else "+") for q, a in FAQ]),
form_card])]))
# --- Футер (L1, нижний «лист»)
out.append(F("Footer", width="fill_container", layout="horizontal", justifyContent="space_between",
alignItems="center", gap=16, fill="$b-card", stroke="$b-hairline", strokeWidth=1,
padding=[28, 120], effect=SHADOW("rest", 12), children=[
T("Копирайт", FOOTER_COPY.upper(), fill="$b-text-1", fontSize=14,
fontWeight="700", letterSpacing=1, **font_head()),
T("Слоган", FOOTER_SLOGAN, fill="$b-text-2", fontSize=14, **font_body())]))
return out
# ------------------------------------------------------------------ компактная кодировка для живого канваса
KEYMAP = {
"type": "t", "name": "n", "content": "c", "fill": "f", "fontFamily": "ff", "fontSize": "fs",
"fontWeight": "fw", "letterSpacing": "ls", "lineHeight": "lh", "textGrowth": "tg", "textAlign": "ta",
"layout": "l", "gap": "g", "padding": "p", "alignItems": "ai", "justifyContent": "jc",
"width": "w", "height": "h", "cornerRadius": "r", "stroke": "s", "strokeWidth": "sw",
"effect": "e", "children": "ch", "theme": "th", "clip": "cl",
"shadowType": "st", "color": "co", "blur": "bl", "enabled": "en", "url": "u", "mode": "mo",
"icon": "ic", "library": "lb",
}
DECODER = ("K={" + ",".join(f"{s}:'{f}'" for f, s in KEYMAP.items()) + "};\n"
"dec=o=>Array.isArray(o)?o.map(dec):(o&&typeof o==='object'?"
"Object.fromEntries(Object.entries(o).map(([k,v])=>[K[k]||k,dec(v)])):o);")
def compact(node):
if isinstance(node, dict):
return {KEYMAP.get(k, k): compact(v) for k, v in node.items()}
if isinstance(node, list):
return [compact(v) for v in node]
return node
# ------------------------------------------------------------------ запись в .pen
def collect_ids(node, acc):
if isinstance(node, dict):
if isinstance(node.get("id"), str):
acc.add(node["id"])
for v in node.values():
collect_ids(v, acc)
elif isinstance(node, list):
for v in node:
collect_ids(v, acc)
return acc
class IdGen:
def __init__(self, used, prefix):
self.used, self.prefix, self.i = used, prefix, 0
def next(self):
while True:
self.i += 1
cand = f"{self.prefix}{self.i:04d}"
if cand not in self.used:
self.used.add(cand)
return cand
def assign_ids(node, gen):
if isinstance(node, dict):
node["id"] = gen.next()
for k, v in list(node.items()):
if k != "id":
assign_ids(v, gen)
elif isinstance(node, list):
for v in node:
assign_ids(v, gen)
return node
def var_block():
v = {}
for name, (light, dark) in VARS.items():
v[name] = {"type": "color", "value": [
{"value": light, "theme": {"mode": "light"}},
{"value": dark, "theme": {"mode": "dark"}}]}
for name, (light, dark) in SHADOWS.items():
v[name] = {"type": "color", "value": [
{"value": light, "theme": {"mode": "light"}},
{"value": dark, "theme": {"mode": "dark"}}]}
for name, hexv in CONST_VARS.items():
v[name] = {"type": "color", "value": hexv}
return v
def build():
tree = SECTIONS()
used = collect_ids(json.load(open(CANON, encoding="utf-8")), set())
light = assign_ids(copy.deepcopy(tree), IdGen(used, "b"))
dark = assign_ids(copy.deepcopy(tree), IdGen(used, "d"))
OUT.mkdir(exist_ok=True)
for path in (CANON, SNAPSHOT):
doc = json.load(open(path, encoding="utf-8"))
if not isinstance(doc.get("fileToken"), str):
sys.exit(f"no fileToken in {path}")
doc["variables"].update(var_block())
doc["themes"] = {"mode": ["light", "dark"]}
frame = next(c for c in doc["children"] if c.get("id") == FRAME_ID)
frame.pop("height", None) # fit_content: высота по контенту (фиксированная обрезала бы футер)
frame.update(name="B Editorial Agency", width=FRAME_W, layout="vertical",
clip=True, fill="$b-bg", x=FRAME_X, y=FRAME_Y, theme={"mode": "light"},
children=light)
for extra in [c for c in doc["children"] if c.get("name") == "B Editorial Agency — Dark"]:
doc["children"].remove(extra)
doc["children"].append(dict(type="frame", id=DARK_ID, name="B Editorial Agency — Dark", x=DARK_X, y=DARK_Y,
width=FRAME_W, layout="vertical", clip=True, fill="$b-bg",
theme={"mode": "dark"}, children=dark))
json.dump(doc, open(path, "w", encoding="utf-8"), ensure_ascii=False, separators=(",", ":"))
print("written:", path, "· vars:", len(doc["variables"]), "· frames:", len(doc["children"]))
# --- сниппеты для живого канваса (Pencil MCP execute): компактные ключи + декодер,
# чтобы повторить ту же структуру в приложении, не гоняя полный JSON.
live = OUT / "live"
live.mkdir(exist_ok=True)
for old in list(OUT.glob("*.js")):
old.unlink()
(live / "00-vars.js").write_text(
"SetVariables(" + json.dumps(var_block(), ensure_ascii=False) + ");\n", encoding="utf-8")
root = dict(type="frame", name="B Editorial Agency", width=FRAME_W, height=None, layout="vertical",
clip=True, fill="$b-bg", theme={"mode": "light"})
(live / "01-reset.js").write_text(
f"Replace('{FRAME_ID}', {json.dumps(root, ensure_ascii=False)});\n", encoding="utf-8")
for i, sec in enumerate(tree, start=2):
slug = "".join(ch if ch.isalnum() or ch == "-" else "-" for ch in sec["name"])[:24]
(live / f"{i:02d}-{slug}.js").write_text(
DECODER + "\nInsert('" + FRAME_ID + "', dec(" + json.dumps(compact(sec), ensure_ascii=False,
separators=(",", ":")) + "));\n",
encoding="utf-8")
(live / "99-dark-copy.js").write_text(
DECODER + "\ndId = Copy('" + FRAME_ID + "', document, {name:'B Editorial Agency — Dark', x:" +
str(DARK_X) + ", y:" + str(DARK_Y) + ", theme:{mode:'dark'}});\n"
"Update(dId, {fill:'$b-bg', clip:true});\n"
"Print('darkFrame', dId);\n", encoding="utf-8")
files = sorted(live.glob("*.js"))
print("live snippets:", len(files), "·", sum(f.stat().st_size for f in files), "bytes in", live)
if __name__ == "__main__":
build()