end to end app store screenshot creation using AI
TypeScript agentic-aiappleappstoreautomateclaudecursordesigngenerateiosios-appmarketingscreenshotskillsskills-shswiftswiftuiui
feat: add iPhone Duo and App Store creative targets with Apple bezel support
Parth Jadhavbc2ded8949a9
diff --git a/README.md b/README.mdindex 366001d..697dff9 100644--- a/README.md+++ b/README.md@@ -14,7 +14,8 @@ Example screenshots generated with this skill were accepted for [Bloom Coffee Sh- Keeps older projects safe with isolated-screen export mode until you opt into connected crops- Saves every deck to `app-store-screenshots.json`, so the project is git-trackable and resumable- Uploads picked screenshots into `public/screenshots/uploaded/<hash>.png`-- Supports iPhone, iPad, Apple TV, Apple Watch, CarPlay, Mac, Android phone, Android tablet, and Play Store feature graphic decks+- Supports iPhone, iPhone Duo (outer and inner displays, portrait and landscape), iPad, Apple TV, Apple Watch, CarPlay, Mac, Android phone, Android tablet, and Play Store feature graphic decks+- Makes App Store creative assets for the product page header and search results (one universal 5244 x 2950 asset, or separate header and search assets)- Exports exact PNG bundles for all required App Store, Mac App Store, and Google Play sizes- Supports locales, RTL-aware copy/layout guidance, reusable themes, and in-place project migration- Ships 18 named visual styles with deep specs and a headline copy library@@ -30,7 +31,7 @@ Example screenshots generated with this skill were accepted for [Bloom Coffee Sh- **Scene Playground** - restyle every screen at once: backdrops (gradient, solid, aurora, spotlight, grid, dots, ruled) that can flow across the whole strip, decorations, device shadow, glow and 3D tilt, and headline weight, case and alignment.- **Magnifier** - add a loupe to any screen that zooms into one detail of its screenshot; aim it on a thumbnail, set the zoom and shape, and drag it anywhere.- **Platform switcher** - iOS, Mac, and Android tabs keep every deck side by side while sharing the same editor workflow.-- **Device selector** - iPhone, iPad, Apple TV, Apple Watch, and CarPlay under iOS; Android phone, Android tablets, and the feature graphic under Android. The Mac tab is a single 16:10 Mac deck.+- **Device selector** - iPhone, iPad, iPhone Duo outer and inner, Apple TV, Apple Watch, CarPlay, and App Store creative assets under iOS; Android phone, Android tablets, and the feature graphic under Android. The Mac tab is a single 16:10 Mac deck.- **Autosave** - writes to disk through `/api/project`, mirrors to `localStorage`, and detects newer disk revisions before overwriting work from another tab or agent. Failed saves can be retried; unsaved edits trigger a warning before leaving.- **Export bundle** - downloads a zip organized by platform, device, resolution, and locale.@@ -120,6 +121,7 @@ project/├── public/│ ├── mockup.png│ ├── app-icon.png+│ ├── frames/ # your Apple bezels (gitignored, optional)│ └── screenshots/│ ├── apple/│ │ ├── iphone/{locale}/01.png@@ -188,9 +190,23 @@ Uploaded files are saved under `public/screenshots/uploaded/`, and the canonical| Apple Watch Series 4 | 368 x 448 || Apple Watch Series 3 | 312 x 390 || CarPlay (iPhone slot, landscape) | 2868 x 1320, 2778 x 1284, 2622 x 1206, 2436 x 1125 |+| iPhone Duo outer display | 1398 x 2034 portrait, 2034 x 1398 landscape |+| iPhone Duo inner display | 2007 x 2853 portrait, 2853 x 2007 landscape |App Store Connect has no CarPlay screenshot slot: CarPlay shots are uploaded into the iPhone slot, so the CarPlay deck exports landscape iPhone sizes with a head-unit frame.+Each iPhone Duo display and orientation has its own deck, so portrait and landscape keep independent compositions. Landscape decks make the device the hero under a one-line headline, and **Folded + open** pairs the closed phone with the opened one. [`iphone-duo.md`](skills/app-store-screenshots/iphone-duo.md) has the design research and the rules the skill follows: the displays, what real Duo captures look like, and what the first published sets do. Use real captures from each display: a capture from another display is letterboxed, never cropped or stretched, and the editor says so. Apple's product bezels ([Apple Design Resources](https://developer.apple.com/design/resources/)) are licensed for mock-ups but not for redistribution, so they aren't bundled. Download them yourself and copy the PNGs into the project's `public/frames/`. The editor measures their screen cutouts and draws iPhone, iPad, Apple Watch, Apple TV, Mac and iPhone Duo in Apple's own frames. Without them, iPhone Duo gets a drawn frame whose screen matches the capture exactly, and the other devices keep their built-in frames. See the [template README](skills/app-store-screenshots/template/README.md#iphone-duo) for the file names.++### App Store creative assets++| Asset | Resolution |+|-------|------------|+| Universal (header + search results) | 5244 x 2950 |+| Product page header | 3840 x 1646 |+| Search results (3:2) | 3840 x 2560, 1920 x 1280 |++Creative assets use the deck's theme, font, scene and editable copy, with layouts kept inside the art safe area measured from Apple's templates. The editor shows non-exporting safe-area guides and, for the universal asset, estimated header and search crops with live previews. Check final placement in App Store Connect's Preview tool.+### Mac App Store| Device | Resolution |@@ -210,7 +226,7 @@ Mac has its own **Mac** tab because App Store Connect lists macOS as a separate| 10" tablet landscape | 2560 x 1600 || Feature graphic | 1024 x 500 |-Screenshots are designed at the largest size for each device and scaled down for smaller exports. Every export waits until each screenshot has actually painted (Safari/WebKit decodes them asynchronously) and warns instead of silently writing a blank device. Android, iPad, Apple TV, Apple Watch, CarPlay and Mac frames are CSS-rendered, while iPhone uses the included `mockup.png` bezel.+Screenshots are designed at the largest size for each device and scaled down for smaller exports. Every export waits until each screenshot has actually painted (Safari/WebKit decodes them asynchronously) and warns instead of silently writing a blank device. Android, iPad, Apple TV, Apple Watch, CarPlay and Mac frames are CSS-rendered, iPhone uses the included `mockup.png` bezel, and iPhone Duo uses your own copy of Apple's bezels or a drawn stand-in. Every PNG is opaque 24-bit RGB with no alpha channel.## Project Statediff --git a/skills/app-store-screenshots/SKILL.md b/skills/app-store-screenshots/SKILL.mdindex 130db91..5735ae7 100644--- a/skills/app-store-screenshots/SKILL.md+++ b/skills/app-store-screenshots/SKILL.md@@ -26,6 +26,8 @@ Scaffold a pre-built Next.js + ShadCN editor that lets the user design and exporSupported devices out of the box:- **iPhone** (portrait) — Apple App Store- **iPad** (portrait) — Apple App Store+- **iPhone Duo** outer and inner displays, each in portrait and landscape (four decks) — Apple App Store; see "iPhone Duo" under Step 5+- **App Store creative assets**: universal 5244×2950, product page header 3840×1646, search results 3:2 — Apple App Store; see "App Store creative assets" under Step 5- **Apple TV** (landscape, 4K + HD) — Apple App Store- **Apple Watch** (portrait, every Ultra/Series size) — Apple App Store- **CarPlay** (landscape head unit) — uploaded into the **iPhone** slot; see "Apple TV, Apple Watch and CarPlay" under Step 5@@ -139,7 +141,7 @@ const path = require("path");const PROJECT_FILE = "app-store-screenshots.json";const DEFAULT_LOCALE = "en";-const DEVICE_KEYS = ["iphone", "ipad", "tvos", "watchos", "carplay", "mac", "android", "android-7", "android-10", "feature-graphic"];+const DEVICE_KEYS = ["iphone", "ipad", "duo-outer", "duo-outer-landscape", "duo-inner", "duo-inner-landscape", "tvos", "watchos", "carplay", "mac", "android", "android-7", "android-10", "feature-graphic", "creative-universal", "creative-header", "creative-search"];const LAYOUTS = ["hero", "device-bottom", "device-top", "two-devices", "no-device", "split-landscape", "feature-graphic"];function readJson(file) {@@ -386,11 +388,13 @@ Ask the user these. Do not proceed until you have answers:6. **Target stores** — Apple App Store, Mac App Store, Google Play, or a mix? Determines which platform decks to seed.7. **iPad / Mac / Android tablet screenshots** — If yes, what sizes and orientations?8. **Apple TV / Apple Watch / CarPlay** — Does the app have a tvOS or watchOS app, or CarPlay support? Each gets its own deck.-9. **Feature Graphic** — Want a 1024×500 Play Store banner too?-10. **Localized screenshots** — Languages? (e.g. en, de, es, pt, ja, ar, he)-11. **Number of slides** — Apple allows up to 10, Google Play up to 8.-12. **Brand colors / font** — If they want a custom theme beyond the built-in presets.-13. **Additional instructions** — Anything specific.+9. **iPhone Duo** — Does the app support iPhone Duo? If so, read `iphone-duo.md` before planning. Ask: what does the app do differently on the inner display (two panes, sidebar, wider grid)? Which displays and orientations have their own layout? Do they have simulator captures from each display at the exact sizes? Do they have Apple's bezels (see Step 5)? Download them and accept Apple's licence only if the user explicitly asks you to; never bundle or commit them.+10. **App Store creative assets** — Do they want a product page header / search results asset? Default to one universal 5244×2950 asset; offer separate header and search assets only if they need different compositions. Ask for a short brand line for each; don't reuse a screenshot headline.+11. **Feature Graphic** — Want a 1024×500 Play Store banner too?+12. **Localized screenshots** — Languages? (e.g. en, de, es, pt, ja, ar, he)+13. **Number of slides** — Apple allows up to 10, Google Play up to 8.+14. **Brand colors / font** — If they want a custom theme beyond the built-in presets.+15. **Additional instructions** — Anything specific.**IMPORTANT:** If the user gives instructions at any point, follow them. They override skill defaults.@@ -429,10 +433,13 @@ Move the user's screenshots into the layout the template expects:public/├── app-icon.png # ← user's app icon├── mockup.png # ← already copied by the template (iPhone bezel)+├── frames/ # ← optional: the user's own Apple bezels (Step 5)└── screenshots/├── apple/│ ├── iphone/{locale}/01.png … N.png│ ├── ipad/{locale}/01.png … N.png+ │ ├── duo-outer/{portrait|landscape}/{locale}/01.png … N.png # iPhone Duo outer display+ │ ├── duo-inner/{portrait|landscape}/{locale}/01.png … N.png # iPhone Duo inner display│ ├── tvos/{locale}/01.png … N.png # Apple TV, 16:9│ ├── watchos/{locale}/01.png … N.png # Apple Watch│ ├── carplay/{locale}/01.png … N.png # CarPlay head-unit captures@@ -522,6 +529,19 @@ Vary the `layout` field across slides. The editor exposes:Never repeat the same layout twice in a row. Use 1-2 `inverted` (dark) slides for visual rhythm.+On iPhone Duo decks, `two-devices` is **Folded + open**: the second device is the same phone in its other state, drawn in that display's frame. Its second capture comes from the other display.++### iPhone Duo Decks++Read `iphone-duo.md` before writing copy or seeding any Duo deck. It holds the research behind these rules, with sources. In short:++- **Plan the decks.** Lead with the inner display in landscape when the app has a real two-pane or wide layout. Add an outer portrait deck next. Make inner portrait and outer landscape decks only if the app has a real layout for them.+- **Show what only an open Duo can do.** At least one inner screenshot shows two panes, a sidebar or a wider grid. A screenshot that could have come from a normal iPhone wastes the Duo slot.+- **Inner landscape:** a one-line headline (about 30 characters or fewer) across the top, with the device large below. Pick captures where one pane's action and the other pane's result sit in the same frame.+- **Outer portrait:** a short, wide canvas. Use two short lines at most, large type, and one idea per screen. It can reuse the iPhone story.+- **Folded + open** once per deck, for the moment that carries across states ("Close it for today. Open it for the week.").+- **Write copy about what the user gets, not the hardware.** Localise every deck and check that each landscape line still fits on one line.+### Cross-Screen / Cross-Canvas CompositionUse the connected canvas as a design tool during Step 3, after the narrative arc and layout rhythm are chosen and before final export. For most decks with **5+ slides**, plan **one** tasteful cross-screen moment by default. For 8-10 slide decks, use at most **two**. For short, formal, or compliance-heavy decks, zero is fine. The goal is "these screenshots belong together," not "one giant poster chopped into pieces."@@ -673,6 +693,50 @@ Every Apple TV and Apple Watch size below was read from App Store Connect's own- **Layouts:** `split-landscape` (caption left, device right) is the strongest layout for the wide TV and CarPlay canvases. On the watch, keep headlines to two or three short words per line — the canvas is only 422 px wide.- **Screenshots:** use real captures at native resolution — Apple TV 3840×2160 or 1920×1080 from the tvOS simulator, Apple Watch from the watchOS simulator, CarPlay from the CarPlay Simulator (or Xcode's I/O → External Displays → CarPlay).+### iPhone Duo++| Target (deck) | Accepted size | Export folder |+|---|---|---|+| Outer display portrait (`duo-outer`) | 1398×2034 | `ios/duo-outer/1398x2034/` |+| Outer display landscape (`duo-outer-landscape`) | 2034×1398 | `ios/duo-outer-landscape/2034x1398/` |+| Inner display portrait (`duo-inner`) | 2007×2853 | `ios/duo-inner/2007x2853/` |+| Inner display landscape (`duo-inner-landscape`) | 2853×2007 | `ios/duo-inner-landscape/2853x2007/` |++- Sizes are App Store Connect's exact pixel sizes. Never derive Duo sizes from aspect-ratio labels or other iPhone sizes. PNG/JPG, no alpha (the exporter writes opaque RGB PNG).+- **Each display and orientation is its own deck.** In the editor, pick **iPhone Duo outer** or **inner** in the device menu and switch with **Orientation**; that opens the other deck rather than re-laying out this one, so portrait and landscape keep independent compositions. When seeding `app-store-screenshots.json`, write the four decks separately, and only the decks the app has real layouts for (see "iPhone Duo Decks" in Step 3 and `iphone-duo.md`).+- **Duo placements.** Landscape decks put the caption across the top and make the device the hero, wide enough that the capture reads, bleeding off the bottom in `hero`. `two-devices` is **Folded + open**: set `screenshotSecondary` to a capture from the other display (outer portrait ↔ inner landscape, outer landscape ↔ inner portrait). The editor never falls back to the front capture there, and export warns when it is missing. Duo frames ignore the scene's tilt: Apple's guidelines ask for straight-on product images, so don't rotate Duo devices by hand either.+- **Captures must come from the matching display and orientation.** A mismatched capture is letterboxed (never cropped or stretched) and the inspector and export toast flag it. Don't reuse iPhone captures for Duo, and don't mock up Duo UI by hand.+ - **Capture real ones** with `scripts/capture-iphone-duo.sh`. It needs Xcode 27.1+, the iOS 27.1 simulator runtime, and Device Hub open with the iPhone Duo simulator selected.+ - It sets Apple's 9:41 status bar, drives the Closed, Open, Book and turned poses, and writes `public/screenshots/apple/duo-{outer|inner}/{portrait|landscape}/<locale>/NN.png`. Run it after adding a debug-only launch argument that opens each screen, e.g. `-CapturePanel orders`.+ - Turned poses turn the phone **left**, so the outer display's camera matches Apple's landscape bezel.+ - Real captures keep the camera corner clear: iOS puts the time and status on a rail below the camera. A capture whose title sits under the camera is either hand-made or taken turned the wrong way.+ - Portrait-only iPhone apps have no outer landscape: skip that deck.+- **Apple's bezels are the user's own download.** Apple's product bezels (Apple Design Resources → Product Bezels, one `.dmg` per product) are licensed for mock-ups of apps for Apple platforms only, with no redistribution.+ - Download them and accept the licence (it appears when a `.dmg` is opened) **only when the user explicitly asks you to do that on their behalf**. Show them the licence's key terms when you do.+ - Never commit or bundle the bezels.+ - Copy the PNGs into `public/frames/` under the names in the template README's "Real bezels" table:+ - `iphone-portrait` (iPhone 18 Pro Max)+ - `ipad-portrait` (iPad Pro 13")+ - `watch` (Ultra 3)+ - `tv` (Apple TV 4K)+ - `mac` (MacBook Air 15")+ - `duo-outer-portrait`, `duo-inner-portrait`, and optionally the `-landscape` variants+ - The editor measures each file's transparent screen cutout and uses the bezel for that device; the App Store creatives use the iPhone bezel. `public/frames/*.png` is gitignored.+ - Without a file, Duo uses a drawn frame and every other device keeps its built-in frame. Android and CarPlay never use Apple bezels.++### App Store creative assets++| Target (deck) | Export | Placement |+|---|---|---|+| `creative-universal` | 5244×2950 | Product page header **and** search results |+| `creative-header` | 3840×1646 | Product page header |+| `creative-search` | 3840×2560 and 1920×1280 | Search results (any 3:2 from 1920×1280 to 3840×2560) |++- Recommend the universal asset first. Use separate header and search assets only when the universal crops don't give enough control.+- Default layouts sit inside the **art safe area** measured from Apple's own templates (universal x 1921–3323, y 660–1622; header x 1097–2743, y 493–1154; search x 836–3004, y 765–1795). The backdrop fills the rest. Keep the message and focal art inside the green safe-area guide. For the universal asset, the dashed header and search crops and the bottom-left previews are **estimates** (Apple doesn't publish the crop): tell the user to confirm in App Store Connect's Preview tool. Guides never export.+- Creatives share the deck's theme, font, scene, overlays and text elements. They are not the fixed Play Store feature graphic. Write one short brand line per creative; never paste a long screenshot headline.+- Creative assets are optional. They are reviewed through App Store Connect, separate from screenshots and from editorial artwork. Don't promise instant swaps, and don't upload or submit anything for the user.+### Mac| Device | Display type | Accepted sizes | Canvas |@@ -706,6 +770,8 @@ Every Apple TV and Apple Watch size below was read from App Store Connect's own- Screenshots correctly aligned inside every device frame- Filenames sort correctly (zero-padded numeric prefixes)- Feature Graphic exports cleanly at 1024×500 (no device frame)+- iPhone Duo exports are exactly 1398×2034 / 2034×1398 (outer) and 2007×2853 / 2853×2007 (inner), with no "doesn't match" or placeholder warning; every Folded + open slide has a capture from the other display; inner landscape headlines sit on one line in every locale. Tell the user to check the sets in App Store Connect's iPhone Duo preview tool before submitting+- Creative assets keep copy and focal art inside the safe-area guide, and a cleared label or headline exports empty (no editor hint text)## Common Mistakes@@ -718,12 +784,18 @@ Every Apple TV and Apple Watch size below was read from App Store Connect's own| Reset wiped the deck | Reset clears in-memory state and re-saves defaults to `app-store-screenshots.json`. Recover by `git checkout app-store-screenshots.json` if it was committed, or export first before resetting. || Export is blank | Check the export toast for a "may be missing" warning and re-export; otherwise the source PNG probably has alpha — flatten to RGB || Looked for a CarPlay slot in App Store Connect | There isn't one — upload CarPlay shots into the iPhone slot |+| Committed or bundled Apple's bezels | Remove them: the licence forbids redistribution. The user keeps their own copy in gitignored `public/frames/` |+| Turned a Duo portrait deck into landscape by editing transforms | Use the Orientation menu: landscape is a separate deck, so both compositions survive |+| Resized iPhone captures to Duo sizes, or used the inner capture on the outer deck | Capture each display in Xcode 27.1's simulator at its exact size (`scripts/capture-iphone-duo.sh`); the editor letterboxes anything else |+| The bezel's camera covers the clock or a title on an outer-display slide | The capture isn't real, or the phone was turned right. Real captures put the status rail under the camera; capture turned poses turned left |+| Duo set looks like the iPhone set on a wider canvas | Lead the inner deck with a two-pane capture and a one-line headline; see `iphone-duo.md` |+| Tilted, 3D or half-folded Duo mock-ups | Keep Duo frames straight-on and unmodified (Apple's marketing guidelines); never draw a crease || Mac window shows two title bars | The source is a single-window capture with its own title bar — crop it off or use a full-screen 16:10 capture || `bun dev` port collision | Template defaults to `next dev`; let Next pick the next free port (3001+) |## Project Migration-The current template writes `schemaVersion: 2`. Existing projects made by earlier versions of this skill usually have no `schemaVersion` and may still store string `label` / `headline` values. Do not hand-edit those projects unless the JSON is invalid. On load, `src/lib/storage.ts`:+The current editor saves `schemaVersion: 3` (v3 adds the iPhone Duo and creative decks). The migration recipe above still writes `schemaVersion: 2`, which the editor accepts and upgrades to v3 on its next save, adding the new decks without touching existing ones. Existing projects made by earlier versions of this skill usually have no `schemaVersion` and may still store string `label` / `headline` values. Do not hand-edit those projects unless the JSON is invalid. On load, `src/lib/storage.ts`:1. Converts legacy string copy to localized `{ "en": "..." }` objects.2. Sanitizes existing element transforms.diff --git a/skills/app-store-screenshots/iphone-duo.md b/skills/app-store-screenshots/iphone-duo.mdnew file mode 100644index 0000000..07b398c--- /dev/null+++ b/skills/app-store-screenshots/iphone-duo.md@@ -0,0 +1,261 @@+# Designing iPhone Duo screenshots++Read this before planning or seeding any iPhone Duo deck. It covers what the+displays are, what real Duo captures look like, what the App Store does with the+sets, what the first published sets do, and the rules this skill follows.++Research date: 7 October 2026. That is two days after App Store Connect opened+Duo uploads (5–6 October) and before the phone reaches customers (23 October).+The evidence is thin, so re-check the sources listed at the end before relying on+anything marked "unknown".++## The two displays++| | Outer display (closed) | Inner display (open) |+|---|---|---|+| Size | 5.4" | 7.6" |+| Points | 466 × 678 | 669 × 951 |+| Screenshot | 1398 × 2034 or 2034 × 1398 | 2007 × 2853 or 2853 × 2007 |+| Height ÷ width | 1.45 (a 6.9" iPhone is 2.17) | 1.42, about A-series paper |+| Size class | compact width | regular in both directions, like an iPad |+| Camera | front camera in the top trailing corner | FaceTime camera under the screen, invisible unless in use |++- **Both displays have nearly the same shape.** The outer display is a short,+ wide phone, not a small iPhone. The inner display is twice as wide as the+ outer at the same height.+- **The natural open pose is landscape.** Opening a closed phone held upright+ gives the inner display in landscape, with the fold running down the middle+ (x = 50%). Turned, the inner display is portrait and the fold runs across the+ middle (y = 50%).+- **The fold does not show in captures.** It is a "division region" that apps+ lay out around only while the phone is partly folded. Flat captures have no+ crease, so never draw one.++## What real Duo captures look like++Verified first-hand on 7 October 2026. Apple's Food Truck sample app was run on+the iPhone Duo simulator (Xcode 27.1 RC, iOS 27.1) in every pose, and each+capture was placed under Apple's own bezels. Check every capture against these+points before designing around it. A capture that looks like a stretched iPhone+screen will look wrong in the set.++- **The app lays itself out around the camera; screenshots must not.**+ - On the outer display, iOS puts the status cluster on the trailing rail,+ *below* the camera:+ - the time;+ - Wi-Fi inside a green battery ring (there is no separate battery icon);+ - then the app's own buttons (back, actions).+ - With a real capture under Apple's bezel, the camera covers nothing.+ - The camera only covers content in a mock-up or hand-made "capture" that+ ignores the rail. Never draw an app UI that runs into the top trailing+ corner of the outer display.+- **Outer display, portrait:**+ - the camera is in the top-right corner;+ - the rail with the time, status and controls runs down the right edge;+ - the content fills the rest;+ - the corners are square on the hinge side (left) and strongly rounded on the+ right.+- **Outer display, landscape:**+ - It exists only if the app supports landscape on iPhone. The outer display+ honours the app's supported orientations, so a portrait-only app (like Food+ Truck as shipped) stays portrait when the closed phone is turned. In that+ case, skip the outer landscape deck.+ - When it exists, iPhone hides the status bar, as on any iPhone in landscape,+ and the app's rail moves beside the camera.+ - **Turn the phone left.** Apple's "Outer Closed Landscape" bezel has the+ camera at the top left. Turned right, the camera is at the bottom right, so+ that capture would put the app's top-left title under the bezel's camera.+- **Inner display, landscape (open):**+ - This is the natural pose. The status cluster sits top right on the trailing+ rail.+ - No camera shows: it is under the display.+ - `NavigationSplitView` apps show the sidebar and detail side by side.+ - The home indicator runs along the bottom.+- **Inner display, partly folded ("Book"):**+ - Layouts move their split to exactly the fold (50/50), and the flat capture+ is still 2853 × 2007.+ - Use it when the two halves of the screen tell the story (list and detail,+ input and result).+- **Inner display, portrait:**+ - Bars return to a band across the top: sidebar button top left, status top+ right.+ - The sidebar collapses, and content reflows into two columns.+- **Inner layouts split at the fold.** Common shapes are:+ - a two-pane list and detail;+ - a sidebar with content;+ - a grid with an even number of columns, so nothing interactive sits on the+ fold.++ Apple's examples are Reminders in two 50/50 columns, Podcasts with the player+ beside its transcript, and Fitness keeping a wider gutter at the hinge.+- **Captures come from Xcode 27.1's simulator** at exactly the App Store sizes:+ outer 1398 × 2034 and inner 2007 × 2853, plus their landscape forms.+ - Raw captures are RGBA. The editor's export flattens them to RGB.+ - Never resize an iPhone capture to a Duo size: the editor letterboxes a+ mismatched capture and warns about it.++## Capturing on the iPhone Duo simulator++`scripts/capture-iphone-duo.sh` does all of this.++- **What it needs:**+ - Xcode 27.1 or later, plus the iOS 27.1 simulator runtime+ (`xcodebuild -downloadPlatform iOS`).+ - Simulator.app is replaced by **Device Hub**+ (`Xcode.app/Contents/Applications/DeviceHub.app`).+ - Poses are toolbar buttons with no command-line equivalent: **Closed**,+ **Partially Open**, **Open**, **Rotate Right**. The script presses them+ through Accessibility.+- **Status bar.** Set Apple's marketing status bar first:+ `xcrun simctl status_bar <udid> override --time 9:41 --dataNetwork wifi --wifiMode active --wifiBars 3 --cellularMode active --cellularBars 4 --batteryState charged --batteryLevel 100`.+- **Capturing each display.** Use+ `xcrun simctl io <udid> screenshot --display=primary` for the outer display+ and `--display=primary-1` for the inner one. Captures come out the right way+ up for the pose: 2853 × 2007 open, 2007 × 2853 open and turned, and+ 2034 × 1398 closed and turned (when the app supports it).+- **Showing a screen.** Give the app a debug-only launch argument that opens a+ given screen (e.g. `-CapturePanel orders`), so every capture is reproducible.+- **Where captures go.** The script writes them into the editor's layout:+ - `duo-outer/{portrait|landscape}/<locale>/NN.png`+ - `duo-inner/{portrait|landscape}/<locale>/NN.png`+ - Book-pose captures are written as `NN-book.png`.++## What the App Store does with the sets++- **Optional now, required from April 2027.** From then, every submission needs+ Duo screenshots. Until a Duo set exists, the store shows scaled 6.9" iPhone+ screenshots, which leave visible margins on the wider displays.+- **One to 10 screenshots per set**, PNG or JPEG, with no alpha channel. Portrait+ and landscape sizes are both accepted for each display.+- **Unknown: which set the store shows on which display, and in what+ orientation.** Apple hasn't documented how a product page renders on either+ display. App Store Connect has a preview tool for Duo product pages, so tell+ the user to check their sets there before submitting.+- **Badge and featuring.** Apps built with Xcode 27.1 get an "optimized for+ iPhone Duo" badge on the product page. A featuring nomination can say that the+ app supports every pose.+- **Apple's guidance is short.** "Share app previews and screenshots that+ highlight your app across orientations." App Review still expects more than+ half the screenshots in a set to show the app in use.++## What the first published sets do++No live product page showed Duo screenshots on the date above. The only+published Duo sets came from one developer's write-up for Kiradex, a+card-collecting app (blakecrosley.com, "Prepare Your App for iPhone Duo"). Its+iPhone, outer and inner sets were all built by one script from the same+simulator tour. What it shows:++- **Separate sets, one idea each, with copy written for each display.** The outer+ set (five frames) reuses the iPhone headlines. The inner set (five frames,+ landscape) has new lines that only make sense when the phone is open: "Open it.+ The binder fills the wall." and "Pick a card. The screen splits."+- **Inner landscape: one-line headline across the top, device below,** wide+ enough that the capture reads at store size. It bleeds off the bottom edge.+- **Outer: two short lines above a centred phone** that bleeds off the bottom,+ like an iPhone set on a shorter canvas.+- **One frame with no device in each set:** a single piece of content full-bleed+ on black, with its own headline.+- **Apple's bezels, straight on, unmodified,** with the captures dropped into the+ cutouts at exact size.++ASO write-ups add a few more rules, unproven but consistent with this:++- Use the inner width to show cause and effect in one frame, with the action in+ one pane and the result in the other.+- Keep copy left or top and the proof (the UI) right or below.+- The outer set is a glance: large type and no fine detail.++## Rules for this skill++### Plan the decks++1. **Lead with the inner display in landscape** when the app has a real two-pane+ or wide layout. That is where the Duo set earns its place: "If the screenshot+ could have come from a normal iPhone, the Duo slot is wasted."+2. **Add the outer portrait deck next.** It can reuse the iPhone story and+ headlines, recomposed for the shorter canvas.+3. **Make inner portrait and outer landscape decks only if the app has a real+ layout for them** and captures to match. A turned phone layout is not a+ reason for its own deck. An app that is portrait-only on iPhone has no outer+ landscape at all.+4. Aim for **4–6 screenshots per Duo deck**. The first one or two do the selling.++### Compose each display++- **Inner landscape (`duo-inner-landscape`):**+ - Open on `hero`: a one-line headline across the top, with the device large and+ allowed to bleed off the bottom.+ - Keep headlines to about 30 characters, or the line wraps. Use `\n` only when+ two lines are intended.+ - Pick captures that show two panes working together: list beside detail,+ sidebar beside canvas, input beside result.+- **Outer portrait (`duo-outer`):**+ - The canvas is only 1.45 × as tall as it is wide.+ - Use two short headline lines at most, then the phone.+ - Keep to one idea per screen, large type and no fine detail.+- **Folded + open (`two-devices` on any Duo deck):**+ - The second device is the same phone in its other state, drawn in that+ display's frame.+ - On the inner-landscape and outer-portrait decks, the pair is drawn to+ physical scale: the closed phone is as tall as the open one and half as wide.+ - Use it once per deck, for the moment that carries across states: "Close it+ for today. Open it for the week."+ - Its second capture must come from the other display (outer portrait for inner+ landscape, inner portrait for outer landscape). The editor never reuses the+ front capture there. A missing capture exports as an empty device, and the+ export warns.+- **`split-landscape`** works on both landscape decks. Give it a short caption+ column, not a full sentence.+- **`no-device`** works once per deck as a full-bleed brand moment.++### Copy++- Name what opening the phone gives the user, not the hardware: "Today and the+ week, side by side." Avoid "Now on iPhone Duo!".+- Use the same verbs across states, so the sets read as one story: "Close it+ for… / Open it for…".+- Localise every deck. Inner landscape lines are longer in German and shorter in+ Japanese, so check that each still fits on one line.++### Never++- **Never use tilted, perspective, 3D or half-folded device mock-ups.** Apple's+ marketing guidelines forbid altering Apple product images or simulating+ products in 3D, and ask for straight-on shots. The Duo frames therefore stay+ straight. Don't add device rotation to Duo slides.+- **Never draw a crease or fold line over a capture.**+- **Never use iPhone captures in a Duo deck,** or captures from one Duo display on+ the other.+- **Never crop the trailing rail off a capture.** It is where the app's controls+ live.+- **Never download Apple's bezels or accept their licence for the user unless+ they explicitly ask, and never commit them.** The licence allows mock-ups only,+ with no redistribution. See SKILL.md Step 5.++### QA before export++- Every Duo capture is the exact size of its deck: no letterbox warning in the+ inspector or the export toast.+- Each "Folded + open" slide has a capture from the other display.+- Zoom into the outer display's camera corner on every outer slide. Apple's+ camera must sit over the app's empty rail, not over a title or control. If it+ covers content, the capture is not a real one, or it was taken with the phone+ turned the wrong way.+- Inner landscape headlines sit on one line, in every locale.+- At least one inner screenshot shows something a 6.9" iPhone can't: two panes,+ a wider grid or a sidebar.+- Tell the user to check the sets in App Store Connect's Duo preview tool before+ submitting.++## Sources++- Apple, Prepare and submit your apps for iPhone Duo (developer news, October 2026)+- Apple, Three steps to make your app shine on iPhone Duo: developer.apple.com/iphone-duo/prepare/+- Apple, Screenshot specifications: developer.apple.com/help/app-store-connect/reference/app-information/screenshot-specifications+- Apple, App Store asset best practices: developer.apple.com/app-store/asset-best-practices/+- Apple Tech Talk, Strike a pose with adaptive layouts on iPhone Duo: developer.apple.com/videos/play/tech-talks/111463/+- Apple Newsroom, Apple unveils iPhone Duo (September 2026)+- Blake Crosley: "Prepare Your App for iPhone Duo: A Worked Example", "iPhone Duo, Day Two", "iPhone Duo for Developers: The 1.42 Problem" (blakecrosley.com)+- Appvertiser, "Your App Store Screenshots Won't Work on iPhone Duo"; appdesigns.click, "iPhone Duo App Store Screenshot Sizes"+- Mac Observer, "iPhone Duo's Design Rules: The Outer Display, the Hinge and Five Named Poses"diff --git a/skills/app-store-screenshots/scripts/capture-iphone-duo.sh b/skills/app-store-screenshots/scripts/capture-iphone-duo.shnew file mode 100755index 0000000..33de838--- /dev/null+++ b/skills/app-store-screenshots/scripts/capture-iphone-duo.sh@@ -0,0 +1,150 @@+#!/bin/zsh+# Captures an app on the iPhone Duo simulator in each pose, at the exact App+# Store sizes, into the editor's screenshot layout.+#+# Usage:+# capture-iphone-duo.sh --bundle <bundle id> --app <path/to/App.app> --out <public/screenshots/apple> \+# [--locale en] [--poses "closed open open-turned"] [--udid <simulator udid>] \+# -- <screen name> [launch args...] [-- <screen name> [launch args...]]...+#+# Each "-- name args" pair is one screen: the app is relaunched with those+# launch arguments (e.g. a debug-only "-CapturePanel orders" switch) and every+# requested pose is captured. Screens are numbered in the order given.+#+# Poses and where they land:+# closed outer display, portrait -> duo-outer/portrait/<locale>/NN.png (1398 x 2034)+# closed-turned outer display, landscape -> duo-outer/landscape/<locale>/NN.png (2034 x 1398)+# only if the app supports landscape on iPhone; otherwise iOS keeps+# the outer display in portrait and the capture is skipped.+# open inner display, landscape -> duo-inner/landscape/<locale>/NN.png (2853 x 2007)+# book inner display, partly folded (layouts split at the fold)+# -> duo-inner/landscape/<locale>/NN-book.png+# open-turned inner display, portrait -> duo-inner/portrait/<locale>/NN.png (2007 x 2853)+#+# Requirements: Xcode 27.1 or later with the iOS 27.1 simulator runtime, and+# Device Hub open (it replaced Simulator.app). Poses are set by pressing Device+# Hub's toolbar buttons through Accessibility, so the terminal running this+# needs Accessibility permission. The status bar is set to Apple's marketing+# standard (9:41, full Wi-Fi, cellular and battery) before capturing.+set -euo pipefail++bundle="" app="" out="" locale="en" poses="closed open open-turned" udid=""+while [[ $# -gt 0 && $1 != "--" ]]; do+ case $1 in+ --bundle) bundle=$2; shift 2 ;;+ --app) app=$2; shift 2 ;;+ --out) out=$2; shift 2 ;;+ --locale) locale=$2; shift 2 ;;+ --poses) poses=$2; shift 2 ;;+ --udid) udid=$2; shift 2 ;;+ *) echo "unknown option $1" >&2; exit 2 ;;+ esac+done+[[ -n $bundle && -n $out ]] || { echo "--bundle and --out are required" >&2; exit 2; }++# Screens: "-- name args..." groups.+typeset -a names argsets+while [[ $# -gt 0 ]]; do+ shift # the "--"+ [[ $# -gt 0 ]] || break+ names+=("$1"); shift+ local_args=()+ while [[ $# -gt 0 && $1 != "--" ]]; do local_args+=("$1"); shift; done+ argsets+=("${(j: :)${(q)local_args[@]}}")+done+(( ${#names} > 0 )) || { names=(screen); argsets=(""); }++# Use an Xcode that knows the iPhone Duo.+if ! xcrun simctl list devicetypes | grep -q "iPhone-Duo"; then+ for x in /Applications/Xcode*.app; do+ if DEVELOPER_DIR=$x/Contents/Developer xcrun simctl list devicetypes 2>/dev/null | grep -q "iPhone-Duo"; then+ export DEVELOPER_DIR=$x/Contents/Developer; break+ fi+ done+fi+xcrun simctl list devicetypes | grep -q "iPhone-Duo" || { echo "No iPhone Duo simulator: install Xcode 27.1+ and its iOS 27.1 runtime" >&2; exit 1; }++if [[ -z $udid ]]; then+ udid=$(xcrun simctl list devices available | grep -m1 "iPhone Duo" | grep -oE "[0-9A-F-]{36}" || true)+ if [[ -z $udid ]]; then+ runtime=$(xcrun simctl list runtimes | grep -oE "com.apple.CoreSimulator.SimRuntime.iOS-[0-9-]+" | sort -V | tail -1)+ udid=$(xcrun simctl create "iPhone Duo" com.apple.CoreSimulator.SimDeviceType.iPhone-Duo "$runtime")+ fi+fi+xcrun simctl boot "$udid" 2>/dev/null || true+xcrun simctl bootstatus "$udid" -b > /dev/null+[[ -n $app ]] && xcrun simctl install "$udid" "$app"+xcrun simctl status_bar "$udid" override --time 9:41 --dataNetwork wifi --wifiMode active --wifiBars 3 \+ --cellularMode active --cellularBars 4 --batteryState charged --batteryLevel 100++devicehub=$(ls -d ${DEVELOPER_DIR:-$(xcode-select -p)}/../Applications/DeviceHub.app 2>/dev/null || true)+[[ -n $devicehub ]] && open -g -a "$devicehub" && sleep 5++# Warm-up launch: the first cold start after install can take longer than the+# per-screen wait and would capture a blank screen.+xcrun simctl launch "$udid" "$bundle" > /dev/null && sleep 15+xcrun simctl terminate "$udid" "$bundle" 2> /dev/null || true++# Device Hub's toolbar buttons, by their help text (the tooltip).+press() {+ osascript - "$1" > /dev/null <<'APPLESCRIPT'+on run argv+ tell application "System Events" to tell process "DeviceHub"+ repeat with b in (buttons of group 3 of splitter group 1 of group 1 of splitter group 1 of group 1 of window 1)+ if (help of b as text) is (item 1 of argv) then+ click b+ return+ end if+ end repeat+ error "Device Hub has no \"" & (item 1 of argv) & "\" button. Select the iPhone Duo simulator in Device Hub first."+ end tell+end run+APPLESCRIPT+ sleep 3+}++capture() { # pose display folder suffix+ local pose=$1 display=$2 folder=$3 suffix=$4 i=0+ mkdir -p "$out/$folder/$locale"+ # The display just changed pose; let it settle before the first launch.+ sleep 5+ for name in $names; do+ i=$((i + 1))+ local file="$out/$folder/$locale/$(printf %02d $i)$suffix.png"+ # A launch straight after a pose change can paint nothing but the status+ # bar. Such a capture compresses to a fraction of a real one, so relaunch+ # and wait longer, up to twice.+ for attempt in 1 2 3; do+ xcrun simctl terminate "$udid" "$bundle" 2> /dev/null || true+ eval "xcrun simctl launch \"$udid\" \"$bundle\" ${argsets[$i]}" > /dev/null+ sleep $((4 + attempt * 4))+ xcrun simctl io "$udid" screenshot --display="$display" "$file" > /dev/null 2>&1+ (( $(stat -f %z "$file") > 150000 )) && break+ (( attempt == 3 )) && echo "warning: $file looks almost blank; check it"+ done+ local size=$(sips -g pixelWidth -g pixelHeight "$file" | awk '/pixel/ {print $2}' | paste -sd x -)+ if [[ $pose == closed-turned && $size == 1398x2034 ]]; then+ rm -f "$file"; echo "skip $name ($pose): the app keeps the outer display in portrait"; continue+ fi+ echo "$file $size ($name, $pose)"+ done+}++# Turned poses turn the phone LEFT (three right turns). That matches Apple's+# landscape bezels: the outer display's camera ends up top left, where the app+# keeps its layout clear. Turned right, the camera would sit bottom right and+# Apple's bezel would cover the app's top-left content.+turn_left() { press "Rotate Right"; press "Rotate Right"; press "Rotate Right"; }+turn_back() { press "Rotate Right"; }++for pose in ${=poses}; do+ case $pose in+ closed) press Closed; capture closed primary duo-outer/portrait "" ;;+ closed-turned) press Closed; turn_left; capture closed-turned primary duo-outer/landscape ""; turn_back ;;+ open) press Open; capture open primary-1 duo-inner/landscape "" ;;+ book) press "Partially Open"; capture book primary-1 duo-inner/landscape -book ;;+ open-turned) press Open; turn_left; capture open-turned primary-1 duo-inner/portrait ""; turn_back ;;+ *) echo "unknown pose $pose" >&2; exit 2 ;;+ esac+done+press Closeddiff --git a/skills/app-store-screenshots/template/.gitignore b/skills/app-store-screenshots/template/.gitignoreindex 43cb5bf..153dc29 100644--- a/skills/app-store-screenshots/template/.gitignore+++ b/skills/app-store-screenshots/template/.gitignore@@ -16,3 +16,7 @@ public/fonts/imported/*# Tester Army output.e2e/++# iPhone Duo bezels from Apple Design Resources. Apple's licence forbids+# redistributing them, so each user adds their own copy (see README).+public/frames/*.pngdiff --git a/skills/app-store-screenshots/template/README.md b/skills/app-store-screenshots/template/README.mdindex b765fe5..95c8ca6 100644--- a/skills/app-store-screenshots/template/README.md+++ b/skills/app-store-screenshots/template/README.md@@ -17,9 +17,9 @@ bun dev # http://localhost:3000- **Screen controls** — drag-to-reorder screens, click-to-edit text, screenshot drop targets, per-screen layout switcher, dark/light toggle.- **Style Lab and Scene Playground** — compare complete looks for a deck and restyle every screen's backdrop, depth and headline at once. See [Style Lab](#style-lab) and [Scene Playground](#scene-playground).- **Image overlays, fonts, backgrounds and undo** — PNG/JPG overlay elements, a live screenshot font menu (with font import), per-screen custom backgrounds, and toolbar Undo/Redo. See [Editor controls](#editor-controls).-- **Device frames** (`src/components/editor/device-frames.tsx`) — iPhone (PNG mockup), iPad, Apple TV, Apple Watch, CarPlay head unit, Mac window, Android phone, Android tablet (portrait + landscape), feature graphic.+- **Device frames** (`src/components/editor/device-frames.tsx`) — iPhone (PNG mockup), iPhone Duo outer and inner displays (a drawn frame), iPad, Apple TV, Apple Watch, CarPlay head unit, Mac window, Android phone, Android tablet (portrait + landscape), feature graphic. Apple's own bezels, if you add them to `public/frames/`, replace the built-in iPhone, iPad, Apple Watch, Apple TV, Mac and iPhone Duo frames (see Real bezels).- **Auto-save (git-trackable)** — every change is persisted within ~600ms to **`app-store-screenshots.json`** at the project root (via `/api/project`) **and** mirrored to `localStorage` as an instant-paint cache. Commit `app-store-screenshots.json` and you can `git clone` to another machine and resume exactly where you left off.-- **Multi-device decks** — iOS (iPhone, iPad, Apple TV, Apple Watch, CarPlay), Mac, and Android decks live side by side; switching the platform tab keeps each tab's last device.+- **Multi-device decks** — iOS (iPhone, iPad, iPhone Duo outer/inner in portrait and landscape, Apple TV, Apple Watch, CarPlay, App Store creative assets), Mac, and Android decks live side by side; switching the platform tab keeps each tab's last device.- **One-click export** — bulk PNG export at any required App Store / Play Store resolution using `html-to-image`; each PNG is rendered from the current connected or isolated deck mode.- **Project migration** — older `app-store-screenshots.json` files are migrated on load. Existing per-slide transforms remain valid, and connected crops become available without rewriting the deck by hand.- **Legacy-safe mode** — pre-v2 projects opened directly in the editor start in isolated-screen mode first, then can opt into connected crops with the toolbar's Connected/Isolated control. Skill-run in-place migrations keep legacy decks isolated unless the project had already explicitly opted into connected canvas.@@ -48,6 +48,72 @@ Each screen is rendered once per locale at canvas resolution (`src/lib/export-reCarPlay has no App Store Connect slot of its own: the CarPlay deck is a head-unit frame on a landscape iPhone canvas and exports landscape iPhone sizes for upload into the iPhone slot.+### iPhone Duo++The iOS device menu has **iPhone Duo outer** and **iPhone Duo inner**; the **Orientation** menu switches each between portrait and landscape. App Store Connect lists exactly one size per display and orientation, and each export is that size only:++| Target | Portrait | Landscape |+|--------|----------|-----------|+| Duo outer display | 1398 × 2034 | 2034 × 1398 |+| Duo inner display | 2007 × 2853 | 2853 × 2007 |++Each display *and* orientation is its own deck (`duo-outer`, `duo-outer-landscape`, `duo-inner`, `duo-inner-landscape` in `slidesByDevice`), so turning a deck never rewrites your placements: portrait and landscape keep independent compositions. ZIPs go to `ios/<target>/<WxH>/<locale>/`.++Duo decks have their own placements, based on the first published Duo sets and Apple's guidance. The research and its sources are in [`../iphone-duo.md`](../iphone-duo.md).++- **Landscape decks** put the caption across the top and make the device the hero, wide enough that a two-pane capture reads. In **Hero** the device bleeds off the bottom.+- **Portrait decks** use phone placements sized from the frame's own aspect.++On a Duo deck, **Two devices** is called **Folded + open**:++- The second device is the same phone in its other state, drawn in that display's frame. The pairs are outer portrait with inner landscape, and outer landscape with inner portrait.+- The outer portrait / inner landscape pair is drawn to physical scale: the closed phone is as tall as the open one and half as wide.+- The second device takes a capture from the other display and never falls back to the front capture. Without one it stays empty, and export warns.++Duo frames ignore the scene's **Tilt**, because Apple's guidelines ask for straight-on product images. The drawn frame shows the outer display's corner camera and no crease, since captures have none. The starter decks follow the same research. The inner landscape deck leads, opening on the two-pane view and a folded + open screen.++Use real captures from each display. A capture whose aspect doesn't match the display (an iPhone screenshot on the inner display, a portrait capture in landscape) is **letterboxed, never cropped or stretched**, and both the inspector and the export warning name it.++`../scripts/capture-iphone-duo.sh` takes those captures from the iPhone Duo simulator. It needs Xcode 27.1+ and Device Hub. It sets the 9:41 status bar, drives the Closed, Open, Book and turned poses, and writes into `public/screenshots/apple/duo-*`.++On a real capture the outer display's status and controls sit on a rail below the camera, so Apple's bezel covers nothing. Turned poses are taken with the phone turned left, matching Apple's landscape bezel.++**Real bezels.** Apple publishes product bezels in [Apple Design Resources](https://developer.apple.com/design/resources/) (Product Bezels). Their licence allows using them to make mock-ups of apps for Apple platforms, but not redistributing them or using them for apps on other platforms. This template doesn't ship them. To use them, download the packs, accept Apple's licence (it appears when you open each `.dmg`), and copy PNGs from the packs' `PNG` folders into `public/frames/` with these names:++| File | Device | Apple pack and PNG (screen cutout) |+|------|--------|-------------------------------------|+| `iphone-portrait.png` | iPhone, and the iPhone in App Store creatives | iPhone 18 → iPhone 18 Pro Max, Portrait (1320 × 2868) |+| `ipad-portrait.png` | iPad | iPad Pro (M5) → 13", Portrait (2064 × 2752) |+| `watch.png` | Apple Watch | Apple Watch Ultra 3 (422 × 514) |+| `tv.png` | Apple TV | Apple TV → Apple TV - 4K (3840 × 2160) |+| `mac.png` | Mac | MacBook Air M5 → 15-inch (2880 × 1864) |+| `duo-outer-portrait.png` | iPhone Duo outer, portrait | iPhone Duo → Outer Closed Portrait (1398 × 2034) |+| `duo-outer-landscape.png` | iPhone Duo outer, landscape | iPhone Duo → Outer Closed Landscape (optional: the portrait file is turned if absent) |+| `duo-inner-portrait.png` | iPhone Duo inner, portrait | iPhone Duo → Inner Open Portrait (2007 × 2853) |+| `duo-inner-landscape.png` | iPhone Duo inner, landscape | iPhone Duo → Inner Open Landscape (optional) |++Any finish or band works. Each file listed has a screen cutout exactly the size of that deck's capture, except the Mac. No MacBook screen is 16:10, so a 2880 × 1800 Mac capture fills the MacBook Air 15" screen from the top and loses about 3% at the bottom. A capture taken on that MacBook fits exactly.++`/api/frames` measures each file's transparent screen cutout, and the editor draws the capture under the bezel. Cameras, corners and cutouts therefore come from Apple's artwork, and devices are placed using the bezel's real aspect ratio.++- Reload the editor after adding or replacing a file.+- A file whose centre isn't transparent is reported in a toast and skipped.+- `public/frames/*.png` is gitignored; keep the files out of public repositories.+- Without a file, iPhone Duo uses a drawn frame whose screen has the exact capture aspect, and every other device keeps its built-in frame.+- CarPlay and Android always use built-in frames: Apple publishes no head-unit bezel, and the licence doesn't cover other platforms.++### App Store creative assets++Three iOS targets make the optional App Store creative assets shown on the product page header and in search results:++| Target | Export | Notes |+|--------|--------|-------|+| **Creative: universal** | 5244 × 2950 | One asset for both header and search results. |+| **Creative: header** | 3840 × 1646 | Header only. |+| **Creative: search** | 3840 × 2560, 1920 × 1280 | Search results only; any 3:2 size in that range is accepted. |++They use the same theme, font, scene, layouts, text and image overlays as screenshots. They aren't the fixed icon + name + tagline Play Store feature graphic. Each target's default layout sits inside the **art safe area** of Apple's own template for that placement, measured from Apple's Photoshop templates (universal: x 1921–3323, y 660–1622). The backdrop fills the rest of the asset. On the canvas, a green outline marks the safe area. For the universal asset, dashed outlines show estimated header and search crops, and **Header** and **Search** previews at the bottom left show the active asset through those crops. Guides and previews are never exported. Apple doesn't publish how it crops the universal asset, so the crops are centred estimates; check the final asset with App Store Connect's Preview tool. Write a short brand line for each creative rather than reusing a long screenshot headline. Creative assets go through App Store Connect's own review, separate from screenshots.+Mac is its own platform tab because App Store Connect lists macOS separately from the iOS app. The Mac deck designs at 2880×1800 and exports the four 16:10 Mac App Store sizes (2880×1800, 2560×1600, 1440×900, 1280×800) to `macos/mac/<WxH>/<locale>/`. The Mac window's content area is exactly 16:10, so a full-screen 16:10 capture fills it uncropped.## Editor controls@@ -71,7 +137,7 @@ In the inspector's **Elements** card, click **Image**, then **Pick** (or drop) a**Style Lab** in the toolbar opens four complete looks for the open deck, each from a different direction (Editorial, Playful, Cinematic, Minimal on first open; Swiss Bold, Dreamy, Vintage Poster and Panorama join on **Shuffle**). A look sets the theme, which screens are inverted, the font, headline weight/case/alignment/size, each screen's layout, and the scene. Your current deck is pinned at the top for before/after comparison. Copy and screenshots never change.- **Keep** locks (Colors, Type, Layout, Scene) hold that part of your deck in every look; Shuffle and **Remix** (another take on one direction) only vary what is unlocked.-- **Apply** writes the look as one undo step. Changing layout resets that screen's built-in placements (headline, devices, magnifier) to the layout defaults; lock **Layout** to keep hand-placed elements. Phones and portrait tablets get new layouts; landscape, TV, Watch, CarPlay and Mac decks keep theirs.+- **Apply** writes the look as one undo step. Changing layout resets that screen's built-in placements (headline, devices, magnifier) to the layout defaults; lock **Layout** to keep hand-placed elements. Phones, portrait tablets and portrait iPhone Duo decks get new layouts; landscape, TV, Watch, CarPlay, Mac and creative decks keep theirs.- **Save** stars a look into `savedLooks` in the project file, listed under **Saved looks** next time.- **Export comparison** downloads one PNG with your deck and all four looks.@@ -109,11 +175,12 @@ The toolbar arrows, `⌘Z` / `Ctrl+Z` and `⇧⌘Z` / `Ctrl+Shift+Z` (or `Ctrl+Y## Notes-- `mockup.png` is the iPhone bezel overlay; replacing it requires re-measuring the `PHONE_SCREEN` constants.+- `mockup.png` is the iPhone bezel overlay; replacing it requires re-measuring the `PHONE_SCREEN` constants. Apple's own bezels in `public/frames/` are measured automatically and replace the built-in frames (see [iPhone Duo](#iphone-duo), Real bezels).- Image preloading converts every static path to a base64 data URI before exports run, and export retries paths that were previously missing. `export-render.ts` then waits for those images to paint in the render (see Exporting).- Reset via the toolbar's circular arrow icon clears in-memory state and reloads the default screens. To wipe disk state too, delete `app-store-screenshots.json`.- **Persistence model** — the canonical state lives in `app-store-screenshots.json` (git-tracked). On load, the editor reads localStorage first, then reconciles with the file; if the file endpoint is unavailable, autosave is blocked so stale cache cannot overwrite disk. File saves are serialized and atomic. Each editor sends the revision it loaded, so a newer save from another tab or an on-disk edit produces a conflict instead of an overwrite. Your unsaved work stays open: export or copy it before reloading. **Retry save** retries transient failures; it does not override conflicts. Leaving with unsaved edits triggers the browser's warning.- **Migration model** — schema v1 projects do not need a manual conversion. On first load, the editor upgrades localized text and transform records, writes `schemaVersion: 2`, preserves all existing screens, and keeps `connectedCanvas: false` so old offscreen/clipped elements export exactly as isolated screens. Turn on **Connected** in the toolbar when you want elements to cross screen edges. Explicit skill migrations preserve an existing `connectedCanvas` choice, otherwise they keep legacy decks isolated too.+- **Schema v3** — the editor saves `schemaVersion: 3`, which adds the iPhone Duo and creative decks. v1 and v2 projects open unchanged and gain those decks, with their starter screens, on first load. Existing decks, transforms, themes, fonts, locales and the connected/isolated setting are untouched. Editors older than v3 refuse a v3 file ("Unsupported project schema version") instead of silently dropping the new decks.- **Custom themes** — if a project file references a theme id that is not present in `src/lib/constants.ts`, the editor falls back to `clean-light` and shows a warning. Merge custom `THEMES` entries during in-place upgrades.## Local API contract@@ -127,6 +194,8 @@ These routes are for a local editor running in one server process. They have noUploads are written atomically. Project and upload requests time out after 15 seconds in the editor; image preloads after 10 seconds. Export also stops with a retryable error if font loading takes longer than 15 seconds. Failed preloads can be retried on export, and failed or stalled PNG workers finish through the inline encoder.+- `GET /api/frames` returns `{ ok, frames, errors }`: each Apple bezel found in `public/frames/` with its measured screen cutout, and any file that couldn't be used. `/frames/[filename]` serves only the nine file names in the Real bezels table.+The `/screenshots/uploaded/[filename]` and `/fonts/imported/[filename]` routes serve uploads created after server startup, including with `next start`. They accept only the generated hash filenames and supported extensions, preserving the same asset URLs and on-disk locations as the dev server.## Automated verificationdiff --git a/skills/app-store-screenshots/template/docs/testing/e2e.md b/skills/app-store-screenshots/template/docs/testing/e2e.mdindex a61e048..8b19797 100644--- a/skills/app-store-screenshots/template/docs/testing/e2e.md+++ b/skills/app-store-screenshots/template/docs/testing/e2e.md@@ -15,7 +15,7 @@ bun run test:e2eSCREENSHOTS_E2E_PRODUCTION=1 bun run test:e2e```-`bun run test:e2e` runs 37 tests: 34 tests that directly drive/inspect the product with Tester Army (23 in `tests/editor.e2e.ts`, 11 for Style Lab, Scene Playground and the magnifier in `tests/scene-style-lab.e2e.ts`), plus three tests that run 56 existing regression groups (35 browser/export, 12 UI, nine API). Nested loops cover every advertised device size, layout, orientation, theme and built-in font. Counts refer to test/group definitions, not every loop iteration.+`bun run test:e2e` runs 56 tests: 53 tests that directly drive/inspect the product with Tester Army (30 in `tests/editor.e2e.ts`, 11 for Style Lab, Scene Playground and the magnifier in `tests/scene-style-lab.e2e.ts`, 12 for iPhone Duo, App Store creatives and the issue 41 export regression in `tests/targets.e2e.ts`), plus three tests that run 56 existing regression groups (35 browser/export, 12 UI, nine API). Nested loops cover every advertised device size, layout, orientation, theme and built-in font. Counts refer to test/group definitions, not every loop iteration.For one direct regression:@@ -55,7 +55,12 @@ Use the default output directory for this suite's ZIP-content checks; the publis| Product flow | Verification || --- | --- || iOS, Mac, Android tabs and last selected device | Direct tab round-trip verifies device and preserved copy; UI harness verifies all combinations. |-| iPhone, iPad, Apple TV, Watch, CarPlay, Mac, Android phone, 7-inch/10-inch tablets, feature graphic | Ten direct deck tests edit/create/undo on each device; browser harness exports every device at every advertised size and checks screenshot pixels. |+| iPhone, iPad, iPhone Duo (4 decks), Apple TV, Watch, CarPlay, Mac, Android phone, 7-inch/10-inch tablets, feature graphic, App Store creatives (3 decks) | Seventeen direct deck tests edit/create/undo on each device; browser harness exports every device at every advertised size and checks screenshot pixels. |+| iPhone Duo orientations and displays | Direct test switches outer portrait → landscape → inner landscape → inner portrait → outer, edits copy, checks each deck keeps its own copy and a hand-placed rotated transform, the saved device/orientation, and reload. UI harness iterates every layout on both Duo displays in both orientations. |+| iPhone Duo and creative export sizes | Seven direct ZIP tests check exact 1398×2034, 2034×1398, 2007×2853, 2853×2007, 5244×2950, 3840×1646, 3840×2560 and 1920×1280 PNGs, file paths, PNG color type 2 and no alpha. |+| Legacy project upgrade | Direct v2 project with a hand-placed caption saves as v3 with the existing deck unchanged and every new deck present. |+| Creative guides | Direct test finds the safe-area guide and both placement previews on the editable canvas only, never in the export canvas. |+| Issue 41: cleared copy in exports | Direct test confirms the editable canvas shows the `LABEL` / `Headline goes here` hints, then exports a cleared screen and a zero-width-space screen and requires them to be pixel-identical. Against the unfixed CSS it failed with 14,379 differing bytes; it passes with the fix. || Portrait/landscape and every layout | UI harness iterates devices/layouts and both supported tablet orientations, checks editing/persistence. || Screen create, select, duplicate, delete, empty state, reorder | Direct CRUD and keyboard reorder assertions; UI harness pointer/keyboard ordering, selected copy, final-slide deletion/undo and usable empty states. || Undo/redo, cross-deck editing, shortcuts | Direct regression proves rapid copy edit + Add screen preserves copy after Undo on ten decks; harness checks typing, menu arrows, cross-deck history and undo/redo. |@@ -87,6 +92,9 @@ Harness integration also corrected trailing-slash URLs from `app.baseUrl`: `//ap## Honest limits+- Apple's iPhone Duo bezels are not in the repository (licence) and were not used: bezel measurement and the real-bezel render/export path were verified with a synthetic bezel PNG of known geometry, not Apple's files.+- Universal creative header/search crops are centred estimates, not Apple's published crop. The art safe areas come from Apple's templates.+- Chrome on a local desktop and emulated touch/viewport sizes are verified. Real iOS/Android hardware, WebKit/Firefox rendering and installed macOS system fonts on other operating systems are not covered.- This is flow/regression coverage, not a complete accessibility audit, visual pixel-baseline suite, load test, or exhaustive security scan. Keyboard actions and responsive overflow are exercised; screen readers, every contrast combination and every tab sequence are not exhaustively judged.- Export exposes a busy/progress state and error recovery. The product has no export-cancel control; no cancellation test is presented as covered. Reset dialog cancellation is a separate flow.@@ -117,3 +125,48 @@ Before the ESM fix, independent Luna verification passed both 26-test suites andThe independent Luna follow-up passed the repaired cold root dev API sequence (9/9), a fresh dev suite (26/26 plus all 56 groups, zero failures/skips/flakes/retries/model use and all cleanups complete), typecheck and build. It verified the built animation plugin CSS, reviewed the retained final production 26/26 report, and validated a copied standalone scaffold with a webpack build plus all nine API groups using its bundled migration fixture. Production was not repeated during this follow-up; it was independently run before the config fix and fully rerun by the implementation afterward. No additional findings remained. The follow-up report is `/Users/parthjadhav/research/e2e-rollout-2026-10-03/screenshots-luna-followup.md`; cold-dev logs are under `/tmp/screenshots-luna-followup-20261003-root-dev/`. Both independent loops confirmed Chrome use, freed port 4312, workspace cleanup and unchanged canonical project/assets.The canonical `app-store-screenshots.json` and source `public/` assets remained unchanged, and the original untracked `promo/` directory was preserved. No commits, pushes, PRs, store uploads or external feedback were created.++### iPhone Duo, App Store creatives and issue 41 (2026-10-07)++Validated locally with installed Google Chrome and Playwright WebKit.++| Check | Result |+| --- | --- |+| `bun run typecheck`, `bun run build` | Passed |+| Dev Tester Army suite | 54/55 passed; all 56 harness groups (35 browser/export, 12 UI, 9 API) passed |+| Production Tester Army suite | 54/55 passed; all 56 harness groups passed |+| The one failure in both | `keyboard screen reorder…`: the ArrowDown press doesn't move the item within the timeout when it runs after the rest of `editor.e2e.ts`. It also fails on unmodified `main` (`editor.e2e.ts` alone: 22/23) and passes when run by itself (2/2). It predates this change and is still open. |+| `tests/targets.e2e.ts` | 11/11 passed (12/12 after the Duo design pass below). The issue 41 test failed against the old `[contenteditable]:empty::before` rule (14,379 differing bytes) and passes with the fix. |+| Manual exports (Chrome, dev and production servers) | All four Duo sizes and 5244×2950: exact dimensions, color type 2, no alpha. Guides absent from PNGs. Mismatched capture letterboxed and named in the warning. |+| Repeated exports, en/de/ar | `creative-universal` (12 PNGs) and `duo-inner-landscape` (18 PNGs), three times in Chrome and twice in WebKit, all exact, opaque and with every locale folder; about 6 s and 5 s per export, with no slowdown across runs. |+| Synthetic bezel in `public/frames/` | `/api/frames` measured the cutout exactly (51, 63, 1398×2034, radius 150). Portrait and turned-landscape frames rendered and exported correctly. |++Apple's iPhone Duo bezel pack was downloaded but not opened. Opening it requires accepting Apple's licence, and that licence forbids redistribution. The real-bezel path was therefore verified only with a synthetic bezel. Apple's creative templates (universal, header, search) were downloaded from developer.apple.com and their "Art Safe Area" layers measured. No commits, pushes, uploads or external contact were made.++### iPhone Duo design pass (7 October 2026)++This pass added Duo-specific placements, the **Folded + open** pair and new starter decks (see `../iphone-duo.md`), plus one test: `duo folded + open pairs the other display and never reuses the front capture`.++| Check | Result |+| --- | --- |+| `typecheck`, `build` | Passed |+| Dev Tester Army suite | 56/56 passed, including the keyboard reorder test that failed in the earlier run; all 56 harness groups passed. The UI harness now selects **Folded + open** on Duo decks. |+| Manual exports | All four Duo decks, with every layout and with a designed example deck, exported from realistic synthetic captures at exact sizes. Folded + open drew each display in its own frame, and export reported no letterbox or placeholder warnings when both captures matched. |++### Apple bezels (7 October 2026)++The editor now draws iPhone, iPad, Apple Watch, Apple TV, Mac, App Store creatives and iPhone Duo under Apple's own bezels when they are in `public/frames/` (see the template README, Real bezels). The test server (`e2e-army/server.cjs`) leaves `public/frames/*.png` out of its disposable workspace, so every machine tests the same product as a fresh clone. With the bezels copied in, Scene Playground steps took longer than the 500 ms undo-grouping window under the harness, which made the undo test depend on the machine.++| Check | Result |+| --- | --- |+| Dev Tester Army suite | 56/56 passed; all 56 harness groups passed |+| Manual exports with all nine bezels | iPhone, iPad, Watch, TV, Mac, universal creative and all four Duo decks exported at every listed size, color type 2 and no alpha, with no warnings |++### Real iPhone Duo captures (7 October 2026)++Apple's Food Truck sample app was built with Xcode 27.1 RC and captured on the iPhone Duo simulator (iOS 27.1) with `../scripts/capture-iphone-duo.sh` in every pose: closed, closed and turned, open, Book, and open and turned. Every capture came out at the exact App Store size. The captures were then exported through the editor under Apple's bezels: all four Duo decks, opaque RGB, no warnings.++Two fixes came out of this:++- **Bezel cutouts are now measured per corner** (`radii` in `/api/frames`) and the capture is clipped to that shape. The Duo's outer display is square on its hinge side and rounded on the other, so a single radius let the capture poke past the bezel's body.+- **Turned poses are captured with the phone turned left.** That orientation matches Apple's landscape bezel, which has the camera top left.diff --git a/skills/app-store-screenshots/template/e2e-army/server.cjs b/skills/app-store-screenshots/template/e2e-army/server.cjsindex 163c009..6787dfb 100644--- a/skills/app-store-screenshots/template/e2e-army/server.cjs+++ b/skills/app-store-screenshots/template/e2e-army/server.cjs@@ -6,8 +6,12 @@ const path = require('node:path');const { spawn } = require('node:child_process');const source = path.resolve(__dirname, '..');const workspace = mkdtempSync(path.join(tmpdir(), 'screenshots-e2e-'));+// Apple bezels a user added to public/frames/ are left out too, so every+// machine tests the same product as a fresh clone (they're gitignored).cpSync(source, workspace, { recursive: true, filter: p => {- const first = path.relative(source, p).split(path.sep)[0];+ const rel = path.relative(source, p);+ const first = rel.split(path.sep)[0];+ if (path.dirname(rel) === path.join('public', 'frames') && rel.endsWith('.png')) return false;return !['node_modules', '.next', '.e2e', '.git', 'tests', 'e2e-army'].includes(first);}});symlinkSync(path.join(source, 'node_modules'), path.join(workspace, 'node_modules'), 'dir');diff --git a/skills/app-store-screenshots/template/public/frames/.gitkeep b/skills/app-store-screenshots/template/public/frames/.gitkeepnew file mode 100644index 0000000..e69de29diff --git a/skills/app-store-screenshots/template/src/app/api/frames/route.ts b/skills/app-store-screenshots/template/src/app/api/frames/route.tsnew file mode 100644index 0000000..1178014--- /dev/null+++ b/skills/app-store-screenshots/template/src/app/api/frames/route.ts@@ -0,0 +1,36 @@+import { promises as fs } from "node:fs";+import path from "node:path";+import { NextResponse } from "next/server";+import { FRAME_FILES, type FrameFile, type MeasuredFrame } from "@/lib/frame-assets";+import { measureFrame } from "@/lib/measure-frame";++export const dynamic = "force-dynamic";++const FRAMES_DIR = path.join("public", "frames");++// Measurements keyed by file and modification time: replacing a PNG re-measures it.+const cache = new Map<string, MeasuredFrame>();++/** Which Apple bezels the user has added to public/frames/, measured. */+export async function GET() {+ const frames: Partial<Record<FrameFile, MeasuredFrame>> = {};+ const errors: Partial<Record<FrameFile, string>> = {};+ await Promise.all(FRAME_FILES.map(async (name) => {+ const file = path.join(process.cwd(), FRAMES_DIR, `${name}.png`);+ try {+ const stat = await fs.stat(file);+ const version = Math.round(stat.mtimeMs).toString(36);+ const key = `${name}:${version}:${stat.size}`;+ let frame = cache.get(key);+ if (!frame) {+ frame = await measureFrame(await fs.readFile(file), `/frames/${name}.png?v=${version}`);+ cache.set(key, frame);+ }+ frames[name] = frame;+ } catch (error) {+ if ((error as NodeJS.ErrnoException).code === "ENOENT") return;+ errors[name] = `public/frames/${name}.png: ${error instanceof Error ? error.message : String(error)}`;+ }+ }));+ return NextResponse.json({ ok: true, frames, errors }, { headers: { "Cache-Control": "no-store" } });+}diff --git a/skills/app-store-screenshots/template/src/app/frames/[filename]/route.ts b/skills/app-store-screenshots/template/src/app/frames/[filename]/route.tsnew file mode 100644index 0000000..7deb283--- /dev/null+++ b/skills/app-store-screenshots/template/src/app/frames/[filename]/route.ts@@ -0,0 +1,29 @@+import { promises as fs } from "node:fs";+import path from "node:path";+import { NextResponse } from "next/server";+import { FRAME_FILES } from "@/lib/frame-assets";++export const dynamic = "force-dynamic";++// Served at runtime: Next's production public-file index only covers files+// that existed at build time, and bezels are added by the user afterwards.+export async function GET(_req: Request, context: { params: Promise<{ filename: string }> }) {+ const { filename } = await context.params;+ const name = filename.replace(/\.png$/, "");+ if (!filename.endsWith(".png") || !(FRAME_FILES as readonly string[]).includes(name)) {+ return new NextResponse(null, { status: 404 });+ }+ try {+ const bytes = await fs.readFile(path.join(process.cwd(), "public", "frames", filename));+ return new NextResponse(new Uint8Array(bytes), { headers: {+ "Content-Type": "image/png",+ "Content-Length": String(bytes.length),+ // The URL carries ?v=<mtime>, so a replaced file gets a new URL.+ "Cache-Control": "public, max-age=31536000, immutable",+ "X-Content-Type-Options": "nosniff",+ } });+ } catch (error) {+ if ((error as NodeJS.ErrnoException).code === "ENOENT") return new NextResponse(null, { status: 404 });+ return NextResponse.json({ ok: false, error: "Frame could not be read" }, { status: 500 });+ }+}diff --git a/skills/app-store-screenshots/template/src/app/globals.css b/skills/app-store-screenshots/template/src/app/globals.cssindex 06e9603..beff28e 100644--- a/skills/app-store-screenshots/template/src/app/globals.css+++ b/skills/app-store-screenshots/template/src/app/globals.css@@ -59,7 +59,11 @@-moz-osx-font-smoothing: grayscale;}- [contenteditable]:empty::before {+ /* Hints only where the text can be edited. Export and thumbnail canvases+ render contenteditable="false", and html-to-image copies pseudo-elements,+ so a bare [contenteditable] selector baked "LABEL" and "Headline goes+ here" into exported PNGs of cleared copy (issue 41). */+ [contenteditable]:not([contenteditable="false"]):empty::before {content: attr(data-placeholder);opacity: 0.4;}diff --git a/skills/app-store-screenshots/template/src/components/editor/device-frames.tsx b/skills/app-store-screenshots/template/src/components/editor/device-frames.tsxindex f618291..256597c 100644--- a/skills/app-store-screenshots/template/src/components/editor/device-frames.tsx+++ b/skills/app-store-screenshots/template/src/components/editor/device-frames.tsx@@ -1,7 +1,9 @@"use client";import * as React from "react";import { MAC_RATIO, MAC_TITLE_BAR, PHONE_SCREEN } from "@/lib/constants";-import { img } from "@/lib/image-cache";+import { bezelGeometry, type DuoDevice } from "@/lib/frame-assets";+import type { Device } from "@/lib/types";+import { img, imgSize } from "@/lib/image-cache";type FrameProps = {src: string;@@ -344,6 +346,150 @@ export function IPad({ src, alt = "", style, hideEmpty }: FrameProps) {);}+// ---------- iPhone Duo ----------+// Geometry comes from the user's own copy of Apple's bezel (measured by+// /api/frames) or, without one, a drawn frame whose screen has the capture's+// exact aspect. The frame fits itself inside whatever box it is given, so a+// placement saved before a bezel was added never stretches it.++// A capture whose aspect is off by more than this is letterboxed rather than+// cropped: cropping would cut real UI, which is worse than a visible bar.+const FIT_TOLERANCE = 0.03;++export function captureFits(src: string, screenAspect: number) {+ const size = imgSize(src);+ return !size || Math.abs(size.w / size.h / screenAspect - 1) <= FIT_TOLERANCE;+}++// A device drawn under Apple's bezel (or, for iPhone Duo without one, a drawn+// stand-in). Mac captures are 16:10 but MacBook screens are a little taller, so+// a Mac capture fills the screen from the top and loses a sliver at the bottom,+// like the built-in Mac window; everything else is letterboxed if it doesn't fit.+function BezelFrame({ device, src, alt = "", style, hideEmpty }: FrameProps & { device: Device }) {+ const g = bezelGeometry(device);+ if (!g) return null;+ const resolved = img(src);+ const frameRadius = `${(g.radius.x * g.screen.W) / 100 + g.screen.L}% / ${(g.radius.y * g.screen.H) / 100 + g.screen.T}%`;+ return (+ <div+ style={{+ position: "relative",+ aspectRatio: `${g.aspect}`,+ ...style,+ containerType: "size",+ display: "flex",+ alignItems: "center",+ justifyContent: "center",+ }}+ >+ <div style={{ position: "relative", width: `min(100cqw, calc(100cqh * ${g.aspect}))`, aspectRatio: `${g.aspect}` }}>+ {!g.image && (+ <div+ style={{+ position: "absolute",+ inset: 0,+ borderRadius: frameRadius,+ background: "linear-gradient(160deg, #3a3a3e 0%, #1b1b1e 45%, #2a2a2e 100%)",+ boxShadow: "inset 0 0 0 1px rgba(255,255,255,0.14), inset 0 0 0 3px rgba(0,0,0,0.5), 0 10px 44px rgba(0,0,0,0.45)",+ }}+ />+ )}+ <div+ style={{+ position: "absolute",+ left: `${g.screen.L}%`,+ top: `${g.screen.T}%`,+ width: `${g.screen.W}%`,+ height: `${g.screen.H}%`,+ borderRadius: g.clip ?? `${g.radius.x}% / ${g.radius.y}%`,+ overflow: "hidden",+ background: "#000",+ containerType: "size",+ }}+ >+ {resolved ? (+ <img+ src={resolved}+ alt={alt}+ style={{+ display: "block",+ width: "100%",+ height: "100%",+ objectFit: device === "mac" || captureFits(src, g.screenAspect) ? "cover" : "contain",+ objectPosition: device === "mac" ? "top" : "center",+ }}+ draggable={false}+ />+ ) : hideEmpty ? null : (+ <EmptySlot />+ )}+ {!g.image && g.camera === "corner" && (+ // The outer display's front camera, where Apple's bezels put it: top+ // right in portrait, top left once the closed phone is turned.+ <div+ aria-hidden+ style={{+ position: "absolute",+ top: "3.4cqmin",+ ...(g.screenAspect > 1 ? { left: "3.4cqmin" } : { right: "3.4cqmin" }),+ width: "5.6cqmin",+ height: "5.6cqmin",+ background: "#050506",+ borderRadius: 999,+ pointerEvents: "none",+ }}+ />+ )}+ </div>+ {g.image && (+ // The real bezel sits over the screen; its transparent cutout shows it.+ <img+ src={img(g.image.src)}+ alt=""+ data-export-check="full"+ draggable={false}+ style={+ g.image.rotate+ ? {+ position: "absolute",+ left: "50%",+ top: "50%",+ width: `${100 / g.aspect}%`,+ height: `${100 * g.aspect}%`,+ transform: "translate(-50%, -50%) rotate(-90deg)",+ pointerEvents: "none",+ }+ : { position: "absolute", inset: 0, width: "100%", height: "100%", pointerEvents: "none" }+ }+ />+ )}+ </div>+ </div>+ );+}++// One stable component per target, so switching decks doesn't remount frames.+export const DUO_FRAMES: Record<DuoDevice, React.ComponentType<FrameProps>> = {+ "duo-outer": (props) => <BezelFrame device="duo-outer" {...props} />,+ "duo-outer-landscape": (props) => <BezelFrame device="duo-outer-landscape" {...props} />,+ "duo-inner": (props) => <BezelFrame device="duo-inner" {...props} />,+ "duo-inner-landscape": (props) => <BezelFrame device="duo-inner-landscape" {...props} />,+};++const bezelFrames = new Map<Device, React.ComponentType<FrameProps>>();++/** The stable bezel frame component for a device (used once its bezel is measured). */+export function bezelFrameFor(device: Device): React.ComponentType<FrameProps> {+ let frame = bezelFrames.get(device);+ if (!frame) {+ const Component = (props: FrameProps) => <BezelFrame device={device} {...props} />;+ Component.displayName = `BezelFrame(${device})`;+ frame = Component;+ bezelFrames.set(device, frame);+ }+ return frame;+}+function EmptySlot() {// Sized off the slot's own width (container query units) so the hint stays// readable on a 4K TV canvas and still fits inside a 422 px watch face.diff --git a/skills/app-store-screenshots/template/src/components/editor/inspector.tsx b/skills/app-store-screenshots/template/src/components/editor/inspector.tsxindex fc10c7f..e4c03e7 100644--- a/skills/app-store-screenshots/template/src/components/editor/inspector.tsx+++ b/skills/app-store-screenshots/template/src/components/editor/inspector.tsx@@ -35,7 +35,8 @@ import {SelectValue,} from "@/components/ui/select";import { Textarea } from "@/components/ui/textarea";-import { LAYOUT_HINT, LAYOUT_LABEL } from "@/lib/constants";+import { CANVAS, DEVICE_LABEL, LAYOUT_LABEL, isCreative, layoutHint, layoutLabel } from "@/lib/constants";+import { DUO_COMPANION, duoGeometry, isDuoDevice } from "@/lib/frame-assets";import { COPY_IDEA_SLOTS } from "@/lib/copy-ideas";import { nid } from "@/lib/defaults";import { img } from "@/lib/image-cache";@@ -48,7 +49,7 @@ import {textElementKey,toTextElementId,} from "@/lib/elements";-import { pickText, writeLocalized } from "@/lib/locale";+import { pickText, resolveScreenshot, writeLocalized } from "@/lib/locale";import { slideColors } from "@/lib/contrast";import { cn } from "@/lib/utils";import {@@ -76,6 +77,7 @@ import type {import { BackgroundControls } from "./background-controls";import { ScreenshotPicker } from "./screenshot-picker";import { CalloutControls } from "./callout-controls";+import { captureFits } from "./device-frames";import { calloutAvailable, getCanvas, getElementTransform } from "./slide-canvas";type Props = {@@ -116,9 +118,11 @@ export function Inspector({const isFeatureGraphic = device === "feature-graphic" || slide.layout === "feature-graphic";const isNoDevice = slide.layout === "no-device";const layoutValue = device === "feature-graphic" ? "feature-graphic" : slide.layout;- const layoutOptions = Object.entries(LAYOUT_LABEL).filter(([layout]) =>- device === "feature-graphic" ? layout === "feature-graphic" : layout !== "feature-graphic",- );+ const layoutOptions = (Object.keys(LAYOUT_LABEL) as SlideLayout[])+ .filter((layout) => (device === "feature-graphic" ? layout === "feature-graphic" : layout !== "feature-graphic"))+ .map((layout) => [layout, layoutLabel(layout, device)] as const);+ // On iPhone Duo the back device is the other display, so it needs its own capture.+ const companion = isDuoDevice(device) ? DUO_COMPANION[device] : null;const localeLabel = slide.label?.[locale] ?? "";const localeHeadline = slide.headline?.[locale] ?? "";// When the active locale is empty, surface the fallback (typically en) as@@ -142,7 +146,7 @@ export function Inspector({editing · {locale.toUpperCase()}</span></div>- <p className="text-xs text-muted-foreground">{LAYOUT_HINT[layoutValue]}</p>+ <p className="text-xs text-muted-foreground">{layoutHint(layoutValue, device)}</p></div><div className="flex-1 space-y-4 overflow-y-auto p-3">@@ -156,7 +160,9 @@ export function Inspector({layout: next,transforms: undefined,screenshotSecondary:- next === "two-devices" ? slide.screenshotSecondary || slide.screenshot : slide.screenshotSecondary,+ next === "two-devices" && !companion+ ? slide.screenshotSecondary || slide.screenshot+ : slide.screenshotSecondary,});}}>@@ -173,6 +179,16 @@ export function Inspector({</Select></div>+ {isCreative(device) && (+ <p className="rounded-md border border-green-600/30 bg-green-600/5 p-2 text-[11px] leading-relaxed text-muted-foreground">+ Keep the message and focal art inside the green <span className="font-medium text-foreground">art safe area</span>+ {device === "creative-universal"+ ? "; the backdrop fills the rest. One universal asset is used for both the product page header and search results. The dashed crops are estimates. Check the real result with App Store Connect's Preview tool."+ : "; the backdrop fills the rest."}{" "}+ Write a short brand line here; don't reuse a long screenshot headline.+ </p>+ )}+<BackgroundControls slide={isFeatureGraphic ? { ...slide, inverted: slide.inverted ?? true } : slide} theme={theme} onChange={onChange} />{!isFeatureGraphic && (@@ -217,18 +233,24 @@ export function Inspector({locale={locale}onChange={(v) => onChange({ screenshot: v })}/>+ <CaptureNote device={device} src={resolveScreenshot(slide.screenshot, locale)} /></div>)}{slide.layout === "two-devices" && (<div className="space-y-1.5">- <Label className="text-xs">Back device screenshot</Label>+ <Label className="text-xs">+ {companion ? `${DEVICE_LABEL[companion]} screenshot` : "Back device screenshot"}+ </Label><ScreenshotPicker- label="Secondary (back layer)"+ label={companion ? DEVICE_LABEL[companion] : "Secondary (back layer)"}value={slide.screenshotSecondary || ""}locale={locale}onChange={(v) => onChange({ screenshotSecondary: v })}/>+ {companion && (+ <CaptureNote device={companion} src={resolveScreenshot(slide.screenshotSecondary, locale)} />+ )}</div>)}@@ -270,6 +292,20 @@ export function Inspector({);}+// iPhone Duo frames show a capture uncropped only when it came from that display.+function CaptureNote({ device, src }: { device: Device; src: string }) {+ if (!isDuoDevice(device)) return null;+ const { w, h } = CANVAS[device];+ const fits = !src || captureFits(src, duoGeometry(device).screenAspect);+ return (+ <p className={cn("text-[11px] leading-relaxed", fits ? "text-muted-foreground" : "text-amber-600")}>+ {fits+ ? `Use a ${w} × ${h} capture from the ${DEVICE_LABEL[device].replace(/ \(landscape\)$/, "")} display${device.endsWith("-landscape") ? " in landscape" : ""}.`+ : `This capture isn't ${w} × ${h} (${DEVICE_LABEL[device]}), so it is letterboxed, not cropped. Capture on that display.`}+ </p>+ );+}+function CopyIdeasMenu({ onPick }: { onPick: (formula: string) => void }) {return (<DropdownMenu>diff --git a/skills/app-store-screenshots/template/src/components/editor/preview-stage.tsx b/skills/app-store-screenshots/template/src/components/editor/preview-stage.tsxindex e4038a5..d2dc7fd 100644--- a/skills/app-store-screenshots/template/src/components/editor/preview-stage.tsx+++ b/skills/app-store-screenshots/template/src/components/editor/preview-stage.tsx@@ -2,7 +2,7 @@import * as React from "react";import { Maximize2, ZoomIn, ZoomOut } from "lucide-react";import { Button } from "@/components/ui/button";-import { DEVICE_LABEL, LAYOUT_LABEL } from "@/lib/constants";+import { CREATIVE_SPECS, DEVICE_LABEL, centredCrop, layoutLabel } from "@/lib/constants";import type {Device,ElementId,@@ -13,7 +13,7 @@ import type {Slide,Theme,} from "@/lib/types";-import { DeckCanvas, getCanvas } from "./slide-canvas";+import { DeckCanvas, SlideCanvas, getCanvas } from "./slide-canvas";type Props = {slides: Slide[];@@ -181,7 +181,7 @@ export function PreviewStage({<span aria-hidden>·</span><span>Screen {activeIndex + 1}</span><span aria-hidden>·</span>- <span>{LAYOUT_LABEL[activeSlide.layout]}</span>+ <span>{layoutLabel(activeSlide.layout, device)}</span></>)}{orientation === "landscape" && (@@ -198,6 +198,22 @@ export function PreviewStage({)}</div>+ {device === "creative-universal" && activeSlide && (+ <PlacementPreviews+ slide={activeSlide}+ index={activeIndex}+ count={slides.length}+ device={device}+ orientation={orientation}+ theme={theme}+ locale={locale}+ appName={appName}+ appIcon={appIcon}+ fontFamily={fontFamily}+ scene={scene}+ />+ )}+<div className="absolute bottom-4 right-4 flex items-center gap-1.5 rounded-md bg-background/85 px-1.5 py-1 text-[10px] tabular-nums text-muted-foreground shadow-sm backdrop-blur"><span className="px-1">{slides.length}× {cW}×{cH}</span><span aria-hidden className="text-border">|</span>@@ -244,3 +260,79 @@ export function PreviewStage({</div>);}++// How the active universal creative reads in each App Store placement, using+// the same estimated crops as the canvas guides. Rendered like an export.+function PlacementPreviews({+ slide,+ index,+ count,+ device,+ orientation,+ theme,+ locale,+ appName,+ appIcon,+ fontFamily,+ scene,+}: {+ slide: Slide;+ index: number;+ count: number;+ device: Device;+ orientation: Orientation;+ theme: Theme;+ locale: string;+ appName?: string;+ appIcon?: string;+ fontFamily: string;+ scene?: Scene;+}) {+ const { cW, cH } = getCanvas(device, orientation);+ const crops = device === "creative-universal" ? CREATIVE_SPECS[device].crops : [];+ return (+ <div+ aria-label="Placement previews"+ className="pointer-events-none absolute bottom-4 left-4 hidden items-end gap-3 rounded-md bg-background/85 p-2 shadow-sm backdrop-blur md:flex"+ >+ {crops.map((crop) => {+ const r = centredCrop(cW, cH, crop.aspect);+ const width = crop.aspect > 2 ? 240 : 150;+ const k = width / r.w;+ return (+ <figure key={crop.label} className="space-y-1">+ <div className="relative overflow-hidden rounded-sm ring-1 ring-black/10" style={{ width, height: r.h * k }}>+ <div+ style={{+ position: "absolute",+ left: 0,+ top: 0,+ width: cW,+ height: cH,+ transform: `scale(${k}) translate(${-r.x}px, ${-r.y}px)`,+ transformOrigin: "top left",+ }}+ >+ <SlideCanvas+ slide={slide}+ device={device}+ orientation={orientation}+ theme={theme}+ locale={locale}+ appName={appName}+ appIcon={appIcon}+ fontFamily={fontFamily}+ scene={scene}+ stripIndex={index}+ stripCount={count}+ hideEmpty+ />+ </div>+ </div>+ <figcaption className="text-[10px] text-muted-foreground">{crop.label.replace(" crop", "")} (estimated crop)</figcaption>+ </figure>+ );+ })}+ </div>+ );+}diff --git a/skills/app-store-screenshots/template/src/components/editor/scene-playground.tsx b/skills/app-store-screenshots/template/src/components/editor/scene-playground.tsxindex 4ef6499..78107e5 100644--- a/skills/app-store-screenshots/template/src/components/editor/scene-playground.tsx+++ b/skills/app-store-screenshots/template/src/components/editor/scene-playground.tsx@@ -19,11 +19,14 @@ export function ScenePlayground({scene: rawScene,theme,disabled,+ straightDevices,onChange,}: {scene: Scene | undefined;theme: Theme;disabled?: boolean;+ /** The open deck's devices ignore tilt (iPhone Duo). */+ straightDevices?: boolean;onChange: (scene: Scene | undefined) => void;}) {const scene = sceneOf(rawScene);@@ -130,6 +133,11 @@ export function ScenePlayground({<Slider label="Shadow" value={scene.shadow} min={0} max={100} unit="%" onChange={(shadow) => patch({ shadow })} /><Slider label="Glow" value={scene.glow} min={0} max={100} unit="%" onChange={(glow) => patch({ glow })} /><Slider label="Tilt" value={scene.tilt} min={-TILT_LIMIT} max={TILT_LIMIT} unit="°" onChange={(tilt) => patch({ tilt })} />+ {straightDevices && (+ <p className="text-[11px] leading-relaxed text-muted-foreground">+ iPhone Duo frames stay straight: Apple's guidelines ask for straight-on product images.+ </p>+ )}</Section><Section title="Headline">diff --git a/skills/app-store-screenshots/template/src/components/editor/screenshot-editor.tsx b/skills/app-store-screenshots/template/src/components/editor/screenshot-editor.tsxindex 93c914a..cd43ac4 100644--- a/skills/app-store-screenshots/template/src/components/editor/screenshot-editor.tsx+++ b/skills/app-store-screenshots/template/src/components/editor/screenshot-editor.tsx@@ -4,8 +4,11 @@ import JSZip from "jszip";import { Toaster, toast } from "sonner";import {DEFAULT_SCREENSHOT_FONT_ID,+ DEVICE_LABEL,+ deviceForOrientation,getExportSizes,hasTheme,+ orientationOf,IMPORTED_FONT_FAMILY,SCREENSHOT_FONTS,supportsLandscape,@@ -15,6 +18,7 @@ import { detectPlatform, nid } from "@/lib/defaults";import { imageElementKey, isBuiltInElementId, isImageElementId, isTextElementId, textElementKey } from "@/lib/elements";import { renderSlide } from "@/lib/export-render";import { exportAssetPaths } from "@/lib/export-assets";+import { DUO_COMPANION, duoGeometry, frameAssetPaths, isDuoDevice, setFrameAssets, type FrameFile, type MeasuredFrame } from "@/lib/frame-assets";import { didFail, preloadImages } from "@/lib/image-cache";import { resolveScreenshot, writeLocalized } from "@/lib/locale";import { useProject } from "@/lib/storage";@@ -32,6 +36,7 @@ import type {import { Inspector } from "./inspector";import { PreviewStage } from "./preview-stage";import { Sidebar } from "./sidebar";+import { captureFits } from "./device-frames";import { DeckCanvas, getCanvas } from "./slide-canvas";import { StyleLab } from "./style-lab";import { Toolbar } from "./toolbar";@@ -42,6 +47,7 @@ export function ScreenshotEditor() {const [selectedElement, setSelectedElement] = React.useState<SelectedElement | null>(null);const [exporting, setExporting] = React.useState<string | null>(null);const [ready, setReady] = React.useState(false);+ const framesLoaded = useFrameAssets();const [, refreshAssets] = React.useReducer((version: number) => version + 1, 0);const [exportLocaleOverride, setExportLocaleOverride] = React.useState<string | null>(null);const [exportSlideIndex, setExportSlideIndex] = React.useState(0);@@ -77,8 +83,10 @@ export function ScreenshotEditor() {}, [hydrated, currentSlides, activeSlideId]);React.useEffect(() => {- if (!supportsLandscape(state.device) && state.orientation !== "portrait") {- setState((p) => ({ ...p, orientation: "portrait" }), { history: false });+ // Undo can restore a device whose orientation differs from the current one.+ const expected = supportsLandscape(state.device) ? orientationOf(state.device, state.orientation) : "portrait";+ if (state.orientation !== expected) {+ setState((p) => ({ ...p, orientation: expected }), { history: false });}}, [state.device, state.orientation, setState]);@@ -94,6 +102,9 @@ export function ScreenshotEditor() {const assetPaths = React.useMemo(() => {const paths = new Set<string>();paths.add("/mockup.png");+ // Only the open deck's bezel: each is a large PNG, and export preloads its+ // own device's bezel before capturing.+ for (const path of frameAssetPaths(state.device)) paths.add(path);if (state.appIcon) paths.add(state.appIcon);// Preload every locale variant so bulk export doesn't race image loads.const allSlides: Slide[] = Object.values(state.slidesByDevice).flat();@@ -111,11 +122,13 @@ export function ScreenshotEditor() {}}return Array.from(paths).sort();- }, [state.slidesByDevice, state.appIcon, state.locales]);+ }, [state.slidesByDevice, state.appIcon, state.locales, state.device, framesLoaded]);const assetSig = assetPaths.join("|");React.useEffect(() => {- if (!hydrated) return;+ // Wait for the bezel measurements, so the first paint already has the+ // open deck's bezel cached instead of swapping it in under the user.+ if (!hydrated || !framesLoaded) return;let cancelled = false;preloadImages(assetPaths).finally(() => {if (!cancelled) { setReady(true); refreshAssets(); }@@ -124,7 +137,7 @@ export function ScreenshotEditor() {// assetPaths is derived from assetSig; depending on the string keeps the// effect from re-firing when slidesByDevice churns without path changes.// eslint-disable-next-line react-hooks/exhaustive-deps- }, [hydrated, assetSig]);+ }, [hydrated, framesLoaded, assetSig]);// Surface storage failures (quota exceeded etc.) so the user knows their work isn't safe.React.useEffect(() => {@@ -454,19 +467,38 @@ export function ScreenshotEditor() {}await waitForPaint();+ const device = state.device;+ // On iPhone Duo the back device is the other display: it never reuses the+ // front capture, so a missing one leaves that device empty.+ const duoPair = (slide: Slide) => isDuoDevice(device) && slide.layout === "two-devices";const missingScreens = currentSlides.map((slide, index) => ({ slide, index }))- .filter(({ slide }) => slideNeedsScreenshot(state.device, slide) && !slide.screenshot);+ .filter(({ slide }) =>+ slideNeedsScreenshot(device, slide) && (!slide.screenshot || (duoPair(slide) && !slide.screenshotSecondary)),+ );const reusedBackScreens = currentSlides.map((slide, index) => ({ slide, index })).filter(({ slide }) =>- state.device !== "feature-graphic" &&+ device !== "feature-graphic" &&slide.layout === "two-devices" &&+ !duoPair(slide) &&slide.screenshot &&!slide.screenshotSecondary,);- if (missingScreens.length > 0 || reusedBackScreens.length > 0) {+ // A capture from another display is letterboxed inside a Duo frame, never+ // cropped or stretched, so name it rather than let it pass unnoticed.+ const fitsDisplay = (raw: string | undefined, display: Device) =>+ !raw || !isDuoDevice(display) ||+ locales.every((loc) => captureFits(resolveScreenshot(raw, loc), duoGeometry(display).screenAspect));+ const mismatched = isDuoDevice(device)+ ? currentSlides.filter((slide) =>+ slideNeedsScreenshot(device, slide) &&+ (!fitsDisplay(slide.screenshot, device) ||+ (slide.layout === "two-devices" && !fitsDisplay(slide.screenshotSecondary, DUO_COMPANION[device]))),+ ).length+ : 0;+ if (missingScreens.length > 0 || reusedBackScreens.length > 0 || mismatched > 0) {const details = [missingScreens.length? `${missingScreens.length} screen${missingScreens.length === 1 ? "" : "s"} will export with an empty device.`@@ -474,8 +506,11 @@ export function ScreenshotEditor() {reusedBackScreens.length? `${reusedBackScreens.length} two-device screen${reusedBackScreens.length === 1 ? "" : "s"} will reuse the primary screenshot in back.`: null,+ mismatched+ ? `${mismatched} screen${mismatched === 1 ? "" : "s"} use${mismatched === 1 ? "s" : ""} a capture that doesn't match its iPhone Duo display, so it is letterboxed. Capture on that display.`+ : null,].filter(Boolean);- toast.warning("Export includes placeholder screenshots", {+ toast.warning(missingScreens.length || reusedBackScreens.length ? "Export includes placeholder screenshots" : "Check these screenshots", {description: details.join(" "),duration: 7000,});@@ -647,7 +682,7 @@ export function ScreenshotEditor() {// ---------- Render ----------- if (!hydrated || !ready) {+ if (!hydrated || !ready || !framesLoaded) {return (<div className="flex h-screen items-center justify-center"><div className="flex flex-col items-center gap-2 text-muted-foreground">@@ -684,9 +719,11 @@ export function ScreenshotEditor() {setLocale={(v) => setState((p) => ({ ...p, locale: v }), { history: false })}locales={state.locales}device={state.device}- setDevice={(v) => setState((p) => ({ ...p, device: v }), { history: false })}+ setDevice={(v) => setState((p) => ({ ...p, device: v, orientation: orientationOf(v, p.orientation) }), { history: false })}orientation={state.orientation}- setOrientation={(v) => setState((p) => ({ ...p, orientation: v }), { history: false })}+ // A Duo orientation is its own deck: switching opens it rather than+ // re-laying out the current one, so both compositions survive.+ setOrientation={(v) => setState((p) => ({ ...p, orientation: v, device: deviceForOrientation(p.device, v) }), { history: false })}onExport={exportAll}onResetAll={() => {reset();@@ -896,6 +933,39 @@ function useImportedFontFace(font: ImportedFont | undefined) {}, [font?.src, font?.format]);}+// Measures any Apple bezels the user added to public/frames/ before the+// first Duo frame renders. Missing files are normal; the drawn frame is used.+function useFrameAssets() {+ const [loaded, setLoaded] = React.useState(false);+ React.useEffect(() => {+ let cancelled = false;+ void (async () => {+ try {+ const resp = await fetch("/api/frames", { cache: "no-store", signal: AbortSignal.timeout(15000) });+ const json = (await resp.json()) as {+ ok: boolean;+ frames?: Partial<Record<FrameFile, MeasuredFrame>>;+ errors?: Partial<Record<FrameFile, string>>;+ };+ if (cancelled) return;+ setFrameAssets(json.frames ?? {});+ const errors = Object.values(json.errors ?? {});+ if (errors.length) {+ toast.warning("A device bezel couldn't be used", {+ description: `${errors.join("\n")}\nThe drawn frame is shown instead.`,+ duration: 12000,+ });+ }+ } catch {+ // No frames route (e.g. a static build): the drawn frames still work.+ }+ if (!cancelled) setLoaded(true);+ })();+ return () => { cancelled = true; };+ }, []);+ return loaded;+}+function slugify(s: string) {return (sdiff --git a/skills/app-store-screenshots/template/src/components/editor/screenshot-picker.tsx b/skills/app-store-screenshots/template/src/components/editor/screenshot-picker.tsxindex 951e6f8..64f83db 100644--- a/skills/app-store-screenshots/template/src/components/editor/screenshot-picker.tsx+++ b/skills/app-store-screenshots/template/src/components/editor/screenshot-picker.tsx@@ -77,11 +77,13 @@ export function ScreenshotPicker({ label, value, locale, onChange }: Props) {return;}if (request !== requestId.current) return;+ let size: { w: number; h: number };try {const image = new Image();image.src = dataUrl;await image.decode();if (image.naturalWidth * image.naturalHeight > 64 * 1024 * 1024) throw new Error("too large");+ size = { w: image.naturalWidth, h: image.naturalHeight };} catch {if (request === requestId.current) setError("Image is corrupt or exceeds 64 megapixels");return;@@ -103,10 +105,10 @@ export function ScreenshotPicker({ label, value, locale, onChange }: Props) {if (request !== requestId.current) return;setUploading(false);if (uploadedPath) {- setImage(uploadedPath, dataUrl);+ setImage(uploadedPath, dataUrl, size);onChange(uploadedPath);} else {- setImage(dataUrl, dataUrl);+ setImage(dataUrl, dataUrl, size);onChange(dataUrl);}}diff --git a/skills/app-store-screenshots/template/src/components/editor/sidebar.tsx b/skills/app-store-screenshots/template/src/components/editor/sidebar.tsxindex 6690d5d..cc9e86a 100644--- a/skills/app-store-screenshots/template/src/components/editor/sidebar.tsx+++ b/skills/app-store-screenshots/template/src/components/editor/sidebar.tsx@@ -18,6 +18,7 @@ import {import { Plus } from "lucide-react";import { Button } from "@/components/ui/button";import type { Device, Orientation, Scene, Slide, Theme } from "@/lib/types";+import { isCreative } from "@/lib/constants";import { newSlide } from "@/lib/defaults";import { SlideThumb } from "./slide-thumb";@@ -131,7 +132,7 @@ export function Sidebar({newSlide(device === "feature-graphic"? "feature-graphic"- : device === "mac"+ : device === "mac" || device.endsWith("-landscape") || isCreative(device)? "split-landscape": "device-bottom",),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 931f430..d80366d 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@@ -18,6 +18,10 @@ import type {import {CANVAS,CARPLAY_RATIO,+ CREATIVE_SPECS,+ centredCrop,+ frameFitW,+ isCreative,IPAD_RATIO,MAC_RATIO,MK_RATIO,@@ -39,8 +43,11 @@ import { pickText, resolveScreenshot } from "@/lib/locale";import { relativeLuminance, slideColors } from "@/lib/contrast";import { defaultTextElementFontSize, slideFontScales } from "@/lib/typography";import { sceneOf } from "@/lib/scene";+import { DUO_COMPANION, bezelGeometry, duoGeometry, isDuoDevice, type DuoDevice } from "@/lib/frame-assets";import {AndroidPhone,+ bezelFrameFor,+ DUO_FRAMES,AppleTV,AppleWatch,CarPlayScreen,@@ -70,6 +77,9 @@ export function getCanvas(device: Device, orientation: Orientation) {// Aspect ratio (w/h) of each device frame — must match device-frames.tsxfunction getFrameAspect(device: Device, orientation: Orientation) {+ const bezel = bezelGeometry(device);+ if (bezel) return bezel.aspect;+ if (isCreative(device)) return MK_RATIO;switch (device) {case "iphone": return MK_RATIO;case "android": return 9 / 19.5;@@ -84,11 +94,50 @@ function getFrameAspect(device: Device, orientation: Orientation) {}}+// Height share and width clamps for a device under Apple's bezel; they match+// the built-in frame's width functions in constants.ts. The watch bezel+// includes its band, which takes nearly half its height; the band's top stays+// below a two-line headline.+const BEZEL_FIT: Partial<Record<Device, { height: number; clamp: number; small: number; smallHeight?: number }>> = {+ iphone: { height: 0.72, clamp: 0.84, small: 0.66 },+ ipad: { height: 0.72, clamp: 0.75, small: 0.6 },+ tvos: { height: 0.72, clamp: 0.58, small: 0.56 },+ watchos: { height: 0.66, clamp: 0.62, small: 0.5 },+ mac: { height: 0.58, clamp: 0.86, small: 0.46 },+ "creative-universal": { height: 0.62, clamp: 0.9, small: 0.7, smallHeight: 0.5 },+ "creative-header": { height: 0.62, clamp: 0.9, small: 0.7, smallHeight: 0.5 },+ "creative-search": { height: 0.62, clamp: 0.9, small: 0.7, smallHeight: 0.5 },+};+export function getFrameForDevice(device: Device, orientation: Orientation): {Comp: FrameComp;widthFn: (cW: number, cH: number) => number;smallWidthFn: (cW: number, cH: number) => number;} {+ if (isDuoDevice(device)) {+ // Sized from the frame's real aspect, so the squarer inner display gets a+ // wider device instead of a stretched iPhone placement.+ const aspect = duoGeometry(device).aspect;+ return aspect > 1+ ? { Comp: DUO_FRAMES[device], widthFn: frameFitW(aspect, 0.58, 0.86), smallWidthFn: frameFitW(aspect, 0.46, 0.7) }+ : { Comp: DUO_FRAMES[device], widthFn: frameFitW(aspect, 0.66, 0.84), smallWidthFn: frameFitW(aspect, 0.52, 0.66) };+ }+ // Apple's own bezel, when the user has added it: the same placements as the+ // built-in frame, sized from the bezel's real aspect.+ const bezel = bezelGeometry(device);+ if (bezel) {+ const fit = BEZEL_FIT[device] ?? BEZEL_FIT.iphone!;+ return {+ Comp: bezelFrameFor(device),+ widthFn: frameFitW(bezel.aspect, fit.height, fit.clamp),+ smallWidthFn: frameFitW(bezel.aspect, fit.smallHeight ?? fit.height, fit.small),+ };+ }+ // Creatives lay out inside their safe area (see getSlideGeometry), so these+ // fractions are of the safe area, not the canvas.+ if (isCreative(device)) {+ return { Comp: Phone, widthFn: frameFitW(MK_RATIO, 0.62, 0.9), smallWidthFn: frameFitW(MK_RATIO, 0.5, 0.7) };+ }switch (device) {case "iphone":return { Comp: Phone, widthFn: phoneW, smallWidthFn: phoneWSmall };@@ -226,7 +275,7 @@ function EditableText({// colours and fonts on the canvas while the export uses the plain copy.contentEditable={editable ? "plaintext-only" : false}suppressContentEditableWarning- data-placeholder={placeholder}+ data-placeholder={editable ? placeholder : undefined}onInput={handleInput}onFocus={() => onFocus?.()}onBlur={(e) => {@@ -275,6 +324,7 @@ function Caption({inverted,scene,onFocus,+ typeUnit,}: {cW: number;cH: number;@@ -287,12 +337,14 @@ function Caption({inverted?: boolean;scene: Scene;onFocus?: () => void;+ /** Typography unit; defaults to the canvas's shorter side. */+ typeUnit?: number;}) {const { fg, accent } = slideColors(theme, { inverted, backgroundColor: slide.backgroundColor });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);+ const unit = typeUnit ?? Math.min(cW, cH);return (// "start" rather than "left" so a left-set caption hugs the right edge in RTL.<div style={{ textAlign: align === "left" ? "start" : align, position: "relative", width: "100%" }}>@@ -481,6 +533,107 @@ function getDefaultRects(}}+// ---------- iPhone Duo placements ----------+//+// Duo decks get their own placements, modelled on the first published Duo sets+// and Apple's guidance (see iphone-duo.md in the skill):+// - Landscape canvases (inner display opened, outer turned) are about as wide as+// an iPad. A short headline runs across the top and the device is the hero,+// wide enough that the capture reads, rather than a phone-sized device beside+// a narrow column of copy.+// - "Two devices" becomes "Folded + open": the second device is the same phone in+// its other state, drawn in that display's frame. Opening an upright closed+// phone gives the inner display in landscape, at the same height, so that pair+// is drawn to physical scale side by side.+// Portrait decks keep the phone placements from getDefaultRects.++/** Width of the companion frame that matches a primary frame `primaryW` wide, to physical scale. */+function physicalCompanionW(device: DuoDevice, primaryW: number) {+ const companion = DUO_COMPANION[device];+ const p = duoGeometry(device);+ const c = duoGeometry(companion);+ // Both displays are captured at the same pixel density, so capture pixels scale alike.+ const canvasPerPixel = (primaryW * p.screen.W) / 100 / CANVAS[device].w;+ return (canvasPerPixel * CANVAS[companion].w) / (c.screen.W / 100);+}++function getDuoRects(layout: Slide["layout"], device: DuoDevice, cW: number, cH: number): LayoutRects | null {+ const fa = duoGeometry(device).aspect;+ const ca = duoGeometry(DUO_COMPANION[device]).aspect;+ const landscape = cW > cH;+ const topCaption = { x: cW * 0.06, y: cH * 0.06, width: cW * 0.88, height: cH * (landscape ? 0.18 : 0.2), align: "center" as const };++ if (layout === "two-devices") {+ if (landscape) {+ // Side by side, bottom-aligned: the companion leads on the left.+ const gap = cW * 0.03;+ const k = physicalCompanionW(device, 1);+ // Folded and open heights match for the upright pair; otherwise keep the+ // taller companion from crowding the headline.+ const w = Math.min((cW * 0.9 - gap) / (1 + k), cH * 0.66 * fa, (cH * 0.7 * ca) / k);+ const cw = w * k;+ const x0 = (cW - (w + gap + cw)) / 2;+ const bottom = cH * 0.95;+ return {+ caption: topCaption,+ deviceSecondary: { x: x0, y: bottom - cw / ca, width: cw, height: cw / ca },+ device: { x: x0 + cw + gap, y: bottom - w / fa, width: w, height: w / fa },+ };+ }+ if (device === "duo-outer") {+ // The opened phone sits behind, upper left; the closed one in front, lower right.+ const cw = cW * 0.86;+ const w = Math.min(cW * 0.46, cH * 0.42 * fa);+ return {+ caption: topCaption,+ deviceSecondary: { x: cW * 0.04, y: cH * 0.27, width: cw, height: cw / ca },+ device: { x: cW - w - cW * 0.05, y: cH * 0.97 - w / fa, width: w, height: w / fa },+ };+ }+ // Inner portrait: the closed phone is short and wide, so the pair stands side+ // by side, bottom-aligned, with the open display leading in size.+ const gap = cW * 0.03;+ const cw = cW * 0.3;+ const w = cW * 0.62;+ const x0 = (cW - (cw + gap + w)) / 2;+ const bottom = cH * 0.95;+ return {+ caption: topCaption,+ deviceSecondary: { x: x0, y: bottom - cw / ca, width: cw, height: cw / ca },+ device: { x: x0 + cw + gap, y: bottom - w / fa, width: w, height: w / fa },+ };+ }++ if (!landscape) return null;+ switch (layout) {+ case "hero": {+ const w = cW * 0.82;+ return { caption: topCaption, device: { x: (cW - w) / 2, y: cH * 0.31, width: w, height: w / fa } };+ }+ case "device-bottom": {+ const h = cH * 0.64;+ return { caption: topCaption, device: { x: (cW - h * fa) / 2, y: cH * 0.96 - h, width: h * fa, height: h } };+ }+ case "device-top": {+ const w = cW * 0.82;+ const h = w / fa;+ return {+ caption: { ...topCaption, y: cH * 0.74 },+ device: { x: (cW - w) / 2, y: cH * 0.69 - h, width: w, height: h },+ };+ }+ case "split-landscape": {+ const w = Math.min(cW * 0.58, cH * 0.86 * fa);+ return {+ caption: { x: cW * 0.05, y: cH * 0.22, width: cW * 0.33, height: cH * 0.56, align: "left" },+ device: { x: cW - w - cW * 0.04, y: (cH - w / fa) / 2, width: w, height: w / fa },+ };+ }+ default:+ return null;+ }+}+function rectFor(id: BuiltInElementId,slide: Slide,@@ -501,25 +654,47 @@ function rectFor(// Devices whose frame must never be cropped by the canvas edge. A clipped TV,// head unit, watch face or Mac window reads as a mistake, not as a deliberate bleed.-const CONTAINED_DEVICES: ReadonlySet<Device> = new Set<Device>(["tvos", "watchos", "carplay", "mac"]);+// A landscape phone hanging off the bottom reads as cropped, so Duo landscape+// targets are contained too.+const CONTAINED_DEVICES: ReadonlySet<Device> = new Set<Device>([+ "tvos", "watchos", "carplay", "mac", "duo-outer-landscape", "duo-inner-landscape",+]);function getSlideGeometry(slide: Slide, device: Device, orientation: Orientation) {const { cW, cH } = getCanvas(device, orientation);const { Comp: Frame, widthFn, smallWidthFn } = getFrameForDevice(device, orientation);const frameAspect = getFrameAspect(device, orientation);+ if (isCreative(device)) {+ // Creatives compose inside Apple's art safe area, as if it were the canvas:+ // copy and focal device stay clear of every placement's crop while the+ // backdrop fills the whole asset. Devices are contained, so the focal+ // screen is never trimmed by a placement either.+ const { safe } = CREATIVE_SPECS[device];+ const local = getDefaultRects(+ slide.layout, safe.w, safe.h, frameAspect, widthFn(safe.w, safe.h), smallWidthFn(safe.w, safe.h), true,+ );+ const defaults: LayoutRects = Object.fromEntries(+ Object.entries(local).map(([id, rect]) => [id, { ...rect, x: rect.x + safe.x, y: rect.y + safe.y }]),+ );+ if (slide.callout && defaults.device) defaults.callout = defaultCalloutRect(defaults.device, cW, cH, Math.min(safe.w, safe.h));+ return { cW, cH, Frame, frameAspect, defaults, typeUnit: Math.min(safe.w, safe.h) * 1.15 };+ }const fwFrac = widthFn(cW, cH);const fwSmallFrac = smallWidthFn(cW, cH);- const defaults = getDefaultRects(+ const duo = isDuoDevice(device) ? getDuoRects(slide.layout, device, cW, cH) : null;+ const defaults = duo || getDefaultRects(slide.layout, cW, cH, frameAspect, fwFrac, fwSmallFrac,CONTAINED_DEVICES.has(device),);if (slide.callout && defaults.device) defaults.callout = defaultCalloutRect(defaults.device, cW, cH);- return { cW, cH, Frame, frameAspect, defaults };+ // Duo landscape copy runs across the top as one line, so it can be a size smaller.+ const typeUnit = duo && cW > cH ? cH * 0.86 : undefined;+ return { cW, cH, Frame, frameAspect, defaults, typeUnit };}// The loupe starts overlapping the device's upper right, inside the screen.-function defaultCalloutRect(device: Rect, cW: number, cH: number): Rect {- const size = Math.min(cW, cH) * 0.44;+function defaultCalloutRect(device: Rect, cW: number, cH: number, unit = Math.min(cW, cH)): Rect {+ const size = unit * 0.44;return {x: Math.min(cW - size - cW * 0.04, device.x + device.width * 0.58),y: Math.max(cH * 0.04, Math.min(cH - size * 1.04, device.y + device.height * 0.16)),@@ -803,6 +978,80 @@ export function DeckCanvas({</div>);})}++ {showGuides && isCreative(device) &&+ slides.map((slide, index) => (+ <CreativeGuide key={`${slide.id}-creative-guide`} device={device} cW={cW} cH={cH} left={index * cW} />+ ))}+ </div>+ );+}++// Editor-only overlay (never exported): Apple's art safe area, plus how the+// universal asset may be cropped in each placement.+function CreativeGuide({ device, cW, cH, left }: { device: Device; cW: number; cH: number; left: number }) {+ if (!isCreative(device)) return null;+ const { safe, crops } = CREATIVE_SPECS[device];+ const line = Math.max(3, cW * 0.0012);+ const tag = (text: string, color: string, outside = false): React.ReactNode => (+ <span+ style={{+ position: "absolute",+ left: 0,+ top: 0,+ transform: outside ? "translateY(-100%)" : undefined,+ background: color,+ color: "white",+ fontSize: Math.max(24, cW * 0.0075),+ fontWeight: 700,+ lineHeight: 1,+ padding: `${line * 2}px ${line * 3}px`,+ whiteSpace: "nowrap",+ fontFamily: "ui-sans-serif, system-ui, sans-serif",+ }}+ >+ {text}+ </span>+ );+ return (+ <div+ aria-hidden+ data-creative-guide+ style={{ position: "absolute", left, top: 0, width: cW, height: cH, pointerEvents: "none", zIndex: 1000 }}+ >+ {crops.map((crop) => {+ const r = centredCrop(cW, cH, crop.aspect);+ return (+ <div+ key={crop.label}+ style={{+ position: "absolute",+ left: r.x,+ top: r.y,+ width: r.w,+ height: r.h,+ outline: `${line}px dashed rgba(250, 204, 21, 0.9)`,+ outlineOffset: -line,+ }}+ >+ {tag(`${crop.label} (estimate)`, "rgba(161, 98, 7, 0.9)")}+ </div>+ );+ })}+ <div+ style={{+ position: "absolute",+ left: safe.x,+ top: safe.y,+ width: safe.w,+ height: safe.h,+ outline: `${line}px solid rgba(34, 197, 94, 0.95)`,+ outlineOffset: -line,+ background: "rgba(34, 197, 94, 0.06)",+ }}+ >+ {tag("Art safe area", "rgba(21, 128, 61, 0.95)", true)}+ </div></div>);}@@ -1031,7 +1280,7 @@ function SlideElements({}) {const screenshot = resolveScreenshot(slide.screenshot, locale);const screenshotSecondary = resolveScreenshot(slide.screenshotSecondary, locale);- const { cW, cH, Frame, frameAspect, defaults } = getSlideGeometry(slide, device, orientation);+ const { cW, cH, Frame, frameAspect, defaults, typeUnit } = getSlideGeometry(slide, device, orientation);const inverted = !!slide.inverted;const colors = slideColors(theme, slide);const captionRect = rectFor("caption", slide, defaults);@@ -1066,6 +1315,7 @@ function SlideElements({align={scene.captionAlign === "auto" ? captionRect.align || "center" : scene.captionAlign}inverted={inverted}scene={scene}+ typeUnit={typeUnit}onFocus={() => edit?.onSelectElement?.("caption")}/>);@@ -1099,7 +1349,14 @@ function SlideElements({);}+ // On iPhone Duo the back device is the same phone in its other state. Duo+ // frames also ignore the scene's tilt: Apple's marketing guidelines ask for+ // straight-on product images.+ const companion = isDuoDevice(device) ? DUO_COMPANION[device] : null;+function renderDevice(id: "device" | "deviceSecondary", rect: Rect, src: string, extraStyle?: React.CSSProperties) {+ const DeviceFrame = id === "deviceSecondary" && companion ? DUO_FRAMES[companion] : Frame;+ const aspect = id === "deviceSecondary" && companion ? duoGeometry(companion).aspect : frameAspect;const saved = slide.transforms?.[id];const rotation = saved?.rotation ?? 0;const zIndex = saved?.zIndex ?? (id === "deviceSecondary" ? 2 : 3);@@ -1121,14 +1378,14 @@ function SlideElements({}),)}- lockAspectRatio={frameAspect}+ lockAspectRatio={aspect}zIndex={zIndex}allowOverflowselected={selectedElementId === id}onSelect={() => edit?.onSelectElement?.(id)}>- <DeviceDepth scene={scene} cW={cW} accent={theme.accent}>- <Frame+ <DeviceDepth scene={companion ? { ...scene, tilt: 0 } : scene} cW={cW} accent={theme.accent}>+ <DeviceFramesrc={src}hideEmpty={hideEmpty}style={{ width: "100%", height: "100%", ...extraStyle }}@@ -1279,12 +1536,15 @@ function SlideElements({return (<>{secondaryRect &&- renderDevice(- "deviceSecondary",- secondaryRect,- screenshotSecondary || screenshot,- { opacity: 0.85 },- )}+ (companion+ // Another display's capture can't stand in for the companion's own.+ ? renderDevice("deviceSecondary", secondaryRect, screenshotSecondary)+ : renderDevice(+ "deviceSecondary",+ secondaryRect,+ screenshotSecondary || screenshot,+ { opacity: 0.85 },+ ))}{deviceRect && renderDevice("device", deviceRect, screenshot)}{renderCaption()}{calloutRect && deviceRect && renderCallout(calloutRect, deviceRect.width)}diff --git a/skills/app-store-screenshots/template/src/components/editor/slide-thumb.tsx b/skills/app-store-screenshots/template/src/components/editor/slide-thumb.tsxindex 9316e6f..1990ce1 100644--- a/skills/app-store-screenshots/template/src/components/editor/slide-thumb.tsx+++ b/skills/app-store-screenshots/template/src/components/editor/slide-thumb.tsx@@ -4,7 +4,7 @@ import { useSortable } from "@dnd-kit/sortable";import { CSS } from "@dnd-kit/utilities";import { Copy, GripVertical, Trash2 } from "lucide-react";import { Button } from "@/components/ui/button";-import { LAYOUT_LABEL } from "@/lib/constants";+import { layoutLabel } from "@/lib/constants";import { pickText } from "@/lib/locale";import type { Device, Orientation, Scene, Slide, Theme } from "@/lib/types";import { cn } from "@/lib/utils";@@ -147,7 +147,7 @@ export function SlideThumb({</div><div className="flex min-w-0 flex-1 flex-col"><span className="truncate text-[10px] uppercase tracking-wide text-muted-foreground">- {`Screen ${index + 1} · ${LAYOUT_LABEL[slide.layout]}`}+ {`Screen ${index + 1} · ${layoutLabel(slide.layout, device)}`}</span><span className="truncate text-sm font-medium leading-tight">{headline.split("\n")[0] || (diff --git a/skills/app-store-screenshots/template/src/components/editor/toolbar.tsx b/skills/app-store-screenshots/template/src/components/editor/toolbar.tsxindex ad8f54b..c31ccc4 100644--- a/skills/app-store-screenshots/template/src/components/editor/toolbar.tsx+++ b/skills/app-store-screenshots/template/src/components/editor/toolbar.tsx@@ -24,7 +24,10 @@ import {IMPORTED_FONT_FAMILY,PLATFORM_DEVICES,SCREENSHOT_FONTS,+ ORIENTATION_PAIRS,THEMES,+ deviceForOrientation,+ orientationOf,supportsLandscape,themeById,} from "@/lib/constants";@@ -88,7 +91,10 @@ export function Toolbar(props: Props) {const showLocale = props.locales.length > 1;const deviceLabel = DEVICE_LABEL[props.device];- const platformDevices = PLATFORM_DEVICES[platform];+ // Paired orientations share one picker entry; the Orientation menu switches.+ const pickerDevice = deviceForOrientation(props.device, "portrait");+ const platformDevices = PLATFORM_DEVICES[platform].filter((d) => deviceForOrientation(d, "portrait") === d);+ const orientation = orientationOf(props.device, props.orientation);const activeTheme = themeById(props.themeId);const fontImporter = React.useRef<FontImporterHandle>(null);@@ -146,7 +152,7 @@ export function Toolbar(props: Props) {<FlaskConical className="h-3.5 w-3.5" />Style Lab</Button>- <ScenePlayground scene={props.scene} theme={activeTheme} disabled={props.busy} onChange={props.setScene} />+ <ScenePlayground scene={props.scene} theme={activeTheme} disabled={props.busy} straightDevices={props.device.startsWith("duo-")} onChange={props.setScene} /><Select value={activeTheme.id} onValueChange={props.setThemeId} disabled={props.busy}><SelectTrigger className="h-8 w-40 text-xs" title="Theme" aria-label="Theme">@@ -219,12 +225,16 @@ export function Toolbar(props: Props) {{/* Mac has a single device, so the tab alone says which deck is open. */}{platformDevices.length > 1 && (<Select- value={props.device}- onValueChange={(v) => props.setDevice(v as Device)}+ value={pickerDevice}+ onValueChange={(v) => {+ // Moving between Duo displays keeps the orientation you're working in.+ const keep = ORIENTATION_PAIRS[props.device] ? orientation : "portrait";+ props.setDevice(deviceForOrientation(v as Device, keep));+ }}disabled={props.busy}><SelectTrigger className="h-8 w-36 text-xs" aria-label="Device" title="Device">- <SelectValue placeholder="Device">{deviceLabel}</SelectValue>+ <SelectValue placeholder="Device">{DEVICE_LABEL[pickerDevice]}</SelectValue></SelectTrigger><SelectContent>{platformDevices.map((d) => (@@ -236,7 +246,7 @@ export function Toolbar(props: Props) {{hasLandscape && (<Select- value={props.orientation}+ value={orientation}onValueChange={(v) => props.setOrientation(v as Orientation)}disabled={props.busy}>diff --git a/skills/app-store-screenshots/template/src/lib/constants.ts b/skills/app-store-screenshots/template/src/lib/constants.tsindex 108a502..5409388 100644--- a/skills/app-store-screenshots/template/src/lib/constants.ts+++ b/skills/app-store-screenshots/template/src/lib/constants.ts@@ -4,6 +4,12 @@ import type { Device, Orientation, Platform, ScreenshotFontId, SlideLayout, Themexport const CANVAS: Record<Device, { w: number; h: number; wL?: number; hL?: number }> = {iphone: { w: 1320, h: 2868 },ipad: { w: 2064, h: 2752 },+ // iPhone Duo, exactly as App Store Connect lists them (checked 7 Oct 2026).+ // The displays are not scalings of each other, so each is its own canvas.+ "duo-outer": { w: 1398, h: 2034 },+ "duo-outer-landscape": { w: 2034, h: 1398 },+ "duo-inner": { w: 2007, h: 2853 },+ "duo-inner-landscape": { w: 2853, h: 2007 },// Apple TV is 16:9 landscape-only. Design at 4K; 1920x1080 is a clean 2x downscale.tvos: { w: 3840, h: 2160 },// Apple Watch: design at the largest slot Apple accepts (Ultra 422x514) so every@@ -20,6 +26,10 @@ export const CANVAS: Record<Device, { w: number; h: number; wL?: number; hL?: nu"android-7": { w: 1200, h: 1920, wL: 1920, hL: 1200 },"android-10": { w: 1600, h: 2560, wL: 2560, hL: 1600 },"feature-graphic": { w: 1024, h: 500 },+ // App Store creative assets, the size of Apple's own templates.+ "creative-universal": { w: 5244, h: 2950 },+ "creative-header": { w: 3840, h: 1646 },+ "creative-search": { w: 3840, h: 2560 },};// ---------- Export sizes per device ----------@@ -36,6 +46,11 @@ export const EXPORT_SIZES: Record<Device, ExportSize[]> = {{ label: '13" iPad', w: 2064, h: 2752 },{ label: '12.9" iPad Pro', w: 2048, h: 2732 },],+ // App Store Connect lists exactly one size per Duo display and orientation.+ "duo-outer": [{ label: "Outer portrait", w: 1398, h: 2034 }],+ "duo-outer-landscape": [{ label: "Outer landscape", w: 2034, h: 1398 }],+ "duo-inner": [{ label: "Inner portrait", w: 2007, h: 2853 }],+ "duo-inner-landscape": [{ label: "Inner landscape", w: 2853, h: 2007 }],// App Store Connect display type APP_APPLE_TV. Verified 18 Aug 2026 via// `asc screenshots sizes --all`; these are the only accepted dimensions.tvos: [@@ -77,6 +92,14 @@ export const EXPORT_SIZES: Record<Device, ExportSize[]> = {"android-7": [{ label: '7" Portrait', w: 1200, h: 1920 }],"android-10": [{ label: '10" Portrait', w: 1600, h: 2560 }],"feature-graphic": [{ label: "Feature Graphic", w: 1024, h: 500 }],+ // One universal asset covers both the product page header and search results.+ "creative-universal": [{ label: "Universal", w: 5244, h: 2950 }],+ "creative-header": [{ label: "Header", w: 3840, h: 1646 }],+ // Search results take any 3:2 size from 1920x1280 to 3840x2560.+ "creative-search": [+ { label: "Search (3840 x 2560)", w: 3840, h: 2560 },+ { label: "Search (1920 x 1280)", w: 1920, h: 1280 },+ ],};// Landscape sizes (tablets only)@@ -85,8 +108,62 @@ export const EXPORT_SIZES_LANDSCAPE: Partial<Record<Device, ExportSize[]>> = {"android-10": [{ label: '10" Landscape', w: 2560, h: 1600 }],};+// Targets whose two orientations are separate decks (and separate devices),+// so portrait and landscape keep independent compositions.+export const ORIENTATION_PAIRS: Partial<Record<Device, Record<Orientation, Device>>> = {+ "duo-outer": { portrait: "duo-outer", landscape: "duo-outer-landscape" },+ "duo-outer-landscape": { portrait: "duo-outer", landscape: "duo-outer-landscape" },+ "duo-inner": { portrait: "duo-inner", landscape: "duo-inner-landscape" },+ "duo-inner-landscape": { portrait: "duo-inner", landscape: "duo-inner-landscape" },+};+export function supportsLandscape(device: Device): boolean {- return device in EXPORT_SIZES_LANDSCAPE;+ return device in EXPORT_SIZES_LANDSCAPE || device in ORIENTATION_PAIRS;+}++/** The device holding `device`'s deck in `orientation`; itself when orientation is just a canvas flip. */+export function deviceForOrientation(device: Device, orientation: Orientation): Device {+ return ORIENTATION_PAIRS[device]?.[orientation] ?? device;+}++/** Orientation a paired device is fixed to; otherwise the project's orientation. */+export function orientationOf(device: Device, orientation: Orientation): Orientation {+ const pair = ORIENTATION_PAIRS[device];+ if (!pair) return orientation;+ return pair.landscape === device ? "landscape" : "portrait";+}++export type CreativeDevice = "creative-universal" | "creative-header" | "creative-search";++export function isCreative(device: Device): device is CreativeDevice {+ return device.startsWith("creative-");+}++type Box = { x: number; y: number; w: number; h: number };++// "Art Safe Area" layer of Apple's static creative asset templates, measured in+// canvas pixels from the Photoshop files linked on developer.apple.com/app-store/+// asset-best-practices (downloaded 7 Oct 2026). Keep focal art and copy inside.+// `crops` preview how the universal asset may be trimmed in each placement.+// Apple does not publish that crop, so these are centred cover crops at each+// placement's own aspect: guides only, never applied to the export.+export const CREATIVE_SPECS: Record<CreativeDevice, { safe: Box; crops: { label: string; aspect: number }[] }> = {+ "creative-universal": {+ safe: { x: 1921, y: 660, w: 1402, h: 962 },+ crops: [+ { label: "Header crop", aspect: 3840 / 1646 },+ { label: "Search crop", aspect: 3 / 2 },+ ],+ },+ "creative-header": { safe: { x: 1097, y: 493, w: 1646, h: 661 }, crops: [] },+ "creative-search": { safe: { x: 836, y: 765, w: 2168, h: 1030 }, crops: [] },+};++/** Centred cover crop of a `cW`×`cH` canvas at `aspect` (w/h). */+export function centredCrop(cW: number, cH: number, aspect: number): Box {+ const w = Math.min(cW, cH * aspect);+ const h = w / aspect;+ return { x: (cW - w) / 2, y: (cH - h) / 2, w, h };}export function getExportSizes(device: Device, orientation: Orientation): ExportSize[] {@@ -114,6 +191,10 @@ export const CARPLAY_RATIO = 800 / 480;export const MAC_TITLE_BAR = 0.045;export const MAC_RATIO = 16 / (10 * (1 + MAC_TITLE_BAR));+// iPhone Duo capture aspects (screen w/h), from the exact sizes above.+export const DUO_OUTER_SCREEN = 1398 / 2034;+export const DUO_INNER_SCREEN = 2007 / 2853;+// iPhone mockup screen overlay (pre-measured)export const PHONE_SCREEN = {L: (52 / 1022) * 100,@@ -151,6 +232,10 @@ export function watchW(cW: number, cH: number, clamp = 0.52) {export function carPlayW(cW: number, cH: number, clamp = 0.86) {return Math.min(clamp, 0.58 * (cH / cW) * CARPLAY_RATIO);}+// Width that makes a frame of `aspect` take `heightFrac` of the canvas height.+export function frameFitW(aspect: number, heightFrac: number, clamp: number) {+ return (cW: number, cH: number) => Math.min(clamp, heightFrac * (cH / cW) * aspect);+}// Contained like the TV: height-bound so the window clears the caption block// above or below it on the 16:10 canvas.export function macW(cW: number, cH: number, clamp = 0.86) {@@ -451,13 +536,20 @@ export function hasTheme(themeId: string | undefined): boolean {}export const STORAGE_KEY = "app-store-screenshots:project:v1";-export const PROJECT_SCHEMA_VERSION = 2;+// v3 adds the iPhone Duo and App Store creative decks. Older editors reject+// a v3 project instead of loading decks they cannot render.+export const PROJECT_SCHEMA_VERSION = 3;// Toolbar platform tabs, in menu order. The platform is also the top-level// export folder (ios/…, macos/…, android/…). Mac gets its own tab because App// Store Connect lists macOS as a separate platform with its own screenshot set.export const PLATFORM_DEVICES: Record<Platform, Device[]> = {- ios: ["iphone", "ipad", "tvos", "watchos", "carplay"],+ ios: [+ "iphone", "ipad",+ "duo-outer", "duo-outer-landscape", "duo-inner", "duo-inner-landscape",+ "tvos", "watchos", "carplay",+ "creative-universal", "creative-header", "creative-search",+ ],macos: ["mac"],android: ["android", "android-7", "android-10", "feature-graphic"],};@@ -465,6 +557,10 @@ export const PLATFORM_DEVICES: Record<Platform, Device[]> = {export const DEVICE_LABEL: Record<Device, string> = {iphone: "iPhone",ipad: "iPad",+ "duo-outer": "iPhone Duo outer",+ "duo-outer-landscape": "iPhone Duo outer (landscape)",+ "duo-inner": "iPhone Duo inner",+ "duo-inner-landscape": "iPhone Duo inner (landscape)",tvos: "Apple TV",watchos: "Apple Watch",carplay: "CarPlay (iPhone slot)",@@ -473,6 +569,9 @@ export const DEVICE_LABEL: Record<Device, string> = {"android-7": 'Android 7" Tablet',"android-10": 'Android 10" Tablet',"feature-graphic": "Feature Graphic",+ "creative-universal": "Creative: universal",+ "creative-header": "Creative: header",+ "creative-search": "Creative: search",};// Friendly labels for slide layouts (used in dropdowns)@@ -496,3 +595,17 @@ export const LAYOUT_HINT: Record<SlideLayout, string> = {"split-landscape": "Caption left, device right","feature-graphic": "1024×500 Play Store banner",};++// On iPhone Duo the second device is the same phone in its other state.+const DUO_PAIR_LABEL = "Folded + open";+const DUO_PAIR_HINT = "The same phone closed and opened, side by side";++/** Layout name for a device's deck. */+export function layoutLabel(layout: SlideLayout, device: Device): string {+ return layout === "two-devices" && device.startsWith("duo-") ? DUO_PAIR_LABEL : LAYOUT_LABEL[layout];+}++/** Layout description for a device's deck. */+export function layoutHint(layout: SlideLayout, device: Device): string {+ return layout === "two-devices" && device.startsWith("duo-") ? DUO_PAIR_HINT : LAYOUT_HINT[layout];+}diff --git a/skills/app-store-screenshots/template/src/lib/defaults.ts b/skills/app-store-screenshots/template/src/lib/defaults.tsindex 0e50a1a..80261fe 100644--- a/skills/app-store-screenshots/template/src/lib/defaults.ts+++ b/skills/app-store-screenshots/template/src/lib/defaults.ts@@ -133,6 +133,58 @@ function macStarter(): Slide[] {];}+// iPhone Duo. The outer display is a short, wide phone (1398 × 2034) and the+// inner display opens to about the shape of A-series paper (2853 × 2007), so+// each gets its own deck. Opening the phone held upright gives the inner display+// in landscape, so that deck leads; it opens on the two-pane view and pairs the+// closed and open phone. "Two devices" on a Duo deck is that folded + open pair.+// See iphone-duo.md beside SKILL.md.+function duoOuterStarter(): Slide[] {+ return [+ { id: nid(), layout: "hero", label: en("MEET YOUR APP"), headline: en("Everything,\none hand."), screenshot: "" },+ { id: nid(), layout: "device-bottom", label: en("FEATURE 01"), headline: en("One idea\nper screen."), screenshot: "" },+ { id: nid(), layout: "two-devices", label: en("OPEN IT"), headline: en("Open it for\nthe full view."), screenshot: "", screenshotSecondary: "" },+ { id: nid(), layout: "device-top", label: en("FEATURE 02"), headline: en("Flip the contrast."), screenshot: "", inverted: true },+ { id: nid(), layout: "no-device", label: en("MORE"), headline: en("And so\nmuch more."), screenshot: "" },+ ];+}++function duoOuterLandscapeStarter(): Slide[] {+ return [+ { id: nid(), layout: "hero", label: en("TURN IT"), headline: en("Made for the wide view."), screenshot: "" },+ { id: nid(), layout: "split-landscape", label: en("FEATURE 01"), headline: en("One idea\nper screen."), screenshot: "" },+ { id: nid(), layout: "device-top", label: en("FEATURE 02"), headline: en("Flip the contrast."), screenshot: "", inverted: true },+ ];+}++function duoInnerStarter(): Slide[] {+ return [+ { id: nid(), layout: "hero", label: en("UNFOLD IT"), headline: en("Room for\nthe whole view."), screenshot: "" },+ { id: nid(), layout: "device-bottom", label: en("FEATURE 01"), headline: en("One idea\nper screen."), screenshot: "" },+ { id: nid(), layout: "two-devices", label: en("FOLDED + OPEN"), headline: en("Turn it, open it,\nkeep going."), screenshot: "", screenshotSecondary: "" },+ { id: nid(), layout: "device-top", label: en("FEATURE 02"), headline: en("Flip the contrast."), screenshot: "", inverted: true },+ ];+}++// Landscape copy runs across the top in one line; the device is the hero.+function duoInnerLandscapeStarter(): Slide[] {+ return [+ { id: nid(), layout: "hero", label: en("UNFOLD IT"), headline: en("Lead with the two-pane view."), screenshot: "" },+ { id: nid(), layout: "two-devices", label: en("FOLDED + OPEN"), headline: en("Same moment, closed and open."), screenshot: "", screenshotSecondary: "" },+ { id: nid(), layout: "split-landscape", label: en("FEATURE 02"), headline: en("One idea\nper screen."), screenshot: "" },+ { id: nid(), layout: "device-top", label: en("FEATURE 03"), headline: en("Show what only the wide screen can."), screenshot: "", inverted: true },+ { id: nid(), layout: "no-device", label: en("MORE"), headline: en("And so much more."), screenshot: "" },+ ];+}++// App Store creatives: one short brand message each, never a screenshot+// headline. The layout sits inside Apple's art safe area.+function creativeStarter(): Slide[] {+ return [+ { id: nid(), layout: "split-landscape", label: en("NEW"), headline: en("Your app,\nat a glance."), screenshot: "" },+ ];+}+function fgStarter(): Slide[] {return [{@@ -167,6 +219,13 @@ export const DEFAULT_PROJECT: ProjectState = {"android-7": tabletStarter("7"),"android-10": tabletStarter("10"),"feature-graphic": fgStarter(),+ "duo-outer": duoOuterStarter(),+ "duo-outer-landscape": duoOuterLandscapeStarter(),+ "duo-inner": duoInnerStarter(),+ "duo-inner-landscape": duoInnerLandscapeStarter(),+ "creative-universal": creativeStarter(),+ "creative-header": creativeStarter(),+ "creative-search": creativeStarter(),},};diff --git a/skills/app-store-screenshots/template/src/lib/export-assets.ts b/skills/app-store-screenshots/template/src/lib/export-assets.tsindex 9486079..e2823e2 100644--- a/skills/app-store-screenshots/template/src/lib/export-assets.ts+++ b/skills/app-store-screenshots/template/src/lib/export-assets.ts@@ -1,3 +1,5 @@+import { isCreative } from "./constants";+import { frameAssetPaths } from "./frame-assets";import { resolveScreenshot } from "./locale";import type { ProjectState } from "./types";@@ -11,7 +13,9 @@ export function exportAssetPaths(state: ProjectState): string[] {continue;}if (slide.layout !== "no-device" || slide.transforms?.device || slide.transforms?.deviceSecondary) {- if (state.device === "iphone") add("/mockup.png");+ // Creatives draw the iPhone frame too.+ if (state.device === "iphone" || isCreative(state.device)) add("/mockup.png");+ for (const path of frameAssetPaths(state.device)) add(path);for (const locale of state.locales) {add(resolveScreenshot(slide.screenshot, locale));if (slide.layout === "two-devices" || slide.transforms?.deviceSecondary) {diff --git a/skills/app-store-screenshots/template/src/lib/frame-assets.ts b/skills/app-store-screenshots/template/src/lib/frame-assets.tsnew file mode 100644index 0000000..580d327--- /dev/null+++ b/skills/app-store-screenshots/template/src/lib/frame-assets.ts@@ -0,0 +1,195 @@+// Device frame geometry from Apple's product bezels.+//+// Apple's bezels (developer.apple.com/design/resources, Product Bezels) are+// licensed for making mock-ups of apps for Apple platforms, not for+// redistribution, so this repository does not ship them. Each user downloads the+// packs, accepts Apple's licence and copies the PNGs into public/frames/ (see+// README). /api/frames measures each PNG's transparent screen cutout and the+// editor draws the screenshot under the real bezel. Without a file, iPhone Duo+// uses a drawn frame whose screen has the exact capture aspect, and every other+// device keeps its built-in frame. Android and CarPlay never use Apple bezels.+import { DUO_INNER_SCREEN, DUO_OUTER_SCREEN } from "./constants";+import type { Device } from "./types";++export type DuoDevice = Extract<Device, `duo-${string}`>;++/** File names (without .png) looked for in public/frames/. */+export const FRAME_FILES = [+ "iphone-portrait",+ "ipad-portrait",+ "watch",+ "tv",+ "mac",+ "duo-outer-portrait",+ "duo-outer-landscape",+ "duo-inner-portrait",+ "duo-inner-landscape",+] as const;+export type FrameFile = (typeof FRAME_FILES)[number];++const DUO_SOURCES: Record<DuoDevice, { file: FrameFile; rotateFrom?: FrameFile }> = {+ "duo-outer": { file: "duo-outer-portrait" },+ "duo-outer-landscape": { file: "duo-outer-landscape", rotateFrom: "duo-outer-portrait" },+ "duo-inner": { file: "duo-inner-portrait" },+ "duo-inner-landscape": { file: "duo-inner-landscape", rotateFrom: "duo-inner-portrait" },+};++/**+ * Which file draws each device, and which portrait file can be turned instead.+ * App Store creatives show an iPhone, so they use the iPhone bezel.+ */+const FRAME_SOURCES: Partial<Record<Device, { file: FrameFile; rotateFrom?: FrameFile }>> = {+ iphone: { file: "iphone-portrait" },+ ipad: { file: "ipad-portrait" },+ watchos: { file: "watch" },+ tvos: { file: "tv" },+ mac: { file: "mac" },+ "creative-universal": { file: "iphone-portrait" },+ "creative-header": { file: "iphone-portrait" },+ "creative-search": { file: "iphone-portrait" },+ ...DUO_SOURCES,+};++type PixelRect = { x: number; y: number; w: number; h: number };++/** A bezel PNG measured by /api/frames: its size and transparent screen cutout. */+export type MeasuredFrame = {+ src: string;+ width: number;+ height: number;+ screen: PixelRect;+ /** Largest corner radius of the cutout in image pixels. */+ radius: number;+ /** Each corner's radius in image pixels: top-left, top-right, bottom-right, bottom-left. */+ radii?: [number, number, number, number];+};++export type FrameGeometry = {+ /** Frame width / height. */+ aspect: number;+ /** Screen rect as percentages of the frame. */+ screen: { L: number; T: number; W: number; H: number };+ /** Screen corner radius as percentages of the screen's width and height. */+ radius: { x: number; y: number };+ /** CSS border-radius clipping the capture to a bezel cutout whose corners differ. */+ clip?: string;+ /** Screen width / height. */+ screenAspect: number;+ /** The real bezel, drawn over the screen. `rotate` turns a portrait file to landscape. */+ image?: { src: string; rotate: boolean };+ /**+ * Camera drawn on the stand-in frame. The outer display has a front camera in+ * its top trailing corner; the inner display's FaceTime camera sits under the+ * screen, so nothing is drawn there (nor a crease: captures show none).+ */+ camera: "corner" | "none";+};++let measured: Partial<Record<FrameFile, MeasuredFrame>> = {};++/** Install the frames measured by /api/frames. Call before rendering any deck. */+export function setFrameAssets(next: Partial<Record<FrameFile, MeasuredFrame>>) {+ measured = { ...next };+}++/** Bezel image URLs in use, so they can be preloaded for export. */+export function frameAssetPaths(device?: Device): string[] {+ // A Duo deck also draws its companion display in "Folded + open".+ const devices = (device+ ? isDuoDevice(device) ? [device, DUO_COMPANION[device]] : [device]+ : Object.keys(FRAME_SOURCES)) as Device[];+ return devices.flatMap((d) => {+ const image = bezelGeometry(d)?.image;+ return image ? [image.src] : [];+ });+}++export function isDuoDevice(device: Device): device is DuoDevice {+ return Object.hasOwn(DUO_SOURCES, device);+}++/**+ * Frame geometry for a device drawn under an Apple bezel: always for iPhone Duo+ * (measured or drawn), otherwise only when the user has added that bezel.+ */+export function bezelGeometry(device: Device): FrameGeometry | null {+ if (isDuoDevice(device)) return duoGeometry(device);+ const source = FRAME_SOURCES[device];+ const frame = source && measured[source.file];+ return frame ? fromMeasured(frame, false, "none") : null;+}++export function duoGeometry(device: DuoDevice): FrameGeometry {+ const { file, rotateFrom } = DUO_SOURCES[device];+ const inner = device.startsWith("duo-inner");+ const camera = inner ? "none" : "corner";+ const direct = measured[file];+ if (direct) return fromMeasured(direct, false, camera);+ const turned = rotateFrom ? measured[rotateFrom] : undefined;+ if (turned) return fromMeasured(turned, true, camera);+ const portrait = inner ? DUO_INNER_SCREEN : DUO_OUTER_SCREEN;+ return drawnGeometry(device.endsWith("-landscape") ? 1 / portrait : portrait, inner, camera);+}++function fromMeasured(frame: MeasuredFrame, rotate: boolean, camera: FrameGeometry["camera"]): FrameGeometry {+ // Turning counter-clockwise maps image point (x, y) to (y, width - x).+ const width = rotate ? frame.height : frame.width;+ const height = rotate ? frame.width : frame.height;+ const s = frame.screen;+ const screen = rotate ? { x: s.y, y: frame.width - (s.x + s.w), w: s.h, h: s.w } : s;+ return {+ aspect: width / height,+ screen: {+ L: (screen.x / width) * 100,+ T: (screen.y / height) * 100,+ W: (screen.w / width) * 100,+ H: (screen.h / height) * 100,+ },+ radius: { x: (frame.radius / screen.w) * 100, y: (frame.radius / screen.h) * 100 },+ clip: frame.radii && cornerClip(frame.radii, rotate, screen.w, screen.h),+ screenAspect: screen.w / screen.h,+ image: { src: frame.src, rotate },+ camera,+ };+}++// Clips the capture to the cutout's own corners, so a square corner shows the+// capture to the edge and a large one never pokes past the bezel's body.+function cornerClip(radii: [number, number, number, number], rotate: boolean, w: number, h: number) {+ // Turning counter-clockwise moves each corner one place round: the old+ // top-right becomes the top-left, and so on.+ const [tl, tr, br, bl] = rotate ? [radii[1], radii[2], radii[3], radii[0]] : radii;+ const xs = [tl, tr, br, bl].map((r) => `${(r / w) * 100}%`).join(" ");+ const ys = [tl, tr, br, bl].map((r) => `${(r / h) * 100}%`).join(" ");+ return `${xs} / ${ys}`;+}++// Drawn stand-in: an even bezel around a screen of exactly the capture aspect.+function drawnGeometry(screenAspect: number, inner: boolean, camera: FrameGeometry["camera"]): FrameGeometry {+ const sw = screenAspect;+ const sh = 1;+ const short = Math.min(sw, sh);+ const bezel = short * 0.028;+ const fw = sw + bezel * 2;+ const fh = sh + bezel * 2;+ const r = short * (inner ? 0.07 : 0.1);+ return {+ aspect: fw / fh,+ screen: { L: (bezel / fw) * 100, T: (bezel / fh) * 100, W: (sw / fw) * 100, H: (sh / fh) * 100 },+ radius: { x: (r / sw) * 100, y: (r / sh) * 100 },+ screenAspect,+ camera,+ };+}++/**+ * The same phone in its other state, for the "Folded + open" layout. Opening a+ * closed phone held upright gives the inner display in landscape (the fold runs+ * down the middle); opening it held sideways gives the inner display in portrait.+ */+export const DUO_COMPANION: Record<DuoDevice, DuoDevice> = {+ "duo-outer": "duo-inner-landscape",+ "duo-inner-landscape": "duo-outer",+ "duo-outer-landscape": "duo-inner",+ "duo-inner": "duo-outer-landscape",+};diff --git a/skills/app-store-screenshots/template/src/lib/image-cache.ts b/skills/app-store-screenshots/template/src/lib/image-cache.tsindex dd0022f..b5993d4 100644--- a/skills/app-store-screenshots/template/src/lib/image-cache.ts+++ b/skills/app-store-screenshots/template/src/lib/image-cache.ts@@ -3,10 +3,12 @@// non-deterministic image fetch races. Always use img(path) in render.const cache = new Map<string, string>();+// Natural pixel size of each cached image, so frames can check a capture's aspect.+const sizes = new Map<string, { w: number; h: number }>();const failed = new Set<string>();const pending = new Map<string, Promise<void>>();-async function fetchAsDataUrl(path: string): Promise<string | null> {+async function fetchAsDataUrl(path: string): Promise<{ data: string; w: number; h: number } | null> {try {const resp = await fetch(path, { signal: AbortSignal.timeout(10000) });if (!resp.ok) return null;@@ -22,7 +24,7 @@ async function fetchAsDataUrl(path: string): Promise<string | null> {const image = new Image();image.src = data;await image.decode();- return data;+ return { data, w: image.naturalWidth, h: image.naturalHeight };} catch {return null;}@@ -39,10 +41,10 @@ export async function preloadImages(.map((p) => {const existing = pending.get(p);if (existing) return existing;- const task = fetchAsDataUrl(p).then((data) => {+ const task = fetchAsDataUrl(p).then((loaded) => {// A newer upload may have populated the same content-addressed URL.if (cache.has(p)) return;- if (data) { cache.set(p, data); failed.delete(p); }+ if (loaded) { cache.set(p, loaded.data); sizes.set(p, { w: loaded.w, h: loaded.h }); failed.delete(p); }else failed.add(p);}).finally(() => pending.delete(p));pending.set(p, task);@@ -58,11 +60,17 @@ export function img(path: string | undefined): string {return cache.get(path) || path;}-export function setImage(path: string, dataUrl: string) {+export function setImage(path: string, dataUrl: string, size?: { w: number; h: number }) {cache.set(path, dataUrl);+ if (size) sizes.set(path, size);failed.delete(path);}+/** Natural size of a preloaded image, if known. */+export function imgSize(path: string | undefined): { w: number; h: number } | undefined {+ return path ? sizes.get(path) : undefined;+}+export function didFail(path: string | undefined): boolean {if (!path) return false;return failed.has(path);diff --git a/skills/app-store-screenshots/template/src/lib/measure-frame.ts b/skills/app-store-screenshots/template/src/lib/measure-frame.tsnew file mode 100644index 0000000..73e4f0a--- /dev/null+++ b/skills/app-store-screenshots/template/src/lib/measure-frame.ts@@ -0,0 +1,68 @@+import sharp from "sharp";+import type { MeasuredFrame } from "./frame-assets";++// Pixels at or below this alpha count as the see-through screen.+const CLEAR_ALPHA = 24;++/**+ * Finds a bezel PNG's screen: the transparent region connected to the image+ * centre. Its bounding box is the screen rect; how far the cutout's corner sits+ * in along the diagonal gives the corner radius. Dynamic Island and camera+ * cut-ins are opaque islands inside that region, so they don't move the box.+ */+export async function measureFrame(bytes: Buffer, src: string): Promise<MeasuredFrame> {+ const { data, info } = await sharp(bytes).ensureAlpha().raw().toBuffer({ resolveWithObject: true });+ const { width, height, channels } = info;+ const clear = (x: number, y: number) => data[(y * width + x) * channels + 3] <= CLEAR_ALPHA;+ const cx = Math.floor(width / 2);+ const cy = Math.floor(height / 2);+ if (!clear(cx, cy)) {+ throw new Error("the centre of the image is not transparent; export the bezel with an empty screen");+ }++ const seen = new Uint8Array(width * height);+ const stack = [cy * width + cx];+ seen[stack[0]] = 1;+ let minX = cx, maxX = cx, minY = cy, maxY = cy;+ while (stack.length) {+ const index = stack.pop()!;+ const x = index % width;+ const y = (index - x) / width;+ if (x < minX) minX = x;+ if (x > maxX) maxX = x;+ if (y < minY) minY = y;+ if (y > maxY) maxY = y;+ for (const [nx, ny] of [[x + 1, y], [x - 1, y], [x, y + 1], [x, y - 1]]) {+ if (nx < 0 || ny < 0 || nx >= width || ny >= height) continue;+ const next = ny * width + nx;+ if (seen[next] || !clear(nx, ny)) continue;+ seen[next] = 1;+ stack.push(next);+ }+ }+ if (minX === 0 || minY === 0 || maxX === width - 1 || maxY === height - 1) {+ throw new Error("the transparent screen reaches the image edge, so no bezel surrounds it");+ }+ const screen = { x: minX, y: minY, w: maxX - minX + 1, h: maxY - minY + 1 };+ if (screen.w < width * 0.5 || screen.h < height * 0.5) {+ throw new Error("the transparent area at the centre is too small to be the screen");+ }++ // A circular corner of radius r leaves r·(1 − 1/√2) of bezel along the+ // diagonal. Corners can differ (the iPhone Duo's outer display is square on+ // its hinge side), so each is measured on its own.+ const limit = Math.min(screen.w, screen.h) / 2;+ const cornerRadius = (x0: number, y0: number, dx: number, dy: number) => {+ let inset = 0;+ while (inset < limit && !seen[(y0 + dy * inset) * width + x0 + dx * inset]) inset++;+ return Math.round(inset / (1 - Math.SQRT1_2));+ };+ const radii: MeasuredFrame["radii"] = [+ cornerRadius(minX, minY, 1, 1),+ cornerRadius(maxX, minY, -1, 1),+ cornerRadius(maxX, maxY, -1, -1),+ cornerRadius(minX, maxY, 1, -1),+ ];++ return { src, width, height, screen, radius: Math.max(...radii), radii };+}diff --git a/skills/app-store-screenshots/template/src/lib/project-validation.ts b/skills/app-store-screenshots/template/src/lib/project-validation.tsindex b69b091..f864d03 100644--- a/skills/app-store-screenshots/template/src/lib/project-validation.ts+++ b/skills/app-store-screenshots/template/src/lib/project-validation.ts@@ -14,7 +14,7 @@ const transform = (value: unknown) => record(value) &&/** Reject malformed generated/edited JSON before it can crash or overwrite a deck. */export function projectValidationError(value: unknown): string | null {if (!record(value) || !record(value.slidesByDevice)) return "Project must contain a slidesByDevice object";- if (value.schemaVersion !== undefined && value.schemaVersion !== 1 && value.schemaVersion !== 2) return "Unsupported project schema version";+ if (value.schemaVersion !== undefined && ![1, 2, 3].includes(value.schemaVersion as number)) return "Unsupported project schema version";if (value.connectedCanvas !== undefined && typeof value.connectedCanvas !== "boolean") return "connectedCanvas must be a boolean";for (const key of ["appName", "themeId", "locale", "appIcon"]) {if (value[key] !== undefined && typeof value[key] !== "string") return `${key} must be a string`;diff --git a/skills/app-store-screenshots/template/src/lib/storage.ts b/skills/app-store-screenshots/template/src/lib/storage.tsindex 4bf7824..047e158 100644--- a/skills/app-store-screenshots/template/src/lib/storage.ts+++ b/skills/app-store-screenshots/template/src/lib/storage.ts@@ -1,6 +1,6 @@"use client";import { useCallback, useEffect, useRef, useState } from "react";-import { DEFAULT_SCREENSHOT_FONT_ID, PROJECT_SCHEMA_VERSION, SCREENSHOT_FONTS, STORAGE_KEY } from "./constants";+import { DEFAULT_SCREENSHOT_FONT_ID, PROJECT_SCHEMA_VERSION, SCREENSHOT_FONTS, STORAGE_KEY, orientationOf } from "./constants";import { cleanHexColor } from "./clean-hex-color";import { cleanImportedFont } from "./clean-imported-font";import { DEFAULT_PROJECT } from "./defaults";@@ -177,6 +177,8 @@ function mergeWithDefaults(parsed: Partial<ProjectState>): ProjectState {...slidesByDevice,} as ProjectState["slidesByDevice"],};+ // Duo decks are fixed to one orientation each; keep the project's in step.+ merged.orientation = orientationOf(merged.device, merged.orientation);// Clamp the active locale into the project's locale list so a stale// `locale` (e.g. from a project that dropped languages) doesn't show blank.if (!merged.locales || merged.locales.length === 0) {diff --git a/skills/app-store-screenshots/template/src/lib/style-lab.ts b/skills/app-store-screenshots/template/src/lib/style-lab.tsindex 54769cb..f796499 100644--- a/skills/app-store-screenshots/template/src/lib/style-lab.ts+++ b/skills/app-store-screenshots/template/src/lib/style-lab.ts@@ -286,6 +286,8 @@ export function withLocks(look: Look, base: Look, locks: Locks): Look {// canvases, watches and the Play banner keep their own layouts.export function canRearrange(device: Device, orientation: ProjectState["orientation"]) {if (device === "iphone" || device === "android" || device === "ipad") return true;+ // Both Duo displays in portrait take every portrait layout.+ if (device === "duo-outer" || device === "duo-inner") return true;if (device === "android-7" || device === "android-10") return orientation === "portrait" || !supportsLandscape(device);return false;}diff --git a/skills/app-store-screenshots/template/src/lib/types.ts b/skills/app-store-screenshots/template/src/lib/types.tsindex 63102db..26ba254 100644--- a/skills/app-store-screenshots/template/src/lib/types.ts+++ b/skills/app-store-screenshots/template/src/lib/types.ts@@ -1,6 +1,12 @@export type Device =| "iphone"| "ipad"+ // iPhone Duo's two displays. Each orientation is its own target with its own+ // deck, so turning the device never rewrites a composed placement.+ | "duo-outer"+ | "duo-outer-landscape"+ | "duo-inner"+ | "duo-inner-landscape"| "tvos"| "watchos"| "carplay"@@ -8,7 +14,11 @@ export type Device =| "android"| "android-7"| "android-10"- | "feature-graphic";+ | "feature-graphic"+ // App Store creative assets (product page header and search results).+ | "creative-universal"+ | "creative-header"+ | "creative-search";export type Orientation = "portrait" | "landscape";diff --git a/skills/app-store-screenshots/template/tests/editor.e2e.ts b/skills/app-store-screenshots/template/tests/editor.e2e.tsindex a8b0478..c89e241 100644--- a/skills/app-store-screenshots/template/tests/editor.e2e.ts+++ b/skills/app-store-screenshots/template/tests/editor.e2e.ts@@ -14,7 +14,7 @@ async function mock(browser: Browser, state = fixture()) {});}-for (const device of ['iphone', 'ipad', 'tvos', 'watchos', 'carplay', 'mac', 'android', 'android-7', 'android-10', 'feature-graphic']) {+for (const device of ['iphone', 'ipad', 'duo-outer', 'duo-outer-landscape', 'duo-inner', 'duo-inner-landscape', 'tvos', 'watchos', 'carplay', 'mac', 'android', 'android-7', 'android-10', 'feature-graphic', 'creative-universal', 'creative-header', 'creative-search']) {test(`${device} opens and edits its own deck`, async ({ app, browser, screen }) => {await mock(browser, fixture(device));await app.open('/');diff --git a/skills/app-store-screenshots/template/tests/harness/bug-bash.cjs b/skills/app-store-screenshots/template/tests/harness/bug-bash.cjsindex d490b11..71b3de7 100644--- a/skills/app-store-screenshots/template/tests/harness/bug-bash.cjs+++ b/skills/app-store-screenshots/template/tests/harness/bug-bash.cjs@@ -160,7 +160,7 @@ const fixture = (extra = {}) => ({schemaVersion:2,appName:'Bug bash',themeId:'cl});await check('every device exports real images at its advertised sizes',async()=>{const JSZip=require('jszip');- const devices=['iphone','ipad','tvos','watchos','carplay','mac','android','android-7','android-10','feature-graphic'];+ const devices=['iphone','ipad','duo-outer','duo-outer-landscape','duo-inner','duo-inner-landscape','tvos','watchos','carplay','mac','android','android-7','android-10','feature-graphic','creative-universal','creative-header','creative-search'];for(const device of devices) {const bootstrap=await open();const src=await bootstrap.page.evaluate(()=>{const c=document.createElement('canvas');c.width=200;c.height=400;const x=c.getContext('2d');x.fillStyle='#ff00ff';x.fillRect(0,0,200,400);return c.toDataURL()});@@ -170,7 +170,7 @@ const fixture = (extra = {}) => ({schemaVersion:2,appName:'Bug bash',themeId:'clawait page.getByRole('button',{name:'Export bundle',exact:true}).click();const file=await (await downloaded).path();const zip=await JSZip.loadAsync(await fs.readFile(file));const pngs=Object.values(zip.files).filter(f=>f.name.endsWith('.png'));- const expected={iphone:4,ipad:2,tvos:2,watchos:6,carplay:4,mac:4,android:1,'android-7':1,'android-10':1,'feature-graphic':1};+ const expected={iphone:4,ipad:2,'duo-outer':1,'duo-outer-landscape':1,'duo-inner':1,'duo-inner-landscape':1,tvos:2,watchos:6,carplay:4,mac:4,android:1,'android-7':1,'android-10':1,'feature-graphic':1,'creative-universal':1,'creative-header':1,'creative-search':2};assert.equal(pngs.length,expected[device],device);for(const png of pngs) {const bytes=await png.async('nodebuffer');const [,w,h]=png.name.match(/\/(\d+)x(\d+)\//);diff --git a/skills/app-store-screenshots/template/tests/harness/migration-fixture.cjs b/skills/app-store-screenshots/template/tests/harness/migration-fixture.cjsindex 8a3601c..cc1bcd3 100644--- a/skills/app-store-screenshots/template/tests/harness/migration-fixture.cjs+++ b/skills/app-store-screenshots/template/tests/harness/migration-fixture.cjs@@ -4,7 +4,7 @@ const path = require("path");const PROJECT_FILE = "app-store-screenshots.json";const DEFAULT_LOCALE = "en";-const DEVICE_KEYS = ["iphone", "ipad", "tvos", "watchos", "carplay", "mac", "android", "android-7", "android-10", "feature-graphic"];+const DEVICE_KEYS = ["iphone", "ipad", "duo-outer", "duo-outer-landscape", "duo-inner", "duo-inner-landscape", "tvos", "watchos", "carplay", "mac", "android", "android-7", "android-10", "feature-graphic", "creative-universal", "creative-header", "creative-search"];const LAYOUTS = ["hero", "device-bottom", "device-top", "two-devices", "no-device", "split-landscape", "feature-graphic"];function readJson(file) {diff --git a/skills/app-store-screenshots/template/tests/harness/ui-bug-bash.cjs b/skills/app-store-screenshots/template/tests/harness/ui-bug-bash.cjsindex 4124366..7696bef 100644--- a/skills/app-store-screenshots/template/tests/harness/ui-bug-bash.cjs+++ b/skills/app-store-screenshots/template/tests/harness/ui-bug-bash.cjs@@ -100,13 +100,15 @@ const fixture=(extra={})=>({schemaVersion:2,appName:'UI bug bash',themeId:'cleanawait page.getByRole('button',{name:'Undo',exact:true}).click();await pause(750);assert.equal(latest().slidesByDevice.watchos[0].imageElements.length,1);await page.close();});await check('all devices and layouts render and remain editable in both tablet orientations',async()=>{- const devices=['iphone','ipad','tvos','watchos','carplay','mac','android','android-7','android-10','feature-graphic'];+ const devices=['iphone','ipad','duo-outer','duo-inner','tvos','watchos','carplay','mac','android','android-7','android-10','feature-graphic','creative-universal'];const layouts=['Hero','Device bottom','Device top','Two devices','No device','Split (landscape)'];for(const device of devices) {const {page,latest}=await open(fixture({device,slidesByDevice:{[device]:[slide('Layout',{layout:device==='feature-graphic'?'feature-graphic':'hero'})]}}));- for(const orientation of (device==='android-7'||device==='android-10'?['portrait','landscape']:['portrait'])) {+ // Duo landscape is its own deck: the Orientation menu opens it, so the saved device changes with it.+ for(const orientation of (['android-7','android-10','duo-outer','duo-inner'].includes(device)?['portrait','landscape']:['portrait'])) {if(orientation==='landscape'){await page.getByRole('combobox',{name:'Orientation',exact:true}).click();await page.getByRole('option',{name:'Landscape',exact:true}).click();}- for(const layout of (device==='feature-graphic'?['Feature graphic']:layouts)) {+ // On iPhone Duo the two-device layout is the folded + open pair.+ for(const layout of (device==='feature-graphic'?['Feature graphic']:layouts.map((l)=>device.startsWith('duo-')&&l==='Two devices'?'Folded + open':l))) {await page.getByRole('combobox',{name:'Layout',exact:true}).click();await page.getByRole('option',{name:layout,exact:true}).click();const headline=page.getByRole('textbox',{name:device==='feature-graphic'?'Tagline':'Headline',exact:true});await headline.fill(`${device} ${orientation} ${layout}`);@@ -114,7 +116,10 @@ const fixture=(extra={})=>({schemaVersion:2,appName:'UI bug bash',themeId:'cleanawait page.getByRole('button',{name:'Zoom in',exact:true}).click();await page.getByRole('button',{name:'Fit active screen',exact:true}).click();}}- await pause(700);assert.equal(latest().device,device);assert.ok(latest().slidesByDevice[device][0].headline.en.includes(device));await page.close();+ const duo=device.startsWith('duo-');const saved=duo?`${device}-landscape`:device;+ await pause(700);assert.equal(latest().device,saved);assert.ok(latest().slidesByDevice[saved][0].headline.en.includes(device));+ if(duo)assert.ok(latest().slidesByDevice[device][0].headline.en.includes(`${device} portrait`));+ await page.close();}});await check('Fit active screen recenters a manually panned canvas at default zoom',async()=>{diff --git a/skills/app-store-screenshots/template/tests/targets.e2e.ts b/skills/app-store-screenshots/template/tests/targets.e2e.tsnew file mode 100644index 0000000..cccd597--- /dev/null+++ b/skills/app-store-screenshots/template/tests/targets.e2e.ts@@ -0,0 +1,195 @@+import { test } from '@e2e-dev/web';+import type { Browser } from '@e2e-dev/web';+import { expect } from 'e2e';+import { readFile, readdir, stat } from 'node:fs/promises';+import JSZip from 'jszip';+import sharp from 'sharp';++// iPhone Duo and App Store creative targets, plus the issue 41 export regression.++type State = Record<string, any>;+const slide = (id: string, layout = 'no-device', extra: State = {}) => ({ id, layout, screenshot: '', label: { en: 'FEATURE' }, headline: { en: id }, ...extra });+const project = (device: string, slidesByDevice: State, extra: State = {}): State => ({+ schemaVersion: 3, appName: 'Target Army', themeId: 'clean-light', connectedCanvas: true, locales: ['en'], locale: 'en',+ device, orientation: device.endsWith('-landscape') ? 'landscape' : 'portrait', slidesByDevice, ...extra,+});++async function mock(browser: Browser, initial: State) {+ const store = { state: initial };+ await browser.route('**/api/project', async route => {+ if (route.request.method === 'POST') store.state = JSON.parse(route.request.postData!);+ await route.fulfill({ json: { ok: true, state: store.state }, headers: { etag: '"mock"' } });+ });+ return store;+}++async function eventually(check: () => unknown | Promise<unknown>, timeout = 10_000) {+ const deadline = Date.now() + timeout;+ for (;;) {+ try { await check(); return; } catch (error) {+ if (Date.now() > deadline) throw error;+ await new Promise(resolve => setTimeout(resolve, 200));+ }+ }+}++// Downloads in the same minute share a name across tests; take the newest.+async function zipFrom(path: string) {+ const matches = (await readdir('.e2e/artifacts', { recursive: true })).filter(file => file.endsWith(path));+ await expect(matches.length).toBeGreaterThan(0);+ const dated = await Promise.all(matches.map(async file => ({ file, at: (await stat(`.e2e/artifacts/${file}`)).mtimeMs })));+ dated.sort((a, b) => b.at - a.at);+ return JSZip.loadAsync(await readFile(`.e2e/artifacts/${dated[0].file}`));+}++const EXACT: Record<string, [number, number][]> = {+ 'duo-outer': [[1398, 2034]],+ 'duo-outer-landscape': [[2034, 1398]],+ 'duo-inner': [[2007, 2853]],+ 'duo-inner-landscape': [[2853, 2007]],+ 'creative-universal': [[5244, 2950]],+ 'creative-header': [[3840, 1646]],+ 'creative-search': [[3840, 2560], [1920, 1280]],+};++for (const [device, sizes] of Object.entries(EXACT)) {+ test(`${device} exports exact opaque RGB PNGs`, { timeout: 240_000 }, async ({ app, browser, screen }) => {+ await mock(browser, project(device, { [device]: [slide('One', 'hero'), slide('Two')] }));+ await app.open('/');+ await expect(screen.getByRole('textbox', 'Headline')).toHaveValue('One');+ const download = await browser.waitForDownload(() => screen.getByRole('button', 'Export bundle', { exact: true }).tap(), { timeout: 200_000 });+ const zip = await zipFrom(download.path);+ const pngs = Object.values(zip.files).filter(file => file.name.endsWith('.png'));+ await expect(pngs).toHaveLength(sizes.length * 2);+ for (const file of pngs) {+ const match = file.name.match(new RegExp(`^ios/${device}/(\\d+)x(\\d+)/en/0[12]-(hero|no-device)\\.png$`))!;+ await expect(match).toBeTruthy();+ const bytes = await file.async('nodebuffer');+ const [w, h] = [bytes.readUInt32BE(16), bytes.readUInt32BE(20)];+ await expect(sizes.some(([sw, sh]) => sw === w && sh === h)).toBe(true);+ await expect([Number(match[1]), Number(match[2])]).toEqual([w, h]);+ // Colour type 2: 24-bit RGB, no alpha channel.+ await expect(bytes[25]).toBe(2);+ await expect((await sharp(bytes).metadata()).hasAlpha).toBe(false);+ }+ });+}++test('duo orientations keep independent decks and placements', async ({ app, browser, screen }) => {+ const placed = { device: { x: 120, y: 900, width: 700, height: 1000, rotation: 4 } };+ const store = await mock(browser, project('duo-outer', {+ 'duo-outer': [slide('Portrait copy', 'hero', { transforms: placed })],+ 'duo-outer-landscape': [slide('Landscape copy', 'split-landscape')],+ 'duo-inner': [slide('Inner copy', 'hero')],+ }));+ await app.open('/');+ const headline = screen.getByRole('textbox', 'Headline');+ await expect(headline).toHaveValue('Portrait copy');+ await expect(screen.getByRole('combobox', 'Device')).toContainText('iPhone Duo outer');++ await screen.getByRole('combobox', 'Orientation').tap();+ await screen.getByRole('option', 'Landscape', { exact: true }).tap();+ await expect(headline).toHaveValue('Landscape copy');+ await headline.fill('Landscape edited');++ // Changing display keeps the orientation being worked in.+ await screen.getByRole('combobox', 'Device').tap();+ await screen.getByRole('option', 'iPhone Duo inner', { exact: true }).tap();+ await expect(screen.getByRole('combobox', 'Orientation')).toContainText('Landscape');+ await screen.getByRole('combobox', 'Orientation').tap();+ await screen.getByRole('option', 'Portrait', { exact: true }).tap();+ await expect(headline).toHaveValue('Inner copy');++ await screen.getByRole('combobox', 'Device').tap();+ await screen.getByRole('option', 'iPhone Duo outer', { exact: true }).tap();+ await expect(headline).toHaveValue('Portrait copy');+ await eventually(async () => {+ await expect(store.state.device).toBe('duo-outer');+ await expect(store.state.orientation).toBe('portrait');+ await expect(store.state.slidesByDevice['duo-outer-landscape'][0].headline.en).toBe('Landscape edited');+ await expect(store.state.slidesByDevice['duo-outer'][0].transforms).toEqual(placed);+ await expect(store.state.slidesByDevice['duo-outer'][0].headline.en).toBe('Portrait copy');+ });++ // Reload restores the same deck and orientation from the saved project.+ await browser.reload();+ await expect(screen.getByRole('textbox', 'Headline')).toHaveValue('Portrait copy');+ await expect(screen.getByRole('combobox', 'Orientation')).toContainText('Portrait');+});++test('legacy v2 projects gain the new decks without changing existing ones', async ({ app, browser, screen }) => {+ const legacy: State = { ...project('iphone', { iphone: [slide('Legacy', 'hero', { transforms: { caption: { x: 10, y: 20, width: 900, height: 400 } } })] }), schemaVersion: 2 };+ const store = await mock(browser, legacy);+ await app.open('/');+ await expect(screen.getByRole('textbox', 'Headline')).toHaveValue('Legacy');+ await screen.getByRole('textbox', 'App name').fill('Legacy migrated');+ await eventually(async () => {+ await expect(store.state.schemaVersion).toBe(3);+ const [kept] = store.state.slidesByDevice.iphone;+ await expect([kept.id, kept.layout, kept.headline, kept.transforms]).toEqual(['Legacy', 'hero', { en: 'Legacy' }, legacy.slidesByDevice.iphone[0].transforms]);+ for (const device of Object.keys(EXACT)) await expect(store.state.slidesByDevice[device].length).toBeGreaterThan(0);+ });+});++test('universal creative shows safe area guides and placement previews that never export', async ({ app, browser, screen }) => {+ await mock(browser, project('creative-universal', { 'creative-universal': [slide('Brand line', 'split-landscape')] }));+ await app.open('/');+ await expect(browser.locator('main [data-creative-guide]')).toHaveCount(1);+ await expect(screen.getByText('Art safe area', { exact: true })).toBeVisible();+ await expect(browser.locator('[aria-label="Placement previews"] figure')).toHaveCount(2);+ // Only the editable canvas has guides: not the export canvas, thumbnails or previews.+ await expect(await browser.evaluate(() => document.querySelectorAll('[data-creative-guide]').length)).toBe(1);+});++// Issue 41: clearing a label or headline exported the editor hints ("LABEL",+// "Headline goes here") into the PNG. Exported empty copy must match copy that+// renders nothing, while the editable canvas still shows the hints.+test('cleared copy exports empty while the canvas keeps its editing hints', { timeout: 240_000 }, async ({ app, browser, screen }) => {+ const plain = { backdrop: 'solid', span: false, decoration: 'none', shadow: 0, glow: 0, tilt: 0, headlineWeight: 700, headlineScale: 1, headlineCase: 'as-typed', captionAlign: 'auto' };+ // A zero-width space is not :empty, so it renders as genuinely blank copy.+ await mock(browser, project('watchos', {+ watchos: [+ slide('Cleared', 'no-device', { label: {}, headline: {} }),+ slide('Blank', 'no-device', { label: { en: '' }, headline: { en: '' } }),+ ],+ }, { scene: plain, connectedCanvas: false }));+ await app.open('/');+ await expect(browser.locator('main [contenteditable="plaintext-only"]').first()).toBeVisible();+ const hint = await browser.evaluate(() => {+ const fields = [...document.querySelectorAll('main [contenteditable="plaintext-only"]')].slice(0, 2);+ return fields.map(el => getComputedStyle(el, '::before').content);+ });+ await expect(hint).toEqual(['"LABEL"', '"Headline goes here"']);++ const download = await browser.waitForDownload(() => screen.getByRole('button', 'Export bundle', { exact: true }).tap(), { timeout: 200_000 });+ const zip = await zipFrom(download.path);+ const raw = async (name: string) => sharp(await zip.file(name)!.async('nodebuffer')).raw().toBuffer();+ const cleared = await raw('ios/watchos/422x514/en/01-no-device.png');+ const blank = await raw('ios/watchos/422x514/en/02-no-device.png');+ let differing = 0;+ for (let i = 0; i < cleared.length; i++) if (Math.abs(cleared[i] - blank[i]) > 24) differing++;+ await expect(differing).toBeLessThan(cleared.length * 0.001);+});++// On iPhone Duo, "Two devices" is the same phone folded and open: the back+// device is the other display, so it never borrows the front display's capture.+test('duo folded + open pairs the other display and never reuses the front capture', { timeout: 240_000 }, async ({ app, browser, screen }) => {+ // Routes fulfil text only, so the inner-display capture is an SVG of that size.+ const front = '<svg xmlns="http://www.w3.org/2000/svg" width="2853" height="2007"><rect width="2853" height="2007" fill="#4f46e5"/></svg>';+ await browser.route('**/screenshots/duo/front.svg', route => route.fulfill({ body: front, headers: { 'content-type': 'image/svg+xml' } }));+ await mock(browser, project('duo-inner-landscape', {+ 'duo-inner-landscape': [slide('Pair', 'two-devices', { screenshot: '/screenshots/duo/front.svg', screenshotSecondary: '' })],+ }));+ await app.open('/');+ await expect(screen.getByRole('textbox', 'Headline')).toHaveValue('Pair');+ await expect(screen.getByRole('combobox', 'Layout')).toContainText('Folded + open');+ await expect(screen.getByText('iPhone Duo outer screenshot', { exact: true })).toBeVisible();+ // The front device shows its capture; only the closed phone waits for one.+ await eventually(async () => {+ await expect(await browser.evaluate(() => [...document.querySelectorAll('main')].map(m => m.textContent!.split('Drop a screenshot here').length - 1)[0])).toBe(1);+ });++ await screen.getByRole('button', 'Export bundle', { exact: true }).tap();+ await expect(screen.getByText('Export includes placeholder screenshots', { exact: true })).toBeVisible();+ await expect(browser.locator('[data-sonner-toast]').first()).toContainText('1 screen will export with an empty device.');+});