Skip to content

AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He

feat(confirm-ui): hint a canvas-appropriate body-size range

hugohe371a2afd14096
diff --git a/skills/ppt-master/scripts/confirm_ui/static/app.js b/skills/ppt-master/scripts/confirm_ui/static/app.js
index 6b8b39b3..5d257b4e 100644
--- a/skills/ppt-master/scripts/confirm_ui/static/app.js
+++ b/skills/ppt-master/scripts/confirm_ui/static/app.js
@@ -52,6 +52,7 @@
font_body: "Body",
font_body_size: "Body baseline size",
font_body_size_hint: "All type sizes derive from this body baseline.",
+ body_size_hint_canvas: "This canvas suggests ~{lo}–{hi}px (scales with canvas height).",
custom_typography: "Custom typography",
custom_typography_placeholder: "Type your font plan, e.g. Heading: Georgia + KaiTi; Body: Microsoft YaHei + Arial…",
role_background: "bg",
@@ -117,6 +118,7 @@
font_body: "正文",
font_body_size: "正文基准字号",
font_body_size_hint: "所有字号按这个正文基准推导。",
+ body_size_hint_canvas: "当前画布建议 ~{lo}–{hi}px(随画布高度缩放)。",
custom_typography: "自定义字体方案",
custom_typography_placeholder: "输入字体方案,如:标题用楷体;正文用微软雅黑…",
role_background: "背景",
@@ -472,7 +474,8 @@
function renderCanvas(host) {
var sec = section(1, "sec_canvas");
enumField(sec, CAT.canvas, recOrFirst("canvas", CAT.canvas),
- function () { return STATE.canvas; }, function (v) { STATE.canvas = v; }, { allowCustom: true });
+ function () { return STATE.canvas; },
+ function (v) { STATE.canvas = v; refreshBodySizeHint(); }, { allowCustom: true });
host.appendChild(sec);
}
@@ -523,6 +526,18 @@
// Replaced when the combined color+typography preview mounts; the color and
// typography sections call it after every change so the preview stays live.
var refreshStylePreview = function () {};
+ // Replaced when the typography section mounts; the canvas section calls it so
+ // the body-size hint tracks the chosen canvas height.
+ var refreshBodySizeHint = function () {};
+
+ // Canvas height (viewBox user units) parsed from a catalog `dim` like
+ // "1242×1660" or from a custom canvas string containing WxH; null if unknown.
+ function canvasHeight(canvasVal) {
+ var dim = null;
+ (CAT.canvas || []).forEach(function (o) { if (o.id === canvasVal) dim = o.dim; });
+ var m = String(dim || canvasVal || "").match(/(\d{2,5})\s*[×xX*]\s*(\d{2,5})/);
+ return m ? parseInt(m[2], 10) : null;
+ }
function renderColor(host) {
var cands = (REC.color && REC.color.candidates) || [];
@@ -722,7 +737,22 @@
refreshStylePreview();
});
sizeRow.appendChild(sizeInput);
- sizeRow.appendChild(el("div", "toggle-desc", t("font_body_size_hint")));
+ var sizeHint = el("div", "toggle-desc");
+ sizeRow.appendChild(sizeHint);
+ // Suggest a canvas-appropriate baseline (≈2.5–3.3% of canvas height) so
+ // a 16:9 default is not silently kept on a tall canvas. Hint only — the
+ // user's value is never overwritten; downstream §g re-derives if ignored.
+ refreshBodySizeHint = function () {
+ var h = canvasHeight(STATE.canvas);
+ var txt = t("font_body_size_hint");
+ if (h) {
+ txt += " " + t("body_size_hint_canvas")
+ .replace("{lo}", Math.round(h * 0.025))
+ .replace("{hi}", Math.round(h * 0.033));
+ }
+ sizeHint.textContent = txt;
+ };
+ refreshBodySizeHint();
sizeField.appendChild(sizeRow);
sec.appendChild(sizeField);
@@ -930,6 +960,7 @@
// re-render: color/typography auto-select would otherwise call it and
// write to now-detached nodes until renderStylePreview remounts it.
refreshStylePreview = function () {};
+ refreshBodySizeHint = function () {};
renderCanvas(host);
renderPages(host);
renderAudience(host);
diff --git a/skills/ppt-master/scripts/docs/confirm_ui.md b/skills/ppt-master/scripts/docs/confirm_ui.md
index 77c8528f..972096d4 100644
--- a/skills/ppt-master/scripts/docs/confirm_ui.md
+++ b/skills/ppt-master/scripts/docs/confirm_ui.md
@@ -106,7 +106,7 @@ Both files live under `<project_path>/confirm_ui/`.
- For a custom image plan, the page treats "may include AI" as true only when the recommendation includes `recommend.image_ai_path` or `image_strategy.candidates`; a custom plan without those signals is handled as non-AI and omits AI controls / fields.
- **Color candidates carry the user-facing core `palette`**: `background`, `secondary_bg`, `primary`, `accent`, `secondary_accent`, and `body_text`. The page renders labelled swatches and offers per-role override inputs. Legacy `text` is accepted as an alias for `body_text`, but new files should write `body_text`. Strategist derives secondary text, borders, state colors, and visual-style neutral tiers later when writing `design_spec.md` / `spec_lock.md`; those are not user-facing confirmation choices.
- **Candidate display text may be bilingual**: color / typography candidates can provide `name_zh` / `name_en` and `note_zh` / `note_en`; the page falls back to legacy `name` / `note`.
-- **Typography candidates split CJK and Latin** for both `heading` and `body`; `css` is the fallback preview `font-family` stack. The page previews CJK sample text with `cjk + css` and Latin sample text with `latin + css`, so the two script choices are visible independently. Each candidate should also include `body_size` (the body baseline in px; common values are 18 and 24, but any reasonable integer is valid). The page exposes `body_size` as an editable numeric field, and also offers a custom typography text box so the user is not limited to the proposed candidates.
+- **Typography candidates split CJK and Latin** for both `heading` and `body`; `css` is the fallback preview `font-family` stack. The page previews CJK sample text with `cjk + css` and Latin sample text with `latin + css`, so the two script choices are visible independently. Each candidate should also include `body_size` (the body baseline in px; common values are 18 and 24, but any reasonable integer is valid). The page exposes `body_size` as an editable numeric field whose hint shows a canvas-appropriate range (≈2.5–3.3% of the confirmed canvas height, parsed from the canvas `dim`), updated when the canvas changes — a hint only, never an override, so a 16:9 default is not silently kept on a tall canvas (Xiaohongshu / Story / A4). It also offers a custom typography text box so the user is not limited to the proposed candidates.
- **Combined style preview** — a compact live "overall impression" strip sits just above the color section and is **sticky**: it pins under the topbar so it stays visible while the user scrolls through the color / icon / typography sections, keeping the picking controls and their combined effect on screen together. It applies the currently selected color palette **and** typography (heading sample in `primary` over `background`, body sample in `body_text`, an `accent` bar, a `secondary_bg` chip) and repaints on every color / HEX-override / font / `body_size` change. It does not replace the per-candidate swatches or font samples (those stay for picking); it is deliberately an abstract style chip, **not** a slide-layout preview — page layout preview remains the live-preview server's job (Step 6). No schema field; it derives entirely from the existing color + typography selections.
- **Generated image style candidates** live in `image_strategy.candidates` and are shown only when `image_usage` is `ai` or a custom image plan may include generated images. Each candidate records `rendering`, `palette`, and short `visual` / `color` / `mood` lines from Strategist h.5. The chosen value is written to `result.json.image_strategy`; it is omitted when generated images are not part of the plan.
- `recommend.generation_mode` and `refine_spec` mirror the two mandatory notes in SKILL.md Step 4. Confirmed `generation_mode: "split"` / `refine_spec: true` are explicit user choices, equivalent to opting in through chat.