end to end app store screenshot creation using AI
TypeScript agentic-aiappleappstoreautomateclaudecursordesigngenerateiosios-appmarketingscreenshotskillsskills-shswiftswiftuiui
Add per-slide typography scale controls to the screenshot editor
dlg95807d65f0695d
diff --git a/skills/app-store-screenshots/template/src/components/editor/inspector.tsx b/skills/app-store-screenshots/template/src/components/editor/inspector.tsxindex 3f1161a..e53e934 100644--- a/skills/app-store-screenshots/template/src/components/editor/inspector.tsx+++ b/skills/app-store-screenshots/template/src/components/editor/inspector.tsx@@ -43,6 +43,12 @@ import {toTextElementId,} from "@/lib/elements";import { pickText, writeLocalized } from "@/lib/locale";+import {+ cleanTypography,+ FONT_SCALE_MAX,+ FONT_SCALE_MIN,+ slideFontScales,+} from "@/lib/typography";import type {BuiltInElementId,Device,@@ -51,6 +57,7 @@ import type {Orientation,Slide,SlideLayout,+ SlideTypography,TextElement,} from "@/lib/types";import { ScreenshotPicker } from "./screenshot-picker";@@ -174,6 +181,8 @@ export function Inspector({/></div>+ <TypographySection slide={slide} isFeatureGraphic={isFeatureGraphic} onChange={onChange} />+{!isFeatureGraphic && !isNoDevice && (<div className="space-y-1.5"><Label className="text-xs">@@ -576,7 +585,22 @@ function TextElementPanel({</div><div className="grid grid-cols-[1fr_76px] gap-2"><div className="space-y-1">- <Label className="text-[11px] text-muted-foreground">Size</Label>+ <div className="flex items-center justify-between">+ <Label className="text-[11px] text-muted-foreground">Size</Label>+ <span className="text-[11px] tabular-nums text-muted-foreground">+ {Math.round(element.fontSize || 72)}px+ </span>+ </div>+ <input+ type="range"+ min={12}+ max={400}+ step={1}+ value={Math.round(element.fontSize || 72)}+ onChange={(event) => onTextPatch({ fontSize: Number(event.target.value) || 72 })}+ className="w-full"+ aria-label="Text size"+ /><Inputtype="number"min={12}@@ -649,6 +673,98 @@ function LayerButton({);}+function TypographySection({+ slide,+ isFeatureGraphic,+ onChange,+}: {+ slide: Slide;+ isFeatureGraphic: boolean;+ onChange: (patch: Partial<Slide>) => void;+}) {+ const scales = slideFontScales(slide);++ function patchTypography(patch: Partial<SlideTypography>) {+ onChange({+ typography: cleanTypography({ ...slide.typography, ...patch }),+ });+ }++ return (+ <div className="space-y-3 rounded-md border bg-muted/20 p-3">+ <div>+ <Label className="text-xs font-semibold">Typography</Label>+ <p className="text-[11px] text-muted-foreground">+ Relative to the layout default (100%). Applies to this screen only.+ </p>+ </div>+ {!isFeatureGraphic && (+ <FontScaleSlider+ label="Label"+ value={scales.labelScale}+ onChange={(value) => patchTypography({ labelScale: value })}+ />+ )}+ <FontScaleSlider+ label={isFeatureGraphic ? "Tagline" : "Headline"}+ value={scales.headlineScale}+ onChange={(value) => patchTypography({ headlineScale: value })}+ />+ {isFeatureGraphic && (+ <FontScaleSlider+ label="App name"+ value={scales.appNameScale}+ onChange={(value) => patchTypography({ appNameScale: value })}+ />+ )}+ </div>+ );+}++function FontScaleSlider({+ label,+ value,+ onChange,+}: {+ label: string;+ value: number;+ onChange: (value: number) => void;+}) {+ const pct = Math.round(value * 100);+ const minPct = Math.round(FONT_SCALE_MIN * 100);+ const maxPct = Math.round(FONT_SCALE_MAX * 100);++ return (+ <div className="space-y-1">+ <div className="flex items-center justify-between gap-2">+ <Label className="text-[11px] text-muted-foreground">{label}</Label>+ <div className="flex items-center gap-2">+ <span className="text-[11px] tabular-nums text-muted-foreground">{pct}%</span>+ {pct !== 100 ? (+ <button+ type="button"+ className="text-[10px] text-muted-foreground underline-offset-2 hover:underline"+ onClick={() => onChange(1)}+ >+ Reset+ </button>+ ) : null}+ </div>+ </div>+ <input+ type="range"+ min={minPct}+ max={maxPct}+ step={5}+ value={pct}+ onChange={(event) => onChange(Number(event.target.value) / 100)}+ className="w-full"+ aria-label={`${label} font size`}+ />+ </div>+ );+}+function elementLabel(id: ElementId): string {if (isBuiltInElementId(id)) return ELEMENT_LABEL[id];return "Text";diff --git a/skills/app-store-screenshots/template/src/components/editor/slide-canvas.tsx b/skills/app-store-screenshots/template/src/components/editor/slide-canvas.tsxindex 2036a82..5c77b28 100644--- a/skills/app-store-screenshots/template/src/components/editor/slide-canvas.tsx+++ b/skills/app-store-screenshots/template/src/components/editor/slide-canvas.tsx@@ -32,6 +32,7 @@ import {import { toTextElementId } from "@/lib/elements";import { img } from "@/lib/image-cache";import { pickText, resolveScreenshot } from "@/lib/locale";+import { slideFontScales } from "@/lib/typography";import {AndroidPhone,AppleTV,@@ -251,6 +252,7 @@ function Caption({}) {const fg = inverted ? theme.fgAlt : theme.fg;const accent = inverted ? theme.accentAlt ?? theme.accent : theme.accent;+ const { labelScale, headlineScale } = slideFontScales(slide);// Scale typography off the *shorter* dimension so landscape layouts don't// produce headlines so tall they overlap the device frame.const unit = Math.min(cW, cH);@@ -263,10 +265,11 @@ function Caption({onFocus={onFocus}placeholder="LABEL"style={{- // Floor keeps the label legible on the 422×514 Apple Watch canvas.- fontSize: Math.max(unit * 0.028, 16),+ // Floor keeps the label legible on the 422×514 Apple Watch canvas;+ // the per-slide scale is applied on top of the floored base.+ fontSize: Math.max(unit * 0.028, 16) * labelScale,fontWeight: 600,- letterSpacing: Math.max(unit * 0.0015, 0.8),+ letterSpacing: Math.max(unit * 0.0015, 0.8) * labelScale,color: accent,textTransform: "uppercase",marginBottom: unit * 0.018,@@ -281,10 +284,10 @@ function Caption({onFocus={onFocus}placeholder="Headline goes here"style={{- fontSize: unit * 0.092,+ fontSize: unit * 0.092 * headlineScale,fontWeight: 700,lineHeight: 0.96,- letterSpacing: -unit * 0.001,+ letterSpacing: -unit * 0.001 * headlineScale,color: fg,}}/>@@ -839,6 +842,7 @@ function FeatureGraphicCanvas({editable?: boolean;edit?: EditHandlers;}) {+ const { headlineScale, appNameScale } = slideFontScales(slide);return (<divstyle={{@@ -880,7 +884,7 @@ function FeatureGraphicCanvas({justifyContent: "center",color: theme.fgAlt,fontWeight: 800,- fontSize: cW * 0.07,+ fontSize: cW * 0.07 * appNameScale,boxShadow: "0 4px 16px rgba(0,0,0,0.3)",}}>@@ -888,14 +892,14 @@ function FeatureGraphicCanvas({</div>)}<div>- <div style={{ fontSize: cW * 0.06, fontWeight: 800, lineHeight: 1.05 }}>{appName || "App"}</div>+ <div style={{ fontSize: cW * 0.06 * appNameScale, fontWeight: 800, lineHeight: 1.05 }}>{appName || "App"}</div><EditableTextvalue={pickText(slide.headline, locale)}editable={editable}multilineonChange={edit?.onHeadlineChange}style={{- fontSize: cW * 0.028,+ fontSize: cW * 0.028 * headlineScale,color: "rgba(255,255,255,0.85)",marginTop: cW * 0.012,lineHeight: 1.25,diff --git a/skills/app-store-screenshots/template/src/lib/storage.ts b/skills/app-store-screenshots/template/src/lib/storage.tsindex f305b19..4f0f128 100644--- a/skills/app-store-screenshots/template/src/lib/storage.ts+++ b/skills/app-store-screenshots/template/src/lib/storage.ts@@ -3,6 +3,7 @@ import { useCallback, useEffect, useRef, useState } from "react";import { PROJECT_SCHEMA_VERSION, STORAGE_KEY } from "./constants";import { DEFAULT_PROJECT } from "./defaults";import { coerceLocalized } from "./locale";+import { cleanTypography } from "./typography";import type { Device, ElementTransform, ProjectState, Slide, TextElement } from "./types";const HISTORY_LIMIT = 50;@@ -71,6 +72,7 @@ function migrateSlide(slide: Slide): Slide {...slide,label: coerceLocalized(slide.label as unknown),headline: coerceLocalized(slide.headline as unknown),+ typography: cleanTypography(slide.typography),...(transforms && Object.keys(transforms).length > 0 ? { transforms } : { transforms: undefined }),...(textElements && textElements.length > 0 ? { textElements } : { textElements: undefined }),};diff --git a/skills/app-store-screenshots/template/src/lib/types.ts b/skills/app-store-screenshots/template/src/lib/types.tsindex 3039251..78d6433 100644--- a/skills/app-store-screenshots/template/src/lib/types.ts+++ b/skills/app-store-screenshots/template/src/lib/types.ts@@ -58,6 +58,15 @@ export type TextElement = {align?: "left" | "center" | "right";};+export type SlideTypography = {+ /** Uppercase label above the headline (default 1). */+ labelScale?: number;+ /** Main headline, or feature-graphic tagline (default 1). */+ headlineScale?: number;+ /** Feature graphic app name only (default 1). */+ appNameScale?: number;+};+export type Slide = {id: string;layout: SlideLayout;@@ -66,6 +75,8 @@ export type Slide = {screenshot: string; // path under /screenshots/ — may contain {locale}screenshotSecondary?: string; // for two-devices layout — may contain {locale}inverted?: boolean; // dark background variant+ /** Optional relative font-size scales for built-in caption text. */+ typography?: SlideTypography;// Per-element overrides; when present, replaces layout default placement.transforms?: Partial<Record<BuiltInElementId, ElementTransform>>;textElements?: TextElement[];diff --git a/skills/app-store-screenshots/template/src/lib/typography.ts b/skills/app-store-screenshots/template/src/lib/typography.tsnew file mode 100644index 0000000..83e38bc--- /dev/null+++ b/skills/app-store-screenshots/template/src/lib/typography.ts@@ -0,0 +1,35 @@+import type { Slide, SlideTypography } from "./types";++/** Relative scale on layout default font sizes (1 = default). */+export const FONT_SCALE_MIN = 0.5;+export const FONT_SCALE_MAX = 2;+export const FONT_SCALE_DEFAULT = 1;++export function clampFontScale(value: number | undefined): number {+ if (typeof value !== "number" || !Number.isFinite(value)) return FONT_SCALE_DEFAULT;+ return Math.min(FONT_SCALE_MAX, Math.max(FONT_SCALE_MIN, value));+}++export function slideFontScales(slide: Slide) {+ return {+ labelScale: clampFontScale(slide.typography?.labelScale),+ headlineScale: clampFontScale(slide.typography?.headlineScale),+ appNameScale: clampFontScale(slide.typography?.appNameScale),+ };+}++/** Persist only non-default scales so JSON stays tidy. */+export function cleanTypography(raw: SlideTypography | undefined): SlideTypography | undefined {+ if (!raw) return undefined;+ const out: SlideTypography = {};+ if (raw.labelScale !== undefined && raw.labelScale !== FONT_SCALE_DEFAULT) {+ out.labelScale = clampFontScale(raw.labelScale);+ }+ if (raw.headlineScale !== undefined && raw.headlineScale !== FONT_SCALE_DEFAULT) {+ out.headlineScale = clampFontScale(raw.headlineScale);+ }+ if (raw.appNameScale !== undefined && raw.appNameScale !== FONT_SCALE_DEFAULT) {+ out.appNameScale = clampFontScale(raw.appNameScale);+ }+ return Object.keys(out).length > 0 ? out : undefined;+}