From 63a762d0025a9af17ed50c3dea287891913e6160 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Wed, 9 Sep 2026 15:15:09 +0200 Subject: [PATCH] ui: split raw Figma API values vs calculated; show code var names + formulas --- src/ui.tsx | 64 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 44 insertions(+), 20 deletions(-) diff --git a/src/ui.tsx b/src/ui.tsx index bd53acb..f68276b 100644 --- a/src/ui.tsx +++ b/src/ui.tsx @@ -17,6 +17,30 @@ import { useState, useEffect } from 'preact/hooks' const MIN_WINDOW_SIZE = { width: 320, height: 200 } const MAX_WINDOW_SIZE = { width: 800, height: 800 } +// Одна строка отладочного вывода: имя переменной из кода (как в main.ts), +// опционально — формула расчёта, и само значение (моноширинное, по правому краю). +function Field (props: { name: string; formula?: string; value: string | number }) { + return ( +
+ {props.name} + {props.value} + {props.formula != null && ( + {props.formula} + )} +
+ ) +} + +// Секция-карточка: заголовок + список Field. +function Section (props: { title: string; children: preact.ComponentChildren }) { + return ( +
+ {props.title} +
{props.children}
+
+ ) +} + function Plugin () { const [currentWindowSize, setCurrentWindowSize] = useState(MIN_WINDOW_SIZE) const [windowInfo, setWindowInfo] = useState<{ @@ -135,26 +159,26 @@ function Plugin () { AI assistant (MVP) — bootstrap {windowInfo != null && ( -
- - Окно плагина - -
- x{windowInfo.x} - y{windowInfo.y} - w{windowInfo.width} - h{windowInfo.height} -
- - Canvas / viewport - -
- zoom{windowInfo.zoom} - viewport{windowInfo.viewport.x},{windowInfo.viewport.y} · {windowInfo.viewport.width}×{windowInfo.viewport.height} - gaps L/R/T/B{windowInfo.gapL} / {windowInfo.gapR} / {windowInfo.gapT} / {windowInfo.gapB} - center{windowInfo.center.x},{windowInfo.center.y} -
-
+ + {/* RAW — значения, которые реально возвращает Figma API (без преобразований) */} +
+ + + + + + +
+ {/* Расчётные — посчитаны в main.ts из вышеперечисленных raw-значений */} +
+ + + + + + +
+
)}