Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.
Rust acpagent-client-protocolai-agentsai-assistantclaudeclaude-codecodexcoding-agentscursorgeminigemini-cligrok-bot-alternativeiosiphonelinuxmacosmcpopen-sourcerustself-hosted
chore(ios): add halftone App Store screenshot deck
leepokai99d5419bd55a
diff --git a/docs/architecture/file-structure.md b/docs/architecture/file-structure.mdindex bf40df5d..02dd1017 100644--- a/docs/architecture/file-structure.md+++ b/docs/architecture/file-structure.md@@ -53,6 +53,7 @@ Codync/├── docs/ # Architecture, guides, reference, features, design, archive├── tools/ # Widget rendering utilities├── packaging/ # Distribution templates+├── marketing/app-store-screenshots/ # App Store screenshot editor (bun dev; Export bundle → out/)├── web/ # Website git submodule└── .github/workflows/ # CI, signing and release automation```diff --git a/marketing/app-store-screenshots/.gitignore b/marketing/app-store-screenshots/.gitignorenew file mode 100644index 00000000..a9a0f88f--- /dev/null+++ b/marketing/app-store-screenshots/.gitignore@@ -0,0 +1,15 @@+node_modules+.next+out+.DS_Store+*.tsbuildinfo+next-env.d.ts+.env*.local++# Uploaded screenshots belong to the generated project: commit them alongside+# app-store-screenshots.json so decks remain reproducible after cloning.++# Fonts imported from the editor toolbar are user assets too (and font licences+# often forbid redistributing them), so keep them out of the template as well.+public/fonts/imported/*+!public/fonts/imported/.gitkeepdiff --git a/marketing/app-store-screenshots/README.md b/marketing/app-store-screenshots/README.mdnew file mode 100644index 00000000..a19ea1b3--- /dev/null+++ b/marketing/app-store-screenshots/README.md@@ -0,0 +1,103 @@+# App Store Screenshots — Editor Template++A pre-built Next.js + ShadCN editor for generating App Store and Google Play screenshots. Scaffolded by the `app-store-screenshots` skill.++## Quick start++Requires Node.js 20.9 or newer.++```bash+bun install # or pnpm / yarn / npm+bun dev # http://localhost:3000+```++## What's inside++- **Connected canvas editor** (`src/components/editor/`) — every screen sits on one horizontal canvas, so phones, captions, and other elements can be dragged across screen boundaries and exported as split crops when Connected mode is enabled.+- **Screen controls** — drag-to-reorder screens, click-to-edit text, screenshot drop targets, per-screen layout switcher, dark/light toggle.+- **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.+- **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.+- **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.++## Adding screenshots++Two ways:++1. **Drop a file in the inspector** — drag-and-drop or click Pick. The file is sent to `/api/upload`, hashed, and written to `public/screenshots/uploaded/<hash>.png`. The slide stores the resulting `/screenshots/uploaded/...` path, so commit those files alongside `app-store-screenshots.json` and the screenshots survive a `git clone`.+2. **Reference a static file** — put PNGs under `public/screenshots/{platform}/{device}/{locale}/` and reference them by path. Default sample slides expect:+ - `public/screenshots/apple/iphone/en/...`+ - `public/screenshots/apple/ipad/en/...`+ - `public/screenshots/apple/{tvos,watchos,carplay}/en/...` for Apple TV, Apple Watch and CarPlay decks+ - `public/screenshots/apple/mac/en/...`+ - `public/screenshots/android/phone/en/...`++Update the matching `screenshot` fields in `app-store-screenshots.json` to point at whatever filenames you choose.++## Exporting++The toolbar dropdown lists every Apple/Google-required size for the current device. Click **Export bundle** to download a zip. In Connected mode, each PNG is clipped from the connected canvas, so an element that straddles two screens appears split exactly where you placed it. In Isolated mode, each screen clips its own elements and legacy offscreen content cannot leak into neighboring exports.++Exports lock the editor through preparation and bundling and render a fixed project snapshot. Referenced images that cannot be loaded stop the export with an error; empty screenshot fields still produce the existing placeholder warning.++Each screen is rendered once per locale at canvas resolution (`src/lib/export-render.ts`) and scaled to every size; slots whose aspect differs slightly are cover-scaled rather than stretched. Before saving, the exporter redraws until every visible screenshot has painted, because WebKit decodes images inside the html-to-image SVG asynchronously and a single draw can leave device screens blank. If a screenshot never appears, a toast names the screen. Files are written as opaque 24-bit RGB PNGs (`src/lib/png-rgb.ts`, encoded in a small worker pool) because Google Play rejects PNGs with an alpha channel and canvas can only produce RGBA.++CarPlay 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.++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++### Themes and backgrounds++The toolbar **Theme** menu recolours the whole deck (backgrounds, text, accents); it doesn't touch copy, layouts or screenshots. Each screen's **Background** control in the inspector picks the theme background, the theme's alternate (dark/light) background, or a **custom colour** (colour picker or hex). A custom colour applies to that screen only and is saved as `backgroundColor` on the slide. When the theme's text or label colour would be hard to read on it (below a 4.5:1 contrast ratio for text, 3:1 for the label), the caption switches to the theme's other text colour, or to near-black / white. Text elements you've given an explicit colour keep it.++### Screenshot fonts++The toolbar font menu sets the typeface of the screenshot canvas and exports (not the editor UI). **Inter (default)** is the template font and what projects without a `fontId` use. **System Sans** and **Georgia** are available everywhere; **Avenir Next**, **Helvetica Neue**, **Futura**, **Baskerville**, **Palatino**, **Optima** and **American Typewriter** are macOS system fonts that fall back to similar faces elsewhere, so export on the machine you designed on.++**Import font…** at the bottom of the menu takes a licensed WOFF2, WOFF, TTF or OTF file (16 MB max). The browser decodes the font before uploading; `/api/upload-font` checks the container signature, lengths and table bounds before storing it as `public/fonts/imported/<hash>.<ext>`. The project saves it as `importedFont` with `fontId: "self-hosted"`. That font folder is gitignored (font licences often forbid redistribution); keep the file alongside the project JSON if you move the project, or screenshot text falls back to a generic sans-serif. Once imported, the font is listed in the menu under its file name, and it is loaded and embedded before every export.++### Image overlays++In the inspector's **Elements** card, click **Image**, then **Pick** (or drop) a PNG/JPG. Uploads go through `/api/upload` into `public/screenshots/uploaded/`, like screenshots. The first image sizes the overlay frame to its aspect ratio; after that you can drag, resize, rotate (canvas handle or slider), restack, choose **Fill frame** (crop) or **Whole image**, and fade one edge into the background. In Connected mode overlays can cross screen edges like other elements. Overlays are saved per screen as `imageElements`, and the exporter waits for them to paint just like device screenshots. The Play Store feature graphic has a fixed icon + name + tagline layout, so it doesn't take overlays or text elements.++### Undo and redo++The toolbar arrows, `⌘Z` / `Ctrl+Z` and `⇧⌘Z` / `Ctrl+Shift+Z` (or `Ctrl+Y`) step through the last 50 edits of the session: copy, layouts, element moves, text sizes, backgrounds, fonts, themes, overlays and resets. Rapid changes (typing, dragging a slider) collapse into one step. Switching platform, device, orientation or locale isn't an edit, so it doesn't use up an undo step; undoing an edit takes you back to the deck it was made on. While a text field is focused the shortcuts undo that field's typing instead. History resets on reload.++## Customizing++| Where | What |+|-------|------|+| `src/lib/constants.ts` | Canvas dimensions, export sizes, frame ratios, themes, screenshot fonts, locales |+| `app-store-screenshots.json` | Canonical starter project: app name, current device, connected-canvas mode, slide copy, screenshots, and transforms |+| `src/lib/defaults.ts` | Fallback/reset state used when no project file or local cache exists |+| `src/components/editor/slide-canvas.tsx` | Add new layouts and connected-canvas element rendering |+| `src/components/editor/device-frames.tsx` | Tweak device chrome (bezel radii, camera dots) |+| `src/app/layout.tsx` | Swap the font (`next/font/google`) |++## Notes++- `mockup.png` is the iPhone bezel overlay; replacing it requires re-measuring the `PHONE_SCREEN` constants.+- 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.+- **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++These routes are for a local editor running in one server process. They have no authentication for remote hosting. Browser writes must come from the same origin and use `Content-Type: application/json`; headerless scripts still work.++- `GET /api/project` returns `{ ok, state }` and an `ETag` revision, including when the project file is missing.+- `POST /api/project` accepts project JSON (64 MiB request limit). Send the last `ETag` as `If-Match` to reject stale writes with HTTP 412; success returns a new `ETag`. Scripts that omit `If-Match` intentionally keep unconditional replacement behavior. Unknown schema versions, unknown device decks, duplicate IDs, and malformed element data are rejected with HTTP 400.+- `POST /api/upload` accepts `{ dataUrl }` for PNG/JPEG (8 MiB decoded file, 12 MiB request, 64 megapixels). It decodes the image before storing the original bytes. Rejected files keep the previous selection; unavailable endpoints can still fall back to inline images.+- `POST /api/upload-font` accepts `{ data }` containing base64 font bytes (16 MiB decoded file, 23 MiB request). Server validation checks the font container; the editor's browser additionally validates font decoding.++Uploads 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.++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.diff --git a/marketing/app-store-screenshots/app-store-screenshots.json b/marketing/app-store-screenshots/app-store-screenshots.jsonnew file mode 100644index 00000000..9314d682--- /dev/null+++ b/marketing/app-store-screenshots/app-store-screenshots.json@@ -0,0 +1,482 @@+{+ "schemaVersion": 2,+ "appName": "Codync",+ "themeId": "codync-halftone",+ "fontId": "system-sans",+ "connectedCanvas": true,+ "locales": [+ "en",+ "zh-Hant"+ ],+ "locale": "en",+ "device": "iphone",+ "orientation": "portrait",+ "appIcon": "/app-icon.png",+ "slidesByDevice": {+ "iphone": [+ {+ "id": "s_i1",+ "layout": "hero",+ "label": {+ "en": "CODYNC",+ "zh-Hant": "CODYNC"+ },+ "headline": {+ "en": "Your coding agents,\nas bots.",+ "zh-Hant": "你的 coding agent,\n變成 bot。"+ },+ "screenshot": "/screenshots/apple/iphone/en/01.png"+ },+ {+ "id": "s_i2",+ "layout": "device-top",+ "label": {+ "en": "DELEGATE",+ "zh-Hant": "交辦"+ },+ "headline": {+ "en": "Say what.\nPut the phone away.",+ "zh-Hant": "交代一句,\n手機收起來。"+ },+ "screenshot": "/screenshots/apple/iphone/en/02.png",+ "inverted": true+ },+ {+ "id": "s_i3",+ "layout": "device-bottom",+ "label": {+ "en": "APPROVE",+ "zh-Hant": "批准"+ },+ "headline": {+ "en": "Approve\nfrom anywhere.",+ "zh-Hant": "人在哪,\n都能批准。"+ },+ "screenshot": "/screenshots/apple/iphone/en/03.png"+ },+ {+ "id": "s_i4",+ "layout": "two-devices",+ "label": {+ "en": "GROUP CHAT",+ "zh-Hant": "群組"+ },+ "headline": {+ "en": "Let your bots\nreview each other.",+ "zh-Hant": "讓 bot\n互相 review。"+ },+ "screenshot": "/screenshots/apple/iphone/en/04.png",+ "screenshotSecondary": "/screenshots/apple/iphone/en/05.png"+ },+ {+ "id": "s_i5",+ "layout": "device-top",+ "label": {+ "en": "LIVE ACTIVITY",+ "zh-Hant": "即時動態"+ },+ "headline": {+ "en": "Follow along\nin the Dynamic Island.",+ "zh-Hant": "動態島上\n隨時看進度。"+ },+ "screenshot": "/screenshots/apple/iphone/en/06.png",+ "inverted": true+ },+ {+ "id": "s_i6",+ "layout": "hero",+ "label": {+ "en": "USAGE",+ "zh-Hant": "用量"+ },+ "headline": {+ "en": "Know your limits\nat a glance.",+ "zh-Hant": "額度剩多少,\n一眼就知道。"+ },+ "screenshot": "/screenshots/apple/iphone/en/07.png"+ },+ {+ "id": "s_i7",+ "layout": "no-device",+ "label": {+ "en": "WORKS WITH",+ "zh-Hant": "支援"+ },+ "headline": {+ "en": "Claude Code\nCodex · Cursor\nGemini · Pi\n& dozens more",+ "zh-Hant": "Claude Code\nCodex · Cursor\nGemini · Pi\n還有數十種"+ },+ "screenshot": ""+ }+ ],+ "android": [+ {+ "id": "s_mup83m53_5",+ "layout": "hero",+ "label": {+ "en": "MEET YOUR APP"+ },+ "headline": {+ "en": "Sell one\nidea per slide."+ },+ "screenshot": ""+ },+ {+ "id": "s_mup83m53_6",+ "layout": "device-bottom",+ "label": {+ "en": "FEATURE 01"+ },+ "headline": {+ "en": "Your headline\nlives here."+ },+ "screenshot": ""+ },+ {+ "id": "s_mup83m53_7",+ "layout": "two-devices",+ "label": {+ "en": "FEATURE 02"+ },+ "headline": {+ "en": "Show two\nscreens at once."+ },+ "screenshot": "",+ "screenshotSecondary": ""+ },+ {+ "id": "s_mup83m53_8",+ "layout": "device-top",+ "label": {+ "en": "FEATURE 03"+ },+ "headline": {+ "en": "Flip the contrast\nfor visual rhythm."+ },+ "screenshot": "",+ "inverted": true+ },+ {+ "id": "s_mup83m53_9",+ "layout": "no-device",+ "label": {+ "en": "MORE"+ },+ "headline": {+ "en": "And so\nmuch more."+ },+ "screenshot": ""+ }+ ],+ "ipad": [+ {+ "id": "s_p1",+ "layout": "hero",+ "label": {+ "en": "CODYNC",+ "zh-Hant": "CODYNC"+ },+ "headline": {+ "en": "Your coding agents,\nas bots.",+ "zh-Hant": "你的 coding agent,\n變成 bot。"+ },+ "screenshot": "/screenshots/apple/ipad/en/01.png"+ },+ {+ "id": "s_p2",+ "layout": "device-top",+ "label": {+ "en": "DELEGATE",+ "zh-Hant": "交辦"+ },+ "headline": {+ "en": "Say what.\nPut the tablet away.",+ "zh-Hant": "交代一句,\n平板收起來。"+ },+ "screenshot": "/screenshots/apple/ipad/en/02.png",+ "inverted": true+ },+ {+ "id": "s_p3",+ "layout": "two-devices",+ "label": {+ "en": "GROUP CHAT",+ "zh-Hant": "群組"+ },+ "headline": {+ "en": "Let your bots\nreview each other.",+ "zh-Hant": "讓 bot\n互相 review。"+ },+ "screenshot": "/screenshots/apple/ipad/en/03.png",+ "screenshotSecondary": "/screenshots/apple/ipad/en/04.png"+ },+ {+ "id": "s_p4",+ "layout": "hero",+ "label": {+ "en": "USAGE",+ "zh-Hant": "用量"+ },+ "headline": {+ "en": "Know your limits\nat a glance.",+ "zh-Hant": "額度剩多少,\n一眼就知道。"+ },+ "screenshot": "/screenshots/apple/ipad/en/05.png"+ },+ {+ "id": "s_p5",+ "layout": "no-device",+ "label": {+ "en": "WORKS WITH",+ "zh-Hant": "支援"+ },+ "headline": {+ "en": "Claude Code\nCodex · Cursor\nGemini · Pi\n& dozens more",+ "zh-Hant": "Claude Code\nCodex · Cursor\nGemini · Pi\n還有數十種"+ },+ "screenshot": ""+ }+ ],+ "tvos": [+ {+ "id": "s_mup83m53_d",+ "layout": "hero",+ "label": {+ "en": "MEET YOUR APP"+ },+ "headline": {+ "en": "Made for\nthe living room."+ },+ "screenshot": ""+ },+ {+ "id": "s_mup83m53_e",+ "layout": "split-landscape",+ "label": {+ "en": "FEATURE 01"+ },+ "headline": {+ "en": "One idea\nper screen."+ },+ "screenshot": ""+ },+ {+ "id": "s_mup83m53_f",+ "layout": "device-top",+ "label": {+ "en": "FEATURE 02"+ },+ "headline": {+ "en": "Flip the contrast."+ },+ "screenshot": "",+ "inverted": true+ },+ {+ "id": "s_mup83m53_g",+ "layout": "no-device",+ "label": {+ "en": "MORE"+ },+ "headline": {+ "en": "And so\nmuch more."+ },+ "screenshot": ""+ }+ ],+ "watchos": [+ {+ "id": "s_mup83m53_h",+ "layout": "hero",+ "label": {+ "en": "MEET YOUR APP"+ },+ "headline": {+ "en": "On your\nwrist."+ },+ "screenshot": ""+ },+ {+ "id": "s_mup83m53_i",+ "layout": "device-bottom",+ "label": {+ "en": "FEATURE 01"+ },+ "headline": {+ "en": "One glance.\nDone."+ },+ "screenshot": ""+ },+ {+ "id": "s_mup83m53_j",+ "layout": "device-top",+ "label": {+ "en": "FEATURE 02"+ },+ "headline": {+ "en": "Always\nwith you."+ },+ "screenshot": "",+ "inverted": true+ }+ ],+ "carplay": [+ {+ "id": "s_mup83m53_k",+ "layout": "split-landscape",+ "label": {+ "en": "CARPLAY"+ },+ "headline": {+ "en": "Eyes on\nthe road."+ },+ "screenshot": ""+ },+ {+ "id": "s_mup83m53_l",+ "layout": "device-bottom",+ "label": {+ "en": "FEATURE 01"+ },+ "headline": {+ "en": "Everything, one tap away."+ },+ "screenshot": ""+ },+ {+ "id": "s_mup83m53_m",+ "layout": "device-top",+ "label": {+ "en": "FEATURE 02"+ },+ "headline": {+ "en": "Made for every drive."+ },+ "screenshot": "",+ "inverted": true+ }+ ],+ "mac": [+ {+ "id": "s_mup83m53_n",+ "layout": "hero",+ "label": {+ "en": "MEET YOUR APP"+ },+ "headline": {+ "en": "Made for\nyour Mac."+ },+ "screenshot": ""+ },+ {+ "id": "s_mup83m53_o",+ "layout": "split-landscape",+ "label": {+ "en": "FEATURE 01"+ },+ "headline": {+ "en": "Everything in\none window."+ },+ "screenshot": ""+ },+ {+ "id": "s_mup83m53_p",+ "layout": "device-top",+ "label": {+ "en": "FEATURE 02"+ },+ "headline": {+ "en": "One shortcut away."+ },+ "screenshot": "",+ "inverted": true+ },+ {+ "id": "s_mup83m53_q",+ "layout": "two-devices",+ "label": {+ "en": "FEATURE 03"+ },+ "headline": {+ "en": "Work across windows."+ },+ "screenshot": "",+ "screenshotSecondary": ""+ },+ {+ "id": "s_mup83m53_r",+ "layout": "no-device",+ "label": {+ "en": "MORE"+ },+ "headline": {+ "en": "And so\nmuch more."+ },+ "screenshot": ""+ }+ ],+ "android-7": [+ {+ "id": "s_mup83m53_s",+ "layout": "hero",+ "label": {+ "en": "MEET YOUR APP"+ },+ "headline": {+ "en": "Pocket-sized\npower."+ },+ "screenshot": ""+ },+ {+ "id": "s_mup83m53_t",+ "layout": "split-landscape",+ "label": {+ "en": "FEATURE 01"+ },+ "headline": {+ "en": "Wide canvas,\nbigger ideas."+ },+ "screenshot": ""+ }+ ],+ "android-10": [+ {+ "id": "s_mup83m53_u",+ "layout": "hero",+ "label": {+ "en": "MEET YOUR APP"+ },+ "headline": {+ "en": "Made for\nthe big screen."+ },+ "screenshot": ""+ },+ {+ "id": "s_mup83m53_v",+ "layout": "split-landscape",+ "label": {+ "en": "FEATURE 01"+ },+ "headline": {+ "en": "Wide canvas,\nbigger ideas."+ },+ "screenshot": ""+ }+ ],+ "feature-graphic": [+ {+ "id": "s_mup83m53_w",+ "layout": "feature-graphic",+ "label": {},+ "headline": {+ "en": "Your tagline goes here."+ },+ "screenshot": ""+ }+ ]+ },+ "crossScreenMockupsByDevice": {+ "iphone": [],+ "ipad": []+ }+}diff --git a/marketing/app-store-screenshots/bun.lock b/marketing/app-store-screenshots/bun.locknew file mode 100644index 00000000..124f4bae--- /dev/null+++ b/marketing/app-store-screenshots/bun.lock@@ -0,0 +1,482 @@+{+ "lockfileVersion": 1,+ "configVersion": 1,+ "workspaces": {+ "": {+ "name": "app-store-screenshots",+ "dependencies": {+ "@dnd-kit/core": "^6.1.0",+ "@dnd-kit/sortable": "^8.0.0",+ "@dnd-kit/utilities": "^3.2.2",+ "@radix-ui/react-dialog": "^1.1.2",+ "@radix-ui/react-dropdown-menu": "^2.1.2",+ "@radix-ui/react-label": "^2.1.0",+ "@radix-ui/react-popover": "^1.1.2",+ "@radix-ui/react-select": "^2.1.2",+ "@radix-ui/react-slot": "^1.1.0",+ "@radix-ui/react-tabs": "^1.1.1",+ "@radix-ui/react-tooltip": "^1.1.4",+ "class-variance-authority": "^0.7.0",+ "clsx": "^2.1.1",+ "html-to-image": "^1.11.11",+ "jszip": "^3.10.1",+ "lucide-react": "^0.460.0",+ "next": "16.3.6",+ "react": "^19.2.8",+ "react-dom": "^19.2.8",+ "react-rnd": "^10.5.3",+ "sharp": "0.35.4",+ "sonner": "^1.7.0",+ "tailwind-merge": "^2.5.4",+ "tailwindcss-animate": "^1.0.7",+ },+ "devDependencies": {+ "@types/node": "^22",+ "@types/react": "^19.2.17",+ "@types/react-dom": "^19.2.3",+ "autoprefixer": "^10.4.20",+ "postcss": "^8.5.28",+ "tailwindcss": "^3.4.15",+ "typescript": "^5.6.3",+ },+ },+ },+ "overrides": {+ "nanoid": "^3.3.18",+ },+ "packages": {+ "@alloc/quick-lru": ["@alloc/[email protected]", "", {}, "sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw=="],++ "@dnd-kit/accessibility": ["@dnd-kit/[email protected]", "", { "dependencies": { "tslib": "^2.0.0" }, "peerDependencies": { "react": ">=16.8.0" } }, "sha512-2P+YgaXF+gRsIihwwY1gCsQSYnu9Zyj2py8kY5fFvUM1qm2WA2u639R6YNVfU4GWr+ZM5mqEsfHZZLoRONbemw=="],++ "@dnd-kit/core": ["@dnd-kit/[email protected]", "", { "dependencies": { "@dnd-kit/accessibility": "^3.1.1", "@dnd-kit/utilities": "^3.2.2", "tslib": "^2.0.0" }, "peerDependencies": { "react": ">=16.8.0", "react-dom": ">=16.8.0" } }, "sha512-xkGBRQQab4RLwgXxoqETICr6S5JlogafbhNsidmrkVv2YRs5MLwpjoF2qpiGjQt8S9AoxtIV603s0GIUpY5eYQ=="],++ "@dnd-kit/sortable": ["@dnd-kit/[email protected]", "", { "dependencies": { "@dnd-kit/utilities": "^3.2.2", "tslib": "^2.0.0" }, "peerDependencies": { "@dnd-kit/core": "^6.1.0", "react": ">=16.8.0" } }, "sha512-U3jk5ebVXe1Lr7c2wU7SBZjcWdQP+j7peHJfCspnA81enlu88Mgd7CC8Q+pub9ubP7eKVETzJW+IBAhsqbSu/g=="],++ "@dnd-kit/utilities": ["@dnd-kit/[email protected]", "", { "dependencies": { "tslib": "^2.0.0" }, "peerDependencies": { "react": ">=16.8.0" } }, "sha512-+MKAJEOfaBe5SmV6t34p80MMKhjvUz0vRrvVJbPT0WElzaOJ/1xs+D+KDv+tD/NE5ujfrChEcshd4fLn0wpiqg=="],++ "@emnapi/runtime": ["@emnapi/[email protected]", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA=="],++ "@floating-ui/core": ["@floating-ui/[email protected]", "", { "dependencies": { "@floating-ui/utils": "^0.2.12" } }, "sha512-0CIZ5itps/8x7BG8dEIhs53BvCUH2PCoogtakwRTut+Arm58sJooJ0AuZhLw2HJYIR5cMLNPBSS728sPho2khQ=="],++ "@floating-ui/dom": ["@floating-ui/[email protected]", "", { "dependencies": { "@floating-ui/core": "^1.8.0", "@floating-ui/utils": "^0.2.12" } }, "sha512-yXSrzeHZBTZadLOlfyhCkJHNeLJnHRnRInwdZ40L7ZiaAtrBwoYlsDrX3v5zB1Utk7CLfzcOVnVVWoXEky7Ceg=="],++ "@floating-ui/react-dom": ["@floating-ui/[email protected]", "", { "dependencies": { "@floating-ui/dom": "^1.8.0" }, "peerDependencies": { "react": ">=16.8.0", "react-dom": ">=16.8.0" } }, "sha512-JDjEFGCpImxDCA7JJKviA0M9+RtmJdj0m/NVU5IMgBK+AmZouAQQ7/+2GLH0GXXY0YMw9oXPB8hKdbPYg5QLYg=="],++ "@floating-ui/utils": ["@floating-ui/[email protected]", "", {}, "sha512-HpCo8tmWzLVad5s2d19EhAz5zqrrQ6s69qd6moPMQvkOuSwDT1YgRfWSVuc4ennqrgv3OHppiOGMQ7oC13yIww=="],++ "@img/colour": ["@img/[email protected]", "", {}, "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ=="],++ "@img/sharp-darwin-arm64": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-arm64": "1.3.3" }, "os": "darwin", "cpu": "arm64" }, "sha512-Uhfl4V4lhP2nbUVF9+hyH1+luj86f1gUFeo8ALYxFoULoU+G87D43BfeMP8XHsk9boxAnCY/bf2EHwhA7MuGsA=="],++ "@img/sharp-darwin-x64": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-x64": "1.3.3" }, "os": "darwin", "cpu": "x64" }, "sha512-hWniXY3bG5qKpkKrAwPe4y+VTPmf086YQAnkxWh7uA1YrlRouWGa0M0Mxj3ZjnXFkv7/TD1bTy9lGUK26vRvWw=="],++ "@img/sharp-freebsd-wasm32": ["@img/[email protected]", "", { "dependencies": { "@img/sharp-wasm32": "0.35.4" }, "os": "freebsd" }, "sha512-lIsKw/BU+kjB4eZjxrYrZmwOJYi3Ajrv66iAlBmUPyKc3HpnloevB1g3wxGD9P/5BbQ1brBGl65VRRrCvQDEqA=="],++ "@img/sharp-libvips-darwin-arm64": ["@img/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-suTBPTDGrI9WodccaDdwZItTSaBYASlBk1NSfElSHrUfzu3szG6lvIF58+WiFvnfzuK8ZBFS5zE00PxqxnRiPg=="],++ "@img/sharp-libvips-darwin-x64": ["@img/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-FVJZ5mITMobmXIz/hPDTw0EintTW5H3WfrxwLqEqjiIihlu+hVRyGrFQ60xl0Lxn7Bt3zdpevPaQi0HEzqz9fw=="],++ "@img/sharp-libvips-linux-arm": ["@img/[email protected]", "", { "os": "linux", "cpu": "arm" }, "sha512-3rbU4vqXXc3hY/OiXdl52xZvT0F1yEngWfvqudtPJg/KkyiaQw2DRsFrNzpmLvfavbwOq3qXn36GP8obHRULQA=="],++ "@img/sharp-libvips-linux-arm64": ["@img/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-0DaL0A6Xu6sQSQFwe4iVCrKWU2cCTItnRsYsCdxAMm9NF6twAA9BKnoqy4hqz4+azQ0JHuA26qiUKsf1XJ/v5A=="],++ "@img/sharp-libvips-linux-ppc64": ["@img/[email protected]", "", { "os": "linux", "cpu": "ppc64" }, "sha512-cdn1OvUBwsXhbC0zSzJnNzf5MZ/mTrobawDvNXBTxe8VtqKAm0sRuEY2Evzovb/w9JMk4TvRxqt1mekSuJz64w=="],++ "@img/sharp-libvips-linux-riscv64": ["@img/[email protected]", "", { "os": "linux", "cpu": "none" }, "sha512-HjPVx7yKz+0lqdhDlTw1tt90wamBoxhiXpvl1XZpJLiHH4RCJ5yDTqH+VlYPv2fwFs89JFw4c1IexYOcQUi4IQ=="],++ "@img/sharp-libvips-linux-s390x": ["@img/[email protected]", "", { "os": "linux", "cpu": "s390x" }, "sha512-neWLh+3yCNThxnfy3c4BbVBeGgt9aftno+XbT56iK28RgeDs3UOFWviLWlUu0bArYVYJaFDK+RRohbicUNCm8Q=="],++ "@img/sharp-libvips-linux-x64": ["@img/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-4vKmvAst9nrowcqquKFAyZJUDolUaIp8uRiN0mWFguJ1IplC9/pitXtlnnlU4aa/eJw3J7i67V+pwUL+wZGdsA=="],++ "@img/sharp-libvips-linuxmusl-arm64": ["@img/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-Y9kQaLMuNoB0bPYOOdcZMaseNrFpPodIWWMrx+CZyydf2xn68j9WYc6sWWRrDwNkzCQjKYfc68L7jKjGlHMibw=="],++ "@img/sharp-libvips-linuxmusl-x64": ["@img/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-fj8Mv0HHfD1Rr+4I68+3agJynxDWtBFgicTbSOb9Bke6pIwzGcJ+RX/yHjmiEGFMCavY/dxvem7MyNaJF+wDiw=="],++ "@img/sharp-linux-arm": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm": "1.3.3" }, "os": "linux", "cpu": "arm" }, "sha512-7OAS8gI0EReKGVN2HssHlM6umJgxF5VI3xN0p9FA91p/YO+ou5hiNghLdZ5BEHztwaaK5+bLKRf8x/o2L2nk9A=="],++ "@img/sharp-linux-arm64": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-linux-arm64": "1.3.3" }, "os": "linux", "cpu": "arm64" }, "sha512-De4jpEnAU8Hd5oT0j1G3uL4ZvTuipVMn7YC6vPaJhy6/7EwEae0SVAoBrUMYQbkLGDm85taVWwuPc1a44LTzCQ=="],++ "@img/sharp-linux-ppc64": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-linux-ppc64": "1.3.3" }, "os": "linux", "cpu": "ppc64" }, "sha512-2oYZJeIl4kCcMGk4ouZVjnkCtFrpQFlNEtJ6GbxzhHQchwH0NH/qEb9ykmOl29dqwMq+JhFdZn+1ak2FKhI9fQ=="],++ "@img/sharp-linux-riscv64": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-linux-riscv64": "1.3.3" }, "os": "linux", "cpu": "none" }, "sha512-cPbNChoRURAWdebDIHSenxRpgEdy7JkPydSnUxRm9VvKD7m0/xVaR/8Fzlu81pk5nHEvHH87UZUA7cTtwnbJSA=="],++ "@img/sharp-linux-s390x": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-linux-s390x": "1.3.3" }, "os": "linux", "cpu": "s390x" }, "sha512-RY0JFY8Fd6RonCBtHz+DvadaPkXDSI1AUn6yWL9TipqkZ1vY8w8evqdgyDFnkm4/K1ve1TvZiaePP5oSd4+WVQ=="],++ "@img/sharp-linux-x64": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-linux-x64": "1.3.3" }, "os": "linux", "cpu": "x64" }, "sha512-9qvvEAuk8k89TfWUoX2htWjbAMX8p+NxCppjpcg5k6xMsjhBQPTsoIh36h9Qde4WRuGpJeYnOjdosDn/cnv+OA=="],++ "@img/sharp-linuxmusl-arm64": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-arm64": "1.3.3" }, "os": "linux", "cpu": "arm64" }, "sha512-KB5jxpfWQTr0nc3xdHtWChdbifHrBGsd2SM62Eyxrl8afikm+f5qGBU75SJIZBT/S1MC8XyacdlXBMSWq6OURA=="],++ "@img/sharp-linuxmusl-x64": ["@img/[email protected]", "", { "optionalDependencies": { "@img/sharp-libvips-linuxmusl-x64": "1.3.3" }, "os": "linux", "cpu": "x64" }, "sha512-f+eZJZIQNEEd26RPSW+76chwOf1XtA2Y/O+5ocVyLliHkeih3e+jhLVBdNTd2rS3IbNXK8+ug93Vf5ZXtF5Lxg=="],++ "@img/sharp-wasm32": ["@img/[email protected]", "", { "dependencies": { "@emnapi/runtime": "^1.11.3" } }, "sha512-zQnl4Kwp7Q6NHsENtU2T/00Zi+w3AQNwz3+UaTyVBy2FpXrzXzGjndpK61onhZjRtRpQXxCTeqw19bVyXOh7jA=="],++ "@img/sharp-webcontainers-wasm32": ["@img/[email protected]", "", { "dependencies": { "@img/sharp-wasm32": "0.35.4" }, "cpu": "none" }, "sha512-ESfNkywmCfPNyaZjxooddJQiQ+l/nTpGEOGthxiLnIHXC/CmcBixnfwUleX9mCz9ovrUUvKMap/pm8RYbzfwaA=="],++ "@img/sharp-win32-arm64": ["@img/[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-iNdlBX9gLVvqe2I3uIJSIKTq6wckP/DYxZtcqxm09x5Gi24DnFBmPAWZmr60ZyYMG0xlzo6goG3670ar+RXvRw=="],++ "@img/sharp-win32-ia32": ["@img/[email protected]", "", { "os": "win32", "cpu": "ia32" }, "sha512-kqRsbaa5CS6KHlpxnN7WhE6vAAugXyZButpRdvDWetlv6Qv4N9WTcrWzF7tXfB9T7MsoadqdI8hmwLq6UlLvtw=="],++ "@img/sharp-win32-x64": ["@img/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-XtmnYhBcrORsJ4XJngyzr/EWP0hRZLAZRFaApdKuviyqF78+ylxh2y06ZmtULAMOnObJ3ucpN0AcwSWnMowTRg=="],++ "@jridgewell/gen-mapping": ["@jridgewell/[email protected]", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA=="],++ "@jridgewell/resolve-uri": ["@jridgewell/[email protected]", "", {}, "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw=="],++ "@jridgewell/sourcemap-codec": ["@jridgewell/[email protected]", "", {}, "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="],++ "@jridgewell/trace-mapping": ["@jridgewell/[email protected]", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="],++ "@next/env": ["@next/[email protected]", "", {}, "sha512-x9Vblze1EbtltQYnNH38xCPWU3TVfBd1eXqA3+w9+BTpedkkdNpAaltXlGQ/nsc1+E0mVTNrtcbX3GoO09zeLQ=="],++ "@next/swc-darwin-arm64": ["@next/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-E/7GEqaUkt8mk/T8v9lAnrhzR06kdq1ZBkC12F8tAMkdIadwNp3H1KqHynDHrpcTlGCUdq/qu6vUL2aYVyYBdw=="],++ "@next/swc-darwin-x64": ["@next/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-yBE893/nDWTlaiBD1p+qgt7NUen4U5R6FXyH0s67Npq1S3E0cVSef1WIXC2xBRgQvwAvJq6DnS6Y6PrY0cy4Ew=="],++ "@next/swc-linux-arm64-gnu": ["@next/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-KJDpjBqBPYlvkivmyrp+Qys6k/7ksbqGQvRVc6ZEGfR+cjQxx+nUkJaWmNZJsmoOrqYNbaXByF8wa0lBwDhB3Q=="],++ "@next/swc-linux-arm64-musl": ["@next/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-mqNg2K+hvWskSRb/QM+Ix412DvBsuSF0XV+frTSw5vmoucNnIlynFwKYew8D01bfATErMOM7Bujrf0BA5DRKFA=="],++ "@next/swc-linux-x64-gnu": ["@next/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-nFncBNGAYouRHjRVaITs9beZRfhX4ssVwpnvPIAbkZVH6LtGoAVlH4bJ8Cnf9SOo9bsXgPFer/GdHtEE3JNOkw=="],++ "@next/swc-linux-x64-musl": ["@next/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-5Mf3cHDGR/Iz0ng2Bj3zUR3p5QS9YK3Hn2QiAfavFmyF48zwThAjpFoiTKNIcOHLYS4zEk+gzyJ/9deQ2ZB8yQ=="],++ "@next/swc-win32-arm64-msvc": ["@next/[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-0jkJy0C2kbrJWTk4YLa3xk80pVBpx8FCHJym7CnUfDAXe/FWv5qT7SQJbR0KuemyxaEDlEx5WT4VQJoTW+/9Qw=="],++ "@next/swc-win32-x64-msvc": ["@next/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-/YXjI1e5OXcZ7YpxRwgP/1jAV/SBKTzeVKqN2mk7mLpcICsyn3Gl5+dIfDTJp70M0ccMhyMMRso4v6mPDCGepg=="],++ "@nodelib/fs.scandir": ["@nodelib/[email protected]", "", { "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" } }, "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g=="],++ "@nodelib/fs.stat": ["@nodelib/[email protected]", "", {}, "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A=="],++ "@nodelib/fs.walk": ["@nodelib/[email protected]", "", { "dependencies": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" } }, "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg=="],++ "@radix-ui/number": ["@radix-ui/[email protected]", "", {}, "sha512-Road2bidD0uu/1BGDOWNdPI06g0lIRy6IF9GZcIrDK2KGItfor8IQwQa+yM2ERgHM1MmHxaxpTzk0/Jp42lNfA=="],++ "@radix-ui/primitive": ["@radix-ui/[email protected]", "", {}, "sha512-rqWnm76nYT8HoNNqEjpgJ7Pw/DrBj5iBTrmEPo6HTX5+VJyBNOqTdv4g89G63HuR5g0AaENoAcH7Is5fF2kZ8Q=="],++ "@radix-ui/react-arrow": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-primitive": "2.1.10" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-v4zggRcjadnI+ClKDuijlQEW4tw3NoaeHc/PwpKnLoLLKNUG4InLegkstooLcRIUWCs+8L22dGURCVuFfOKfnA=="],++ "@radix-ui/react-collection": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-compose-refs": "1.1.5", "@radix-ui/react-context": "1.2.2", "@radix-ui/react-primitive": "2.1.10", "@radix-ui/react-slot": "1.3.3" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-9W+B9NPF0NaaPh/1NJd3+KqsnlLqU9H7T2rvww+fp+T/evVXdNAyYcnfRQZFOjkR1ajQp3yORlqnI8soawLvNA=="],++ "@radix-ui/react-compose-refs": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-+48PbAAbq3didjJxa+OaWY2ZwgAKsNiRGyeHKszblZMQ+kcpd9pAaT11cMkGEie0vsOi3QdeTE6d5Fe3Gn61kA=="],++ "@radix-ui/react-context": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-RHCUGwKHDr0hDGg4X7ma4JG4/+12qxw8rkh5QKdDldlCvtja6nUx1Ef/8HVrJze81lEsgLQlqjzjGNHantgnQA=="],++ "@radix-ui/react-dialog": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/primitive": "1.1.7", "@radix-ui/react-compose-refs": "1.1.5", "@radix-ui/react-context": "1.2.2", "@radix-ui/react-dismissable-layer": "1.1.19", "@radix-ui/react-focus-guards": "1.1.6", "@radix-ui/react-focus-scope": "1.1.16", "@radix-ui/react-id": "1.1.4", "@radix-ui/react-portal": "1.1.17", "@radix-ui/react-presence": "1.1.10", "@radix-ui/react-primitive": "2.1.10", "@radix-ui/react-slot": "1.3.3", "@radix-ui/react-use-controllable-state": "1.2.6", "@radix-ui/react-use-layout-effect": "1.1.4", "aria-hidden": "^1.2.4", "react-remove-scroll": "^2.7.2" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-Ksw4WeROkO4rC9k/onilX/Ao2Cr1ku1unMNH+XSCcP4jSXYu7HDsg9n4ojMjVb22XpYjAQ9qfrFlVbru1vXDUA=="],++ "@radix-ui/react-direction": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-5pzg4FGQNpExhnhT2zlrP1wZFaYCd1K0nYWoFAdcYoYK868IEigqMX3B3f8yIoRlAhAeDWciLI6ZdCKHF9P4Vg=="],++ "@radix-ui/react-dismissable-layer": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/primitive": "1.1.7", "@radix-ui/react-compose-refs": "1.1.5", "@radix-ui/react-primitive": "2.1.10", "@radix-ui/react-use-callback-ref": "1.1.4", "@radix-ui/react-use-effect-event": "0.0.5" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-8g4pfOL9HoKKLWGiypT+dphVqjFfmcXO5GBnhsG6zI+lxAx/8feQpr+1LSN8Re3hiZ+XkLNS4O9ztK11/LzQ6w=="],++ "@radix-ui/react-dropdown-menu": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/primitive": "1.1.7", "@radix-ui/react-compose-refs": "1.1.5", "@radix-ui/react-context": "1.2.2", "@radix-ui/react-id": "1.1.4", "@radix-ui/react-menu": "2.1.24", "@radix-ui/react-primitive": "2.1.10", "@radix-ui/react-use-controllable-state": "1.2.6" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-geq8l2rJkxvkXsT9RMgtUE3P8pITFpTsvYpbySi1IH4fZEABD/Gp85myayFgxk0ktljGMJnCbeFkyTusvSvv7g=="],++ "@radix-ui/react-focus-guards": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-RNOJjfZMTyBM6xYmV3IVGXkPjIhcBAuv48POevAXwrGJhkWZ9p1rFoIS1JFooPuT193AZmRsCPhpoVJxx6OPoQ=="],++ "@radix-ui/react-focus-scope": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-compose-refs": "1.1.5", "@radix-ui/react-primitive": "2.1.10", "@radix-ui/react-use-callback-ref": "1.1.4" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-wmRZ2WWLvmt6KHy2rNPOdPUjwq5xOHY02+m+udwJTn0aNIox/rkskAvJTyTLGhPK6KgrUjlJUJpgmx/+wFiFIQ=="],++ "@radix-ui/react-id": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-use-layout-effect": "1.1.4" }, "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-TMQp2llA+RYn7JcjnrMnz7wN4pcVttPZnRZo52PLQsoLVKzNlVwUeHmfePgTgRluXFvlD3GD5g5MOVVTJCO0qA=="],++ "@radix-ui/react-label": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-primitive": "2.1.10" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-o/rdYEwZTTo5tjknnPeyQFU45kUC4i/XyeDPP+HGyi6XqpOP6Zf5Ya5vh/Yfe9Id5JiuWnnAx2XqIeD3UYZt0g=="],++ "@radix-ui/react-menu": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/primitive": "1.1.7", "@radix-ui/react-collection": "1.1.15", "@radix-ui/react-compose-refs": "1.1.5", "@radix-ui/react-context": "1.2.2", "@radix-ui/react-direction": "1.1.4", "@radix-ui/react-dismissable-layer": "1.1.19", "@radix-ui/react-focus-guards": "1.1.6", "@radix-ui/react-focus-scope": "1.1.16", "@radix-ui/react-id": "1.1.4", "@radix-ui/react-popper": "1.3.7", "@radix-ui/react-portal": "1.1.17", "@radix-ui/react-presence": "1.1.10", "@radix-ui/react-primitive": "2.1.10", "@radix-ui/react-roving-focus": "1.1.19", "@radix-ui/react-slot": "1.3.3", "@radix-ui/react-use-callback-ref": "1.1.4", "aria-hidden": "^1.2.4", "react-remove-scroll": "^2.7.2" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-uW7RVuU6Lp/ZtfeY4b3kL32zccgEWvPv1+cf17ubYzHa9cL8AHokmk36cG/XEiH/smbQvumnieXX9j/e9RqJWA=="],++ "@radix-ui/react-popover": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/primitive": "1.1.7", "@radix-ui/react-compose-refs": "1.1.5", "@radix-ui/react-context": "1.2.2", "@radix-ui/react-dismissable-layer": "1.1.19", "@radix-ui/react-focus-guards": "1.1.6", "@radix-ui/react-focus-scope": "1.1.16", "@radix-ui/react-id": "1.1.4", "@radix-ui/react-popper": "1.3.7", "@radix-ui/react-portal": "1.1.17", "@radix-ui/react-presence": "1.1.10", "@radix-ui/react-primitive": "2.1.10", "@radix-ui/react-slot": "1.3.3", "@radix-ui/react-use-controllable-state": "1.2.6", "aria-hidden": "^1.2.4", "react-remove-scroll": "^2.7.2" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-mw58MrBlyHWFisTOYignD0vf/3gdcgAR+9of1s9G/38CbFiUwH1nCDkc0AUM9IrXFgN5Ue8n45j9WCgyM1sbiQ=="],++ "@radix-ui/react-popper": ["@radix-ui/[email protected]", "", { "dependencies": { "@floating-ui/react-dom": "^2.0.0", "@radix-ui/react-arrow": "1.1.15", "@radix-ui/react-compose-refs": "1.1.5", "@radix-ui/react-context": "1.2.2", "@radix-ui/react-primitive": "2.1.10", "@radix-ui/react-use-callback-ref": "1.1.4", "@radix-ui/react-use-layout-effect": "1.1.4", "@radix-ui/react-use-rect": "1.1.4", "@radix-ui/react-use-size": "1.1.4", "@radix-ui/rect": "1.1.3" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-UsJrrd7w4wuKKTdvd/DNERVlwSlUcyXzjhyDwBk+3aPOsCjOY6ZSbxuw8E6lZTjjfP8Cpd0J8VVkrYUWyGYXyg=="],++ "@radix-ui/react-portal": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-primitive": "2.1.10", "@radix-ui/react-use-layout-effect": "1.1.4" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-vKQLcWypUnwZVvfV7UkGahH2g6ySe8M8R+zYBwPrv5byZ9QAW6cQVvNKo7GgmD+p8aYb6D9JBuvy8/WhOno2wQ=="],++ "@radix-ui/react-presence": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-use-layout-effect": "1.1.4" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-3wyzCQ6+ubRA+D4uv9m95JYLXxmOHp05qjrkjeA7uKHHtjpPggQzc6DAb0URl7j67oR0K2foO4ip27TiX037Bw=="],++ "@radix-ui/react-primitive": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-slot": "1.3.3" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-MucOnzh6hR5mid6VpkbglRAMYMjKLqRnGBbjXkzjK52fuQDd1qbkx78a5P40mkcnVXJdEVxm26E9OPAiUq7nBg=="],++ "@radix-ui/react-roving-focus": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/primitive": "1.1.7", "@radix-ui/react-collection": "1.1.15", "@radix-ui/react-compose-refs": "1.1.5", "@radix-ui/react-context": "1.2.2", "@radix-ui/react-direction": "1.1.4", "@radix-ui/react-id": "1.1.4", "@radix-ui/react-primitive": "2.1.10", "@radix-ui/react-use-callback-ref": "1.1.4", "@radix-ui/react-use-controllable-state": "1.2.6", "@radix-ui/react-use-is-hydrated": "0.1.3", "@radix-ui/react-use-layout-effect": "1.1.4" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-V9jI6hDjT7l3jsCQD9bLNvDLM3tH/gdbOTp7Tefp3hbbgCGQoK7tUvrWiRlcoBHIZ809ElXwNQwVo0B98LuTXQ=="],++ "@radix-ui/react-select": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/number": "1.1.3", "@radix-ui/primitive": "1.1.7", "@radix-ui/react-collection": "1.1.15", "@radix-ui/react-compose-refs": "1.1.5", "@radix-ui/react-context": "1.2.2", "@radix-ui/react-direction": "1.1.4", "@radix-ui/react-dismissable-layer": "1.1.19", "@radix-ui/react-focus-guards": "1.1.6", "@radix-ui/react-focus-scope": "1.1.16", "@radix-ui/react-id": "1.1.4", "@radix-ui/react-popper": "1.3.7", "@radix-ui/react-portal": "1.1.17", "@radix-ui/react-presence": "1.1.10", "@radix-ui/react-primitive": "2.1.10", "@radix-ui/react-slot": "1.3.3", "@radix-ui/react-use-callback-ref": "1.1.4", "@radix-ui/react-use-controllable-state": "1.2.6", "@radix-ui/react-use-layout-effect": "1.1.4", "@radix-ui/react-use-previous": "1.1.4", "@radix-ui/react-visually-hidden": "1.2.11", "aria-hidden": "^1.2.4", "react-remove-scroll": "^2.7.2" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-WFGImkmbzcfxeIwq/+4HvRN0pizBwbwQUED4I13ezQsDdfl38ZntN6TmR8XaSzPBqoCToe8rF75j6NPNDSzhbg=="],++ "@radix-ui/react-slot": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-compose-refs": "1.1.5" }, "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-qx7oqnYbxnK9kYI9m317qmFmEgo6ywqWvbTogdj7cL9p3/yx4M48p7Rnw5z3H890cL/ow/EeWJsuTykeZVXP5Q=="],++ "@radix-ui/react-tabs": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/primitive": "1.1.7", "@radix-ui/react-context": "1.2.2", "@radix-ui/react-direction": "1.1.4", "@radix-ui/react-id": "1.1.4", "@radix-ui/react-presence": "1.1.10", "@radix-ui/react-primitive": "2.1.10", "@radix-ui/react-roving-focus": "1.1.19", "@radix-ui/react-use-controllable-state": "1.2.6" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-UKxJlZid7FVtsk/WTxj4i4uSEgj2Au+KBbS7SQyTlzMhhn+86Cz3tISZdTa87bfEfcuvZezf2ZsxD4xuEKtkog=="],++ "@radix-ui/react-tooltip": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/primitive": "1.1.7", "@radix-ui/react-compose-refs": "1.1.5", "@radix-ui/react-context": "1.2.2", "@radix-ui/react-dismissable-layer": "1.1.19", "@radix-ui/react-id": "1.1.4", "@radix-ui/react-popper": "1.3.7", "@radix-ui/react-portal": "1.1.17", "@radix-ui/react-presence": "1.1.10", "@radix-ui/react-primitive": "2.1.10", "@radix-ui/react-slot": "1.3.3", "@radix-ui/react-use-controllable-state": "1.2.6", "@radix-ui/react-use-layout-effect": "1.1.4", "@radix-ui/react-visually-hidden": "1.2.11" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-6EamKFRRnlpdadndbZ6LMwycfwkwPte1B42hs6QA0gYhjaOKqW4PZ4pjaW9UrlDX5eVt/OjncE7BFTPL5nmZhg=="],++ "@radix-ui/react-use-callback-ref": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-R6OUY2e2fA6Yn6s+VSx5KBV6Nx8LQEhu+cz7LCej18rQ1HLyg9PSC9jP/ZNx0o6FAIK9c0F1kHylzSxKsdlkrQ=="],++ "@radix-ui/react-use-controllable-state": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/primitive": "1.1.7", "@radix-ui/react-use-effect-event": "0.0.5", "@radix-ui/react-use-layout-effect": "1.1.4" }, "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-uEQJGT97ZA/TgP/Hydw47lHu+/vQj6z/0jA+WeTbK1o9Rx45GImjpD0tc3W5ad3D6XTSR6e1yEO0FvGq6WQfVQ=="],++ "@radix-ui/react-use-effect-event": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-use-layout-effect": "1.1.4" }, "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-7cshFL8HGS/7HEiHH+9kL9HBwp2sa9yX18Knwek6KYWmXwM7pegMgta2AXMQKI+rq3JnfSj9x8wYqFMTdG1Jgg=="],++ "@radix-ui/react-use-is-hydrated": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-umO/aJ+82CpOnhDZUTbILCQf7kU/g0iv+oGs/Q8jw7IkhWBzaEP4sA268PhFAJTFetbwp3ICc6ktpI4TqtxcIw=="],++ "@radix-ui/react-use-layout-effect": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-K20DkRkUwDnxEYMBPcg3Y6voLkEy5p5QQmszZgLngKKiC7dzBR/aEuK3w1qlx2JWDUNH6FluahYdgR3BP+QbYw=="],++ "@radix-ui/react-use-previous": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-XoSLhbRbqxFtgJoi2fNHA3C6pDlY34x508vUpUGoFZfvePfHXHbE1lC4FYFMnJWgiCRroSTw6fOsXQoVS9RwZg=="],++ "@radix-ui/react-use-rect": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/rect": "1.1.3" }, "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-cSOCh6JlkmfjLyNcLiu2nB4v+nm+dkZ+Q5KHWk/soo4U7ZLiEQFKHK9/YmtBHjfCEaU43IBKQOc4/uJmCaiCTQ=="],++ "@radix-ui/react-use-size": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-use-layout-effect": "1.1.4" }, "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-D3anSY15EJoxrihpsXI6SMrmmonnQtR2ni7arO+Lfdg3O95b9hNXxONk8jA5C8ANdF/h5HMAxejgs8PWJ6rlhw=="],++ "@radix-ui/react-visually-hidden": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-primitive": "2.1.10" }, "peerDependencies": { "@types/react": "*", "@types/react-dom": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react", "@types/react-dom"] }, "sha512-NFS86RYYZb4/exihaESBGOpMJFz8MGLAfu3mOBSGByVnVPC9JPASfYubxd/8KbkQK0sYAv8lVQDEQukDX/qXvQ=="],++ "@radix-ui/rect": ["@radix-ui/[email protected]", "", {}, "sha512-JtyZR+mqgBibTo8xea3B6ZRmzZiM/YeVBtUkas6zMuXjAlfIFIW2FgqeM9eLyvEaYX66vr6DJMK+4U6LV0KhNw=="],++ "@swc/helpers": ["@swc/[email protected]", "", { "dependencies": { "tslib": "^2.8.0" } }, "sha512-5lSsMOTXURePglDfvuAQUqkGek9Hg2kksOYay2m0+XR++b2NWYL/4sWyuvVBIs8oKnJaxkdi9whaL/sqN13afw=="],++ "@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-EANqOCF9QFyra+4pfxUcX9STKJpCLjMbObVzljIJomAWSnuSIEAvyzEU53GaajbXJEgdh0iEcPL+DGvpUd4k1Q=="],++ "@types/react": ["@types/[email protected]", "", { "dependencies": { "csstype": "^3.2.2" } }, "sha512-MXfmqaVPEVgkBT/aY0aGCkRWWtByiYQXo3xdQ8r5RzuFrPiRn8Gar2tQdXSUQ2GKV3bkXckek89V8wQBY2Q/Aw=="],++ "@types/react-dom": ["@types/[email protected]", "", { "peerDependencies": { "@types/react": "^19.2.0" } }, "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ=="],++ "any-promise": ["[email protected]", "", {}, "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A=="],++ "anymatch": ["[email protected]", "", { "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" } }, "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw=="],++ "arg": ["[email protected]", "", {}, "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg=="],++ "aria-hidden": ["[email protected]", "", { "dependencies": { "tslib": "^2.0.0" } }, "sha512-ik3ZgC9dY/lYVVM++OISsaYDeg1tb0VtP5uL3ouh1koGOaUMDPpbFIei4JkFimWUFPn90sbMNMXQAIVOlnYKJA=="],++ "autoprefixer": ["[email protected]", "", { "dependencies": { "browserslist": "^4.28.6", "caniuse-lite": "^1.0.30001806", "fraction.js": "^5.3.4", "picocolors": "^1.1.1", "postcss-value-parser": "^4.2.0" }, "peerDependencies": { "postcss": "^8.1.0" }, "bin": { "autoprefixer": "bin/autoprefixer" } }, "sha512-MaU0U/za7N3r6brxD4YB/l4NSrFzLPlANv6wEuQVaIPlD3L4W9rFcQPbL/EilY9BHhHvhfcz3gInDLrEtWT4EA=="],++ "baseline-browser-mapping": ["[email protected]", "", { "bin": { "baseline-browser-mapping": "dist/cli.cjs" } }, "sha512-s4+sLr9mZ/CyqeRritFeYV/Zx73OAtmaHn6kkBS1XRoJn1hrg3xIDUcpicAEX68tkcIN0iBCgti31C8zxtkhsQ=="],++ "binary-extensions": ["[email protected]", "", {}, "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw=="],++ "braces": ["[email protected]", "", { "dependencies": { "fill-range": "^7.1.1" } }, "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA=="],++ "browserslist": ["[email protected]", "", { "dependencies": { "baseline-browser-mapping": "^2.10.44", "caniuse-lite": "^1.0.30001806", "electron-to-chromium": "^1.5.393", "node-releases": "^2.0.51", "update-browserslist-db": "^1.2.3" }, "bin": { "browserslist": "cli.js" } }, "sha512-JxV13hNrFxqjOc8alRbq9dK1MM79NEXYpma2B2J4wAtpWS5zIEIKqWPGCl7N4o7Uc7B7itylh7SuDujATRyyTw=="],++ "camelcase-css": ["[email protected]", "", {}, "sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA=="],++ "caniuse-lite": ["[email protected]", "", {}, "sha512-72Cuvd95zbSYPKq6Fhg8eDJRlzgWDf7/mtoZv6Qe/DYNCEBdNxoA3+rZAU2ZhGCpZlns3EssFavaZomckT5Uuw=="],++ "chokidar": ["[email protected]", "", { "dependencies": { "anymatch": "~3.1.2", "braces": "~3.0.2", "glob-parent": "~5.1.2", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", "readdirp": "~3.6.0" }, "optionalDependencies": { "fsevents": "~2.3.2" } }, "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw=="],++ "class-variance-authority": ["[email protected]", "", { "dependencies": { "clsx": "^2.1.1" } }, "sha512-Ka+9Trutv7G8M6WT6SeiRWz792K5qEqIGEGzXKhAE6xOWAY6pPH8U+9IY3oCMv6kqTmLsv7Xh/2w2RigkePMsg=="],++ "client-only": ["[email protected]", "", {}, "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA=="],++ "clsx": ["[email protected]", "", {}, "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA=="],++ "commander": ["[email protected]", "", {}, "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA=="],++ "core-util-is": ["[email protected]", "", {}, "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="],++ "cssesc": ["[email protected]", "", { "bin": { "cssesc": "bin/cssesc" } }, "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg=="],++ "csstype": ["[email protected]", "", {}, "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ=="],++ "detect-libc": ["[email protected]", "", {}, "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ=="],++ "detect-node-es": ["[email protected]", "", {}, "sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ=="],++ "didyoumean": ["[email protected]", "", {}, "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw=="],++ "dlv": ["[email protected]", "", {}, "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA=="],++ "electron-to-chromium": ["[email protected]", "", {}, "sha512-yHiw2Y3C3H9U6TMbOfoWK/BPreiOPXRfTWPBwQBoZG6/8TB6eOPnsy5oaRYuatR7Fw2SJ4kKforgufeo7fq0EQ=="],++ "es-errors": ["[email protected]", "", {}, "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw=="],++ "escalade": ["[email protected]", "", {}, "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA=="],++ "fast-glob": ["[email protected]", "", { "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", "glob-parent": "^5.1.2", "merge2": "^1.3.0", "micromatch": "^4.0.8" } }, "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg=="],++ "fastq": ["[email protected]", "", { "dependencies": { "reusify": "^1.0.4" } }, "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw=="],++ "fdir": ["[email protected]", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="],++ "fill-range": ["[email protected]", "", { "dependencies": { "to-regex-range": "^5.0.1" } }, "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg=="],++ "fraction.js": ["[email protected]", "", {}, "sha512-1X1NTtiJphryn/uLQz3whtY6jK3fTqoE3ohKs0tT+Ujr1W59oopxmoEh7Lu5p6vBaPbgoM0bzveAW4Qi5RyWDQ=="],++ "fsevents": ["[email protected]", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],++ "function-bind": ["[email protected]", "", {}, "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA=="],++ "get-nonce": ["[email protected]", "", {}, "sha512-FJhYRoDaiatfEkUK8HKlicmu/3SGFD51q3itKDGoSTysQJBnfOcxU5GxnhE1E6soB76MbT0MBtnKJuXyAx+96Q=="],++ "glob-parent": ["[email protected]", "", { "dependencies": { "is-glob": "^4.0.3" } }, "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A=="],++ "hasown": ["[email protected]", "", { "dependencies": { "function-bind": "^1.1.2" } }, "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A=="],++ "html-to-image": ["[email protected]", "", {}, "sha512-cuOPoI7WApyhBElTTb9oqsawRvZ0rHhaHwghRLlTuffoD1B2aDemlCruLeZrUIIdvG7gs9xeELEPm6PhuASqrg=="],++ "immediate": ["[email protected]", "", {}, "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ=="],++ "inherits": ["[email protected]", "", {}, "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="],++ "is-binary-path": ["[email protected]", "", { "dependencies": { "binary-extensions": "^2.0.0" } }, "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw=="],++ "is-core-module": ["[email protected]", "", { "dependencies": { "hasown": "^2.0.3" } }, "sha512-evOr8xfXKxE6qSR0hSXL2r3sd7ALj8+7jQEUvPYcm5sgZFdJ+AYzT6yNmJenvIYQBgIGwfwz08sL8zoL7yq2BA=="],++ "is-extglob": ["[email protected]", "", {}, "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ=="],++ "is-glob": ["[email protected]", "", { "dependencies": { "is-extglob": "^2.1.1" } }, "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg=="],++ "is-number": ["[email protected]", "", {}, "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng=="],++ "isarray": ["[email protected]", "", {}, "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="],++ "jiti": ["[email protected]", "", { "bin": { "jiti": "bin/jiti.js" } }, "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A=="],++ "js-tokens": ["[email protected]", "", {}, "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="],++ "jszip": ["[email protected]", "", { "dependencies": { "lie": "~3.3.0", "pako": "~1.0.2", "readable-stream": "~2.3.6", "setimmediate": "^1.0.5" } }, "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g=="],++ "lie": ["[email protected]", "", { "dependencies": { "immediate": "~3.0.5" } }, "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ=="],++ "lilconfig": ["[email protected]", "", {}, "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw=="],++ "lines-and-columns": ["[email protected]", "", {}, "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg=="],++ "loose-envify": ["[email protected]", "", { "dependencies": { "js-tokens": "^3.0.0 || ^4.0.0" }, "bin": { "loose-envify": "cli.js" } }, "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q=="],++ "lucide-react": ["[email protected]", "", { "peerDependencies": { "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0-rc" } }, "sha512-BVtq/DykVeIvRTJvRAgCsOwaGL8Un3Bxh8MbDxMhEWlZay3T4IpEKDEpwt5KZ0KJMHzgm6jrltxlT5eXOWXDHg=="],++ "merge2": ["[email protected]", "", {}, "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg=="],++ "micromatch": ["[email protected]", "", { "dependencies": { "braces": "^3.0.3", "picomatch": "^2.3.1" } }, "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA=="],++ "mz": ["[email protected]", "", { "dependencies": { "any-promise": "^1.0.0", "object-assign": "^4.0.1", "thenify-all": "^1.0.0" } }, "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q=="],++ "nanoid": ["[email protected]", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-Y2tUNy4ouw6tq5oDSKeQYGOyhkUBhNOcGV/02KC+6kd9eDGqdZd++mjMiIDilrBYvjEnCYvVtsuHCuP+okSfug=="],++ "next": ["[email protected]", "", { "dependencies": { "@next/env": "16.3.6", "@swc/helpers": "0.5.23", "baseline-browser-mapping": "^2.9.19", "caniuse-lite": "^1.0.30001579", "postcss": "8.5.23", "styled-jsx": "5.1.6" }, "optionalDependencies": { "@next/swc-darwin-arm64": "16.3.6", "@next/swc-darwin-x64": "16.3.6", "@next/swc-linux-arm64-gnu": "16.3.6", "@next/swc-linux-arm64-musl": "16.3.6", "@next/swc-linux-x64-gnu": "16.3.6", "@next/swc-linux-x64-musl": "16.3.6", "@next/swc-win32-arm64-msvc": "16.3.6", "@next/swc-win32-x64-msvc": "16.3.6", "sharp": "^0.35.4" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", "@playwright/test": "^1.51.1", "babel-plugin-react-compiler": "*", "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "sass": "^1.3.0" }, "optionalPeers": ["@opentelemetry/api", "@playwright/test", "babel-plugin-react-compiler", "sass"], "bin": { "next": "dist/bin/next" } }, "sha512-L+otWM/aQbYTx98aZhgEoMb4bZAXx1YVW4UMA/vuCyCoWG5HJyZUili8QAkqzrcC+5///tsz3s0M+SlyB5bLMw=="],++ "node-releases": ["[email protected]", "", {}, "sha512-wRNIrw4DmVLKQlbgOMdkMx27Wrpzes2hh5Jtbi2bjPd+4wJstWIqP5A+lscnqbm0xxmT5Bpg8Lec5ItEBwx6BQ=="],++ "normalize-path": ["[email protected]", "", {}, "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA=="],++ "object-assign": ["[email protected]", "", {}, "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg=="],++ "object-hash": ["[email protected]", "", {}, "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw=="],++ "pako": ["[email protected]", "", {}, "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw=="],++ "path-parse": ["[email protected]", "", {}, "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw=="],++ "picocolors": ["[email protected]", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="],++ "picomatch": ["[email protected]", "", {}, "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA=="],++ "pify": ["[email protected]", "", {}, "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog=="],++ "pirates": ["[email protected]", "", {}, "sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA=="],++ "postcss": ["[email protected]", "", { "dependencies": { "nanoid": "^3.3.18", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-RRuzqDtt5Y9h3quz5hWhK+TPnsmVs6WwSU6LkJMeY4HstUEDuYTG8UJSdawMRzmzAtV+KEoG8N3Qg2qLy5vM/A=="],++ "postcss-import": ["[email protected]", "", { "dependencies": { "postcss-value-parser": "^4.0.0", "read-cache": "^1.0.0", "resolve": "^1.1.7" }, "peerDependencies": { "postcss": "^8.0.0" } }, "sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew=="],++ "postcss-js": ["[email protected]", "", { "dependencies": { "camelcase-css": "^2.0.1" }, "peerDependencies": { "postcss": "^8.4.21" } }, "sha512-oIAOTqgIo7q2EOwbhb8UalYePMvYoIeRY2YKntdpFQXNosSu3vLrniGgmH9OKs/qAkfoj5oB3le/7mINW1LCfw=="],++ "postcss-load-config": ["[email protected]", "", { "dependencies": { "lilconfig": "^3.1.1" }, "peerDependencies": { "jiti": ">=1.21.0", "postcss": ">=8.0.9", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["jiti", "postcss", "tsx", "yaml"] }, "sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g=="],++ "postcss-nested": ["[email protected]", "", { "dependencies": { "postcss-selector-parser": "^6.1.1" }, "peerDependencies": { "postcss": "^8.2.14" } }, "sha512-HQbt28KulC5AJzG+cZtj9kvKB93CFCdLvog1WFLf1D+xmMvPGlBstkpTEZfK5+AN9hfJocyBFCNiqyS48bpgzQ=="],++ "postcss-selector-parser": ["[email protected]", "", { "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" } }, "sha512-bIoJLOmjCO1S9XdY/DcnR5hJxvrDir1PbGChrzXG3vw0/FOliy/fA3dmdhQ441kah4gKv+TwckGzex6wNS5cnQ=="],++ "postcss-value-parser": ["[email protected]", "", {}, "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ=="],++ "process-nextick-args": ["[email protected]", "", {}, "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="],++ "prop-types": ["[email protected]", "", { "dependencies": { "loose-envify": "^1.4.0", "object-assign": "^4.1.1", "react-is": "^16.13.1" } }, "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg=="],++ "queue-microtask": ["[email protected]", "", {}, "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A=="],++ "re-resizable": ["[email protected]", "", { "peerDependencies": { "react": "^16.13.1 || ^17.0.0 || ^18.0.0 || ^19.0.0", "react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-2xI2P3OHs5qw7K0Ud1aLILK6MQxW50TcO+DetD9eIV58j84TqYeHoZcL9H4GXFXXIh7afhH8mv5iUCXII7OW7A=="],++ "react": ["[email protected]", "", {}, "sha512-PWaYA1L/q9u2u7xYQi+Y3L3Yfnie7XyLeaJICV1MGD6LprsBxcAqGjYyr0eY3p+QdsA+x/Irkt4Qif8D63+Sbw=="],++ "react-dom": ["[email protected]", "", { "dependencies": { "scheduler": "^0.27.0" }, "peerDependencies": { "react": "^19.2.8" } }, "sha512-rVprimfGBG3DR+Tq0IQG2DT5PxKth1WIGDmj5yPmlzr4YBe7uyE+Du4oVqTDXZSHGGGXRtTJEGSSePyQCMBglQ=="],++ "react-draggable": ["[email protected]", "", { "dependencies": { "clsx": "^2.1.1", "prop-types": "^15.8.1" }, "peerDependencies": { "react": ">= 16.3.0", "react-dom": ">= 16.3.0" } }, "sha512-kTpANmKWVnFXiZ76Ag2ZowiFStuBYnJ606PI1TbUsOg29/400/JNIxI9+CuenhiAqFuXWJffz6F4UI3R51kUug=="],++ "react-is": ["[email protected]", "", {}, "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="],++ "react-remove-scroll": ["[email protected]", "", { "dependencies": { "react-remove-scroll-bar": "^2.3.7", "react-style-singleton": "^2.2.3", "tslib": "^2.1.0", "use-callback-ref": "^1.3.3", "use-sidecar": "^1.1.3" }, "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-Iqb9NjCCTt6Hf+vOdNIZGdTiH1QSqr27H/Ek9sv/a97gfueI/5h1s3yRi1nngzMUaOOToin5dI1dXKdXiF+u0Q=="],++ "react-remove-scroll-bar": ["[email protected]", "", { "dependencies": { "react-style-singleton": "^2.2.2", "tslib": "^2.0.0" }, "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-9r+yi9+mgU33AKcj6IbT9oRCO78WriSj6t/cF8DWBZJ9aOGPOTEDvdUDz1FwKim7QXWwmHqtdHnRJfhAxEG46Q=="],++ "react-rnd": ["[email protected]", "", { "dependencies": { "re-resizable": "^6.11.2", "react-draggable": "^4.5.0", "tslib": "2.6.2" }, "peerDependencies": { "react": ">=16.3.0", "react-dom": ">=16.3.0" } }, "sha512-s/sIT3pGZnQ+57egijkTp9mizjIWrJz68Pq6yd+F/wniFY3IriML18dUXnQe/HP9uMiJ+9MAp44hljG99fZu6Q=="],++ "react-style-singleton": ["[email protected]", "", { "dependencies": { "get-nonce": "^1.0.0", "tslib": "^2.0.0" }, "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-b6jSvxvVnyptAiLjbkWLE/lOnR4lfTtDAl+eUC7RZy+QQWc6wRzIV2CE6xBuMmDxc2qIihtDCZD5NPOFl7fRBQ=="],++ "read-cache": ["[email protected]", "", { "dependencies": { "pify": "^2.3.0" } }, "sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA=="],++ "readable-stream": ["[email protected]", "", { "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", "isarray": "~1.0.0", "process-nextick-args": "~2.0.0", "safe-buffer": "~5.1.1", "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" } }, "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA=="],++ "readdirp": ["[email protected]", "", { "dependencies": { "picomatch": "^2.2.1" } }, "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA=="],++ "resolve": ["[email protected]", "", { "dependencies": { "es-errors": "^1.3.0", "is-core-module": "^2.16.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA=="],++ "reusify": ["[email protected]", "", {}, "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw=="],++ "run-parallel": ["[email protected]", "", { "dependencies": { "queue-microtask": "^1.2.2" } }, "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA=="],++ "safe-buffer": ["[email protected]", "", {}, "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="],++ "scheduler": ["[email protected]", "", {}, "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q=="],++ "semver": ["[email protected]", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA=="],++ "setimmediate": ["[email protected]", "", {}, "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA=="],++ "sharp": ["[email protected]", "", { "dependencies": { "@img/colour": "^1.1.0", "detect-libc": "^2.1.2", "semver": "^7.8.5" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.35.4", "@img/sharp-darwin-x64": "0.35.4", "@img/sharp-freebsd-wasm32": "0.35.4", "@img/sharp-libvips-darwin-arm64": "1.3.3", "@img/sharp-libvips-darwin-x64": "1.3.3", "@img/sharp-libvips-linux-arm": "1.3.3", "@img/sharp-libvips-linux-arm64": "1.3.3", "@img/sharp-libvips-linux-ppc64": "1.3.3", "@img/sharp-libvips-linux-riscv64": "1.3.3", "@img/sharp-libvips-linux-s390x": "1.3.3", "@img/sharp-libvips-linux-x64": "1.3.3", "@img/sharp-libvips-linuxmusl-arm64": "1.3.3", "@img/sharp-libvips-linuxmusl-x64": "1.3.3", "@img/sharp-linux-arm": "0.35.4", "@img/sharp-linux-arm64": "0.35.4", "@img/sharp-linux-ppc64": "0.35.4", "@img/sharp-linux-riscv64": "0.35.4", "@img/sharp-linux-s390x": "0.35.4", "@img/sharp-linux-x64": "0.35.4", "@img/sharp-linuxmusl-arm64": "0.35.4", "@img/sharp-linuxmusl-x64": "0.35.4", "@img/sharp-webcontainers-wasm32": "0.35.4", "@img/sharp-win32-arm64": "0.35.4", "@img/sharp-win32-ia32": "0.35.4", "@img/sharp-win32-x64": "0.35.4" } }, "sha512-n++8XWcj+jCOr2IOl7h8LbKnGBDY4aPbmprMONBNFdn0ImXqpGVv5zliDs0V9HbmbCQLpbuo2ej9rAoOQTvMDA=="],++ "sonner": ["[email protected]", "", { "peerDependencies": { "react": "^18.0.0 || ^19.0.0 || ^19.0.0-rc", "react-dom": "^18.0.0 || ^19.0.0 || ^19.0.0-rc" } }, "sha512-DIS8z4PfJRbIyfVFDVnK9rO3eYDtse4Omcm6bt0oEr5/jtLgysmjuBl1frJ9E/EQZrFmKx2A8m/s5s9CRXIzhw=="],++ "source-map-js": ["[email protected]", "", {}, "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA=="],++ "string_decoder": ["[email protected]", "", { "dependencies": { "safe-buffer": "~5.1.0" } }, "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg=="],++ "styled-jsx": ["[email protected]", "", { "dependencies": { "client-only": "0.0.1" }, "peerDependencies": { "react": ">= 16.8.0 || 17.x.x || ^18.0.0-0 || ^19.0.0-0" } }, "sha512-qSVyDTeMotdvQYoHWLNGwRFJHC+i+ZvdBRYosOFgC+Wg1vx4frN2/RG/NA7SYqqvKNLf39P2LSRA2pu6n0XYZA=="],++ "sucrase": ["[email protected]", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.2", "commander": "^4.0.0", "lines-and-columns": "^1.1.6", "mz": "^2.7.0", "pirates": "^4.0.1", "tinyglobby": "^0.2.11", "ts-interface-checker": "^0.1.9" }, "bin": { "sucrase": "bin/sucrase", "sucrase-node": "bin/sucrase-node" } }, "sha512-DhuTmvZWux4H1UOnWMB3sk0sbaCVOoQZjv8u1rDoTV0HTdGem9hkAZtl4JZy8P2z4Bg0nT+YMeOFyVr4zcG5Tw=="],++ "supports-preserve-symlinks-flag": ["[email protected]", "", {}, "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w=="],++ "tailwind-merge": ["[email protected]", "", {}, "sha512-Oo6tHdpZsGpkKG88HJ8RR1rg/RdnEkQEfMoEk2x1XRI3F1AxeU+ijRXpiVUF4UbLfcxxRGw6TbUINKYdWVsQTQ=="],++ "tailwindcss": ["[email protected]", "", { "dependencies": { "@alloc/quick-lru": "^5.2.0", "arg": "^5.0.2", "chokidar": "^3.6.0", "didyoumean": "^1.2.2", "dlv": "^1.1.3", "fast-glob": "^3.3.2", "glob-parent": "^6.0.2", "is-glob": "^4.0.3", "jiti": "^1.21.7", "lilconfig": "^3.1.3", "micromatch": "^4.0.8", "normalize-path": "^3.0.0", "object-hash": "^3.0.0", "picocolors": "^1.1.1", "postcss": "^8.4.47", "postcss-import": "^15.1.0", "postcss-js": "^4.0.1", "postcss-load-config": "^4.0.2 || ^5.0 || ^6.0", "postcss-nested": "^6.2.0", "postcss-selector-parser": "^6.1.2", "resolve": "^1.22.8", "sucrase": "^3.35.0" }, "bin": { "tailwind": "lib/cli.js", "tailwindcss": "lib/cli.js" } }, "sha512-3ofp+LL8E+pK/JuPLPggVAIaEuhvIz4qNcf3nA1Xn2o/7fb7s/TYpHhwGDv1ZU3PkBluUVaF8PyCHcm48cKLWQ=="],++ "tailwindcss-animate": ["[email protected]", "", { "peerDependencies": { "tailwindcss": ">=3.0.0 || insiders" } }, "sha512-bl6mpH3T7I3UFxuvDEXLxy/VuFxBk5bbzplh7tXI68mwMokNYd1t9qPBHlnyTwfa4JGC4zP516I1hYYtQ/vspA=="],++ "thenify": ["[email protected]", "", { "dependencies": { "any-promise": "^1.0.0" } }, "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw=="],++ "thenify-all": ["[email protected]", "", { "dependencies": { "thenify": ">= 3.1.0 < 4" } }, "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA=="],++ "tinyglobby": ["[email protected]", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.4" } }, "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g=="],++ "to-regex-range": ["[email protected]", "", { "dependencies": { "is-number": "^7.0.0" } }, "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ=="],++ "ts-interface-checker": ["[email protected]", "", {}, "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA=="],++ "tslib": ["[email protected]", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],++ "typescript": ["[email protected]", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],++ "undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],++ "update-browserslist-db": ["[email protected]", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w=="],++ "use-callback-ref": ["[email protected]", "", { "dependencies": { "tslib": "^2.0.0" }, "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-jQL3lRnocaFtu3V00JToYz/4QkNWswxijDaCVNZRiRTO3HQDLsdu1ZtmIUvV4yPp+rvWm5j0y0TG/S61cuijTg=="],++ "use-sidecar": ["[email protected]", "", { "dependencies": { "detect-node-es": "^1.1.0", "tslib": "^2.0.0" }, "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-Fedw0aZvkhynoPYlA5WXrMCAMm+nSWdZt6lzJQ7Ok8S6Q+VsHmHpRWndVRJ8Be0ZbkfPc5LRYH+5XrzXcEeLRQ=="],++ "util-deprecate": ["[email protected]", "", {}, "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="],++ "chokidar/glob-parent": ["[email protected]", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="],++ "fast-glob/glob-parent": ["[email protected]", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="],++ "next/postcss": ["[email protected]", "", { "dependencies": { "nanoid": "^3.3.16", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-g50586zr4bZmwFiTlflMu8E0bDTb5I5gertgwAKmsdUlTQIhZtunzUlD1WSzwcVWPoAVpsrA6vlfCD7oXvRwgg=="],++ "react-rnd/tslib": ["[email protected]", "", {}, "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q=="],++ "tailwindcss/postcss": ["[email protected]", "", { "dependencies": { "nanoid": "^3.3.16", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-g50586zr4bZmwFiTlflMu8E0bDTb5I5gertgwAKmsdUlTQIhZtunzUlD1WSzwcVWPoAVpsrA6vlfCD7oXvRwgg=="],++ "tinyglobby/picomatch": ["[email protected]", "", {}, "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A=="],+ }+}diff --git a/marketing/app-store-screenshots/components.json b/marketing/app-store-screenshots/components.jsonnew file mode 100644index 00000000..405a08cd--- /dev/null+++ b/marketing/app-store-screenshots/components.json@@ -0,0 +1,21 @@+{+ "$schema": "https://ui.shadcn.com/schema.json",+ "style": "new-york",+ "rsc": true,+ "tsx": true,+ "tailwind": {+ "config": "tailwind.config.ts",+ "css": "src/app/globals.css",+ "baseColor": "neutral",+ "cssVariables": true,+ "prefix": ""+ },+ "aliases": {+ "components": "@/components",+ "utils": "@/lib/utils",+ "ui": "@/components/ui",+ "lib": "@/lib",+ "hooks": "@/hooks"+ },+ "iconLibrary": "lucide"+}diff --git a/marketing/app-store-screenshots/next.config.mjs b/marketing/app-store-screenshots/next.config.mjsnew file mode 100644index 00000000..659af57d--- /dev/null+++ b/marketing/app-store-screenshots/next.config.mjs@@ -0,0 +1,9 @@+/** @type {import('next').NextConfig} */+const nextConfig = {+ reactStrictMode: false,+ // Next 16.3+ otherwise writes AGENTS.md / CLAUDE.md into every scaffolded+ // project on first `dev`, leaving a dirty tree before anything is edited.+ agentRules: false,+};++export default nextConfig;diff --git a/marketing/app-store-screenshots/package.json b/marketing/app-store-screenshots/package.jsonnew file mode 100644index 00000000..6cd800a2--- /dev/null+++ b/marketing/app-store-screenshots/package.json@@ -0,0 +1,49 @@+{+ "name": "app-store-screenshots",+ "version": "0.1.0",+ "private": true,+ "engines": { "node": ">=20.9.0" },+ "scripts": {+ "dev": "next dev",+ "build": "next build",+ "start": "next start"+ },+ "dependencies": {+ "@dnd-kit/core": "^6.1.0",+ "@dnd-kit/sortable": "^8.0.0",+ "@dnd-kit/utilities": "^3.2.2",+ "@radix-ui/react-dialog": "^1.1.2",+ "@radix-ui/react-dropdown-menu": "^2.1.2",+ "@radix-ui/react-label": "^2.1.0",+ "@radix-ui/react-popover": "^1.1.2",+ "@radix-ui/react-select": "^2.1.2",+ "@radix-ui/react-slot": "^1.1.0",+ "@radix-ui/react-tabs": "^1.1.1",+ "@radix-ui/react-tooltip": "^1.1.4",+ "class-variance-authority": "^0.7.0",+ "clsx": "^2.1.1",+ "html-to-image": "^1.11.11",+ "jszip": "^3.10.1",+ "lucide-react": "^0.460.0",+ "next": "16.3.6",+ "react": "^19.2.8",+ "react-dom": "^19.2.8",+ "react-rnd": "^10.5.3",+ "sharp": "0.35.4",+ "sonner": "^1.7.0",+ "tailwind-merge": "^2.5.4",+ "tailwindcss-animate": "^1.0.7"+ },+ "devDependencies": {+ "@types/node": "^22",+ "@types/react": "^19.2.17",+ "@types/react-dom": "^19.2.3",+ "autoprefixer": "^10.4.20",+ "postcss": "^8.5.28",+ "tailwindcss": "^3.4.15",+ "typescript": "^5.6.3"+ },+ "overrides": {+ "nanoid": "^3.3.18"+ }+}diff --git a/marketing/app-store-screenshots/postcss.config.mjs b/marketing/app-store-screenshots/postcss.config.mjsnew file mode 100644index 00000000..2aa7205d--- /dev/null+++ b/marketing/app-store-screenshots/postcss.config.mjs@@ -0,0 +1,6 @@+export default {+ plugins: {+ tailwindcss: {},+ autoprefixer: {},+ },+};diff --git a/marketing/app-store-screenshots/public/app-icon.png b/marketing/app-store-screenshots/public/app-icon.pngnew file mode 100644index 00000000..bdcad6b1Binary files /dev/null and b/marketing/app-store-screenshots/public/app-icon.png differdiff --git a/marketing/app-store-screenshots/public/fonts/imported/.gitkeep b/marketing/app-store-screenshots/public/fonts/imported/.gitkeepnew file mode 100644index 00000000..8b137891--- /dev/null+++ b/marketing/app-store-screenshots/public/fonts/imported/.gitkeep@@ -0,0 +1 @@+diff --git a/marketing/app-store-screenshots/public/mockup.png b/marketing/app-store-screenshots/public/mockup.pngnew file mode 100644index 00000000..9302c97dBinary files /dev/null and b/marketing/app-store-screenshots/public/mockup.png differdiff --git a/marketing/app-store-screenshots/public/screenshots/apple/ipad/en/01.png b/marketing/app-store-screenshots/public/screenshots/apple/ipad/en/01.pngnew file mode 100644index 00000000..edb15ac6Binary files /dev/null and b/marketing/app-store-screenshots/public/screenshots/apple/ipad/en/01.png differdiff --git a/marketing/app-store-screenshots/public/screenshots/apple/ipad/en/02.png b/marketing/app-store-screenshots/public/screenshots/apple/ipad/en/02.pngnew file mode 100644index 00000000..5e723116Binary files /dev/null and b/marketing/app-store-screenshots/public/screenshots/apple/ipad/en/02.png differdiff --git a/marketing/app-store-screenshots/public/screenshots/apple/ipad/en/03.png b/marketing/app-store-screenshots/public/screenshots/apple/ipad/en/03.pngnew file mode 100644index 00000000..9f311dc5Binary files /dev/null and b/marketing/app-store-screenshots/public/screenshots/apple/ipad/en/03.png differdiff --git a/marketing/app-store-screenshots/public/screenshots/apple/ipad/en/04.png b/marketing/app-store-screenshots/public/screenshots/apple/ipad/en/04.pngnew file mode 100644index 00000000..5bf50477Binary files /dev/null and b/marketing/app-store-screenshots/public/screenshots/apple/ipad/en/04.png differdiff --git a/marketing/app-store-screenshots/public/screenshots/apple/ipad/en/05.png b/marketing/app-store-screenshots/public/screenshots/apple/ipad/en/05.pngnew file mode 100644index 00000000..900ad8d4Binary files /dev/null and b/marketing/app-store-screenshots/public/screenshots/apple/ipad/en/05.png differdiff --git a/marketing/app-store-screenshots/public/screenshots/apple/iphone/en/01.png b/marketing/app-store-screenshots/public/screenshots/apple/iphone/en/01.pngnew file mode 100644index 00000000..f9ddab82Binary files /dev/null and b/marketing/app-store-screenshots/public/screenshots/apple/iphone/en/01.png differdiff --git a/marketing/app-store-screenshots/public/screenshots/apple/iphone/en/02.png b/marketing/app-store-screenshots/public/screenshots/apple/iphone/en/02.pngnew file mode 100644index 00000000..f1bf6020Binary files /dev/null and b/marketing/app-store-screenshots/public/screenshots/apple/iphone/en/02.png differdiff --git a/marketing/app-store-screenshots/public/screenshots/apple/iphone/en/03.png b/marketing/app-store-screenshots/public/screenshots/apple/iphone/en/03.pngnew file mode 100644index 00000000..bc7a2dcdBinary files /dev/null and b/marketing/app-store-screenshots/public/screenshots/apple/iphone/en/03.png differdiff --git a/marketing/app-store-screenshots/public/screenshots/apple/iphone/en/04.png b/marketing/app-store-screenshots/public/screenshots/apple/iphone/en/04.pngnew file mode 100644index 00000000..5aded855Binary files /dev/null and b/marketing/app-store-screenshots/public/screenshots/apple/iphone/en/04.png differdiff --git a/marketing/app-store-screenshots/public/screenshots/apple/iphone/en/05.png b/marketing/app-store-screenshots/public/screenshots/apple/iphone/en/05.pngnew file mode 100644index 00000000..5d3107b4Binary files /dev/null and b/marketing/app-store-screenshots/public/screenshots/apple/iphone/en/05.png differdiff --git a/marketing/app-store-screenshots/public/screenshots/apple/iphone/en/06.png b/marketing/app-store-screenshots/public/screenshots/apple/iphone/en/06.pngnew file mode 100644index 00000000..eed11e4eBinary files /dev/null and b/marketing/app-store-screenshots/public/screenshots/apple/iphone/en/06.png differdiff --git a/marketing/app-store-screenshots/public/screenshots/apple/iphone/en/07.png b/marketing/app-store-screenshots/public/screenshots/apple/iphone/en/07.pngnew file mode 100644index 00000000..1f8065c1Binary files /dev/null and b/marketing/app-store-screenshots/public/screenshots/apple/iphone/en/07.png differdiff --git a/marketing/app-store-screenshots/src/app/api/project/route.ts b/marketing/app-store-screenshots/src/app/api/project/route.tsnew file mode 100644index 00000000..c99d710d--- /dev/null+++ b/marketing/app-store-screenshots/src/app/api/project/route.ts@@ -0,0 +1,89 @@+import { promises as fs } from "node:fs";+import path from "node:path";+import { createHash, randomUUID } from "node:crypto";+import { NextResponse } from "next/server";+import { projectValidationError } from "@/lib/project-validation";+import { rejectCrossSiteWrite } from "@/lib/request-guard";+import { readJsonBody } from "@/lib/request-body";++export const dynamic = "force-dynamic";++const PROJECT_FILE = "app-store-screenshots.json";++function filePath() {+ return path.join(process.cwd(), PROJECT_FILE);+}++const revision = (raw: string | null) => `"${raw === null ? "missing" : createHash("sha256").update(raw).digest("hex")}"`;+let writes: Promise<unknown> = Promise.resolve();++export async function GET() {+ try {+ const raw = await fs.readFile(filePath(), "utf8");+ const parsed = JSON.parse(raw);+ const validationError = projectValidationError(parsed);+ if (validationError) throw new Error(validationError);+ return NextResponse.json({ ok: true, state: parsed }, { headers: { ETag: revision(raw), "Cache-Control": "no-store" } });+ } catch (e) {+ const code = (e as NodeJS.ErrnoException).code;+ if (code === "ENOENT") {+ return NextResponse.json({ ok: true, state: null }, { headers: { ETag: revision(null), "Cache-Control": "no-store" } });+ }+ return NextResponse.json(+ { ok: false, error: e instanceof Error ? e.message : String(e) },+ { status: 500 },+ );+ }+}++export async function POST(req: Request) {+ // This route OVERWRITES a git-tracked file. See lib/request-guard.ts.+ const blocked = rejectCrossSiteWrite(req);+ if (blocked) {+ return NextResponse.json({ ok: false, error: blocked.error }, { status: blocked.status });+ }+ const parsed = await readJsonBody(req, 64 * 1024 * 1024);+ if (parsed.response) return parsed.response;+ const body = parsed.value;+ const validationError = projectValidationError(body);+ if (validationError) {+ return NextResponse.json({ ok: false, error: validationError }, { status: 400 });+ }+ // Compare and replace in one queue so two tabs cannot both save the same+ // revision. CLI writers may omit If-Match for backwards compatibility.+ const result = writes.then(() => writeProject(body, req.headers.get("if-match")));+ writes = result.catch(() => undefined);+ return result;+}++async function writeProject(body: unknown, expected: string | null) {+ const temporary = `${filePath()}.${randomUUID()}.tmp`;+ try {+ if (expected !== null) {+ let current: string | null;+ try { current = await fs.readFile(filePath(), "utf8"); }+ catch (error) {+ if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error;+ current = null;+ }+ if (expected !== revision(current)) {+ return NextResponse.json(+ { ok: false, error: "Project changed in another tab or on disk. Your edits are still open here; export or copy them before reloading." },+ { status: 412 },+ );+ }+ }+ const pretty = JSON.stringify(body, null, 2) + "\n";+ // Readers must see either the previous complete project or the next one.+ await fs.writeFile(temporary, pretty, "utf8");+ await fs.rename(temporary, filePath());+ return NextResponse.json({ ok: true }, { headers: { ETag: revision(pretty) } });+ } catch (e) {+ return NextResponse.json(+ { ok: false, error: e instanceof Error ? e.message : String(e) },+ { status: 500 },+ );+ } finally {+ await fs.unlink(temporary).catch(() => undefined);+ }+}diff --git a/marketing/app-store-screenshots/src/app/api/upload-font/route.ts b/marketing/app-store-screenshots/src/app/api/upload-font/route.tsnew file mode 100644index 00000000..6b7f8b74--- /dev/null+++ b/marketing/app-store-screenshots/src/app/api/upload-font/route.ts@@ -0,0 +1,106 @@+import { createHash } from "node:crypto";+import { promises as fs } from "node:fs";+import path from "node:path";+import { NextResponse } from "next/server";+import { rejectCrossSiteWrite } from "@/lib/request-guard";+import type { ImportedFont } from "@/lib/types";+import { decodeBase64, readJsonBody } from "@/lib/request-body";+import { writeAsset } from "@/lib/write-asset";++export const dynamic = "force-dynamic";++const FONT_DIR_REL = path.join("public", "fonts", "imported");+const PUBLIC_PREFIX = "/fonts/imported";+const MAX_FONT_BYTES = 16 * 1024 * 1024;++const FONT_EXT: Record<ImportedFont["format"], string> = {+ woff2: "woff2",+ woff: "woff",+ truetype: "ttf",+ opentype: "otf",+};++// The stored format and extension come from the file's magic bytes, never+// from the caller-supplied filename or MIME type.+function sniffFontFormat(bytes: Buffer): ImportedFont["format"] | null {+ if (bytes.length < 4) return null;+ const tag = bytes.subarray(0, 4);+ if (tag.equals(Buffer.from("wOF2", "latin1"))) return "woff2";+ if (tag.equals(Buffer.from("wOFF", "latin1"))) return "woff";+ if (tag.equals(Buffer.from([0x00, 0x01, 0x00, 0x00])) || tag.equals(Buffer.from("true", "latin1"))) {+ return "truetype";+ }+ if (tag.equals(Buffer.from("OTTO", "latin1"))) return "opentype";+ return null;+}++// Check container lengths and table bounds before persisting. Glyph validity+// is checked by the browser's FontFace decoder before the UI imports the file.+function hasFontStructure(bytes: Buffer, format: ImportedFont["format"]): boolean {+ const web = format === "woff" || format === "woff2";+ const header = web ? (format === "woff2" ? 48 : 44) : 12;+ if (bytes.length < header) return false;+ const count = bytes.readUInt16BE(web ? 12 : 4);+ if (!count) return false;+ if (web && (bytes.readUInt32BE(8) !== bytes.length || bytes.readUInt16BE(14) !== 0 ||+ bytes.readUInt32BE(16) > 64 * 1024 * 1024)) return false;+ if (format === "woff2") {+ const compressed = bytes.readUInt32BE(20);+ return compressed > 0 && header + count * 2 + compressed <= bytes.length;+ }+ const stride = web ? 20 : 16;+ const directoryEnd = header + count * stride;+ if (directoryEnd > bytes.length) return false;+ for (let i = 0; i < count; i++) {+ const entry = header + i * stride;+ const offset = bytes.readUInt32BE(entry + (web ? 4 : 8));+ const length = bytes.readUInt32BE(entry + (web ? 8 : 12));+ if (offset < directoryEnd || offset + length > bytes.length) return false;+ if (web && length > bytes.readUInt32BE(entry + 12)) return false;+ }+ return true;+}++export async function POST(req: Request) {+ // This route WRITES A FILE to disk. See lib/request-guard.ts.+ const blocked = rejectCrossSiteWrite(req);+ if (blocked) {+ return NextResponse.json({ ok: false, error: blocked.error }, { status: blocked.status });+ }+ const input = await readJsonBody(req, 23 * 1024 * 1024);+ if (input.response) return input.response;+ const body = input.value as { data?: unknown } | null;+ if (typeof body?.data !== "string" || !body.data) {+ return NextResponse.json({ ok: false, error: "Choose a font file first." }, { status: 400 });+ }+ // Reject oversized payloads before decoding (base64 is ~4/3 of the byte size).+ if (body.data.length > Math.ceil(MAX_FONT_BYTES / 3) * 4) {+ return NextResponse.json({ ok: false, error: "Font file is too large (16MB maximum)." }, { status: 413 });+ }+ const bytes = decodeBase64(body.data);+ if (!bytes) return NextResponse.json({ ok: false, error: "Invalid base64 font data" }, { status: 400 });+ if (bytes.byteLength > MAX_FONT_BYTES) {+ return NextResponse.json({ ok: false, error: "Font file is too large (16MB maximum)." }, { status: 413 });+ }+ const format = sniffFontFormat(bytes);+ if (!format || !hasFontStructure(bytes, format)) {+ return NextResponse.json({ ok: false, error: "Use a WOFF2, WOFF, TTF, or OTF font file." }, { status: 400 });+ }++ const hash = createHash("sha1").update(bytes).digest("hex").slice(0, 16);+ const filename = `${hash}.${FONT_EXT[format]}`;+ const absDir = path.join(process.cwd(), FONT_DIR_REL);+ const absFile = path.join(absDir, filename);++ try {+ await fs.mkdir(absDir, { recursive: true });+ await writeAsset(absFile, bytes);+ const font: ImportedFont = { src: `${PUBLIC_PREFIX}/${filename}`, format };+ return NextResponse.json({ ok: true, font });+ } catch (e) {+ return NextResponse.json(+ { ok: false, error: e instanceof Error ? e.message : String(e) },+ { status: 500 },+ );+ }+}diff --git a/marketing/app-store-screenshots/src/app/api/upload/route.ts b/marketing/app-store-screenshots/src/app/api/upload/route.tsnew file mode 100644index 00000000..f71f041b--- /dev/null+++ b/marketing/app-store-screenshots/src/app/api/upload/route.ts@@ -0,0 +1,87 @@+import { createHash } from "node:crypto";+import { promises as fs } from "node:fs";+import path from "node:path";+import { NextResponse } from "next/server";+import { rejectCrossSiteWrite, sniffImageType } from "@/lib/request-guard";+import sharp from "sharp";+import { decodeBase64, readJsonBody } from "@/lib/request-body";+import { writeAsset } from "@/lib/write-asset";++export const dynamic = "force-dynamic";++const UPLOAD_DIR_REL = path.join("public", "screenshots", "uploaded");+const PUBLIC_PREFIX = "/screenshots/uploaded";++const MIME_EXT: Record<string, string> = {+ "image/png": "png",+ "image/jpeg": "jpg",+ "image/jpg": "jpg",+};++function parseDataUrl(dataUrl: string): { mime: string; bytes: Buffer } | null {+ const m = /^data:([^;]+);base64,(.+)$/.exec(dataUrl);+ if (!m) return null;+ const mime = m[1].toLowerCase();+ const bytes = decodeBase64(m[2]);+ return bytes ? { mime, bytes } : null;+}++export async function POST(req: Request) {+ // This route WRITES A FILE to disk. See lib/request-guard.ts.+ const blocked = rejectCrossSiteWrite(req);+ if (blocked) {+ return NextResponse.json({ ok: false, error: blocked.error }, { status: blocked.status });+ }+ const input = await readJsonBody(req, 12 * 1024 * 1024);+ if (input.response) return input.response;+ const body = input.value as { dataUrl?: string } | null;+ if (!body?.dataUrl || typeof body.dataUrl !== "string") {+ return NextResponse.json({ ok: false, error: "Missing dataUrl" }, { status: 400 });+ }+ const parsed = parseDataUrl(body.dataUrl);+ if (!parsed) {+ return NextResponse.json({ ok: false, error: "Unsupported data URL" }, { status: 400 });+ }+ const ext = MIME_EXT[parsed.mime];+ if (!ext) {+ return NextResponse.json(+ { ok: false, error: `Unsupported mime: ${parsed.mime}` },+ { status: 400 },+ );+ }+ // The declared MIME comes from the caller-written data URL, so it decides+ // the stored extension. Require the bytes to actually be that image type.+ const sniffed = sniffImageType(parsed.bytes);+ if (!sniffed || MIME_EXT[sniffed] !== ext) {+ return NextResponse.json(+ { ok: false, error: "Content does not match declared image type" },+ { status: 400 },+ );+ }+ if (parsed.bytes.byteLength > 8 * 1024 * 1024) {+ return NextResponse.json({ ok: false, error: "Image too large (>8MB)" }, { status: 413 });+ }++ try {+ // Decode pixels too: valid headers alone still accept truncated images.+ await sharp(parsed.bytes, { limitInputPixels: 64 * 1024 * 1024, failOn: "warning" }).stats();+ } catch {+ return NextResponse.json({ ok: false, error: "Image is corrupt or exceeds 64 megapixels" }, { status: 400 });+ }++ const hash = createHash("sha1").update(parsed.bytes).digest("hex").slice(0, 16);+ const filename = `${hash}.${ext}`;+ const absDir = path.join(process.cwd(), UPLOAD_DIR_REL);+ const absFile = path.join(absDir, filename);++ try {+ await fs.mkdir(absDir, { recursive: true });+ await writeAsset(absFile, parsed.bytes);+ return NextResponse.json({ ok: true, path: `${PUBLIC_PREFIX}/${filename}` });+ } catch (e) {+ return NextResponse.json(+ { ok: false, error: e instanceof Error ? e.message : String(e) },+ { status: 500 },+ );+ }+}diff --git a/marketing/app-store-screenshots/src/app/fonts/imported/[filename]/route.ts b/marketing/app-store-screenshots/src/app/fonts/imported/[filename]/route.tsnew file mode 100644index 00000000..6fee670d--- /dev/null+++ b/marketing/app-store-screenshots/src/app/fonts/imported/[filename]/route.ts@@ -0,0 +1,8 @@+import { serveAsset } from "@/lib/serve-asset";++export const dynamic = "force-dynamic";++export async function GET(_req: Request, context: { params: Promise<{ filename: string }> }) {+ const { filename } = await context.params;+ return serveAsset("fonts/imported", filename, { woff2: "font/woff2", woff: "font/woff", ttf: "font/ttf", otf: "font/otf" });+}diff --git a/marketing/app-store-screenshots/src/app/globals.css b/marketing/app-store-screenshots/src/app/globals.cssnew file mode 100644index 00000000..06e96039--- /dev/null+++ b/marketing/app-store-screenshots/src/app/globals.css@@ -0,0 +1,125 @@+@tailwind base;+@tailwind components;+@tailwind utilities;++@layer base {+ :root {+ --background: 240 14% 99%;+ --foreground: 240 10% 10%;+ --card: 240 14% 99%;+ --card-foreground: 240 10% 10%;+ --popover: 240 16% 99%;+ --popover-foreground: 240 10% 10%;+ --primary: 240 8% 12%;+ --primary-foreground: 240 14% 98%;+ --secondary: 240 9% 95%;+ --secondary-foreground: 240 8% 14%;+ --muted: 240 9% 95%;+ --muted-foreground: 240 5% 32%;+ --accent: 240 9% 94%;+ --accent-foreground: 240 8% 14%;+ --destructive: 0 78% 56%;+ --destructive-foreground: 240 14% 98%;+ --border: 240 9% 90%;+ --input: 240 9% 90%;+ --ring: 240 6% 62%;+ --radius: 0.625rem;+ }++ .dark {+ --background: 240 12% 5%;+ --foreground: 240 12% 96%;+ --card: 240 12% 5%;+ --card-foreground: 240 12% 96%;+ --popover: 240 12% 6%;+ --popover-foreground: 240 12% 96%;+ --primary: 240 12% 96%;+ --primary-foreground: 240 10% 10%;+ --secondary: 240 8% 16%;+ --secondary-foreground: 240 12% 96%;+ --muted: 240 8% 14%;+ --muted-foreground: 240 6% 75%;+ --accent: 240 8% 16%;+ --accent-foreground: 240 12% 96%;+ --destructive: 0 70% 38%;+ --destructive-foreground: 240 12% 96%;+ --border: 240 8% 16%;+ --input: 240 8% 16%;+ --ring: 240 8% 70%;+ }+}++@layer base {+ * {+ @apply border-border;+ }+ body {+ @apply bg-background text-foreground;+ -webkit-font-smoothing: antialiased;+ -moz-osx-font-smoothing: grayscale;+ }++ [contenteditable]:empty::before {+ content: attr(data-placeholder);+ opacity: 0.4;+ }+}++/* react-rnd editable element hint: subtle outline + visible resize handles on hover */+.rnd-editable {+ cursor: move;+ outline: 2px dashed transparent;+ outline-offset: 4px;+ transition: outline-color 120ms ease;+}+.rnd-editable:hover {+ outline-color: rgba(91, 124, 250, 0.55);+}+.rnd-editable:focus-within,+.rnd-editable.rnd-selected {+ outline-color: rgba(91, 124, 250, 0.9);+ outline-style: solid;+}++.rnd-rotate-handle {+ position: absolute;+ right: -14px;+ top: -14px;+ z-index: 20;+ display: flex;+ height: 28px;+ width: 28px;+ align-items: center;+ justify-content: center;+ border-radius: 999px;+ border: 1px solid rgba(91, 124, 250, 0.65);+ background: rgba(255, 255, 255, 0.92);+ color: rgba(30, 41, 59, 0.92);+ box-shadow: 0 8px 22px rgba(15, 23, 42, 0.2);+ cursor: grab;+ opacity: 0;+ transition:+ opacity 120ms ease,+ transform 120ms ease;+}++.rnd-editable:hover .rnd-rotate-handle,+.rnd-editable.rnd-selected .rnd-rotate-handle,+.rnd-rotate-handle:focus-visible {+ opacity: 1;+}++.rnd-rotate-handle:hover,+.rnd-rotate-handle:focus-visible {+ transform: scale(1.05);+}++.rnd-rotate-handle:active {+ cursor: grabbing;+}++/* Show a visible cursor outline on contenteditable text inside Rnd while focused. */+.rnd-editable [contenteditable]:focus {+ box-shadow: 0 0 0 2px rgba(91, 124, 250, 0.45);+ border-radius: 2px;+}diff --git a/marketing/app-store-screenshots/src/app/layout.tsx b/marketing/app-store-screenshots/src/app/layout.tsxnew file mode 100644index 00000000..dd21acf6--- /dev/null+++ b/marketing/app-store-screenshots/src/app/layout.tsx@@ -0,0 +1,18 @@+import type { Metadata } from "next";+import { Inter } from "next/font/google";+import "./globals.css";++const font = Inter({ subsets: ["latin"] });++export const metadata: Metadata = {+ title: "App Store Screenshots",+ description: "Design and export App Store + Google Play screenshots.",+};++export default function RootLayout({ children }: { children: React.ReactNode }) {+ return (+ <html lang="en">+ <body className={font.className}>{children}</body>+ </html>+ );+}diff --git a/marketing/app-store-screenshots/src/app/page.tsx b/marketing/app-store-screenshots/src/app/page.tsxnew file mode 100644index 00000000..a23984c9--- /dev/null+++ b/marketing/app-store-screenshots/src/app/page.tsx@@ -0,0 +1,5 @@+import { ScreenshotEditor } from "@/components/editor/screenshot-editor";++export default function Page() {+ return <ScreenshotEditor />;+}diff --git a/marketing/app-store-screenshots/src/app/screenshots/uploaded/[filename]/route.ts b/marketing/app-store-screenshots/src/app/screenshots/uploaded/[filename]/route.tsnew file mode 100644index 00000000..609639c7--- /dev/null+++ b/marketing/app-store-screenshots/src/app/screenshots/uploaded/[filename]/route.ts@@ -0,0 +1,8 @@+import { serveAsset } from "@/lib/serve-asset";++export const dynamic = "force-dynamic";++export async function GET(_req: Request, context: { params: Promise<{ filename: string }> }) {+ const { filename } = await context.params;+ return serveAsset("screenshots/uploaded", filename, { png: "image/png", jpg: "image/jpeg" });+}diff --git a/marketing/app-store-screenshots/src/components/editor/background-controls.tsx b/marketing/app-store-screenshots/src/components/editor/background-controls.tsxnew file mode 100644index 00000000..04942b44--- /dev/null+++ b/marketing/app-store-screenshots/src/components/editor/background-controls.tsx@@ -0,0 +1,78 @@+"use client";+import * as React from "react";+import { Input } from "@/components/ui/input";+import { Label } from "@/components/ui/label";+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from "@/components/ui/select";+import { cleanHexColor } from "@/lib/clean-hex-color";+import type { Slide, Theme } from "@/lib/types";++type Props = {+ slide: Slide;+ theme: Theme;+ onChange: (patch: Partial<Slide>) => void;+};++export function BackgroundControls({ slide, theme, onChange }: Props) {+ const mode = slide.backgroundColor ? "custom" : slide.inverted ? "alternate" : "theme";+ const customColor = cleanHexColor(slide.backgroundColor) || cleanHexColor(theme.bg) || "#FFFFFF";+ // Keep partial hex input local so typing "#0B" or clearing the field doesn't+ // write an invalid color into the slide (or drop it out of custom mode).+ const [draft, setDraft] = React.useState(customColor);+ React.useEffect(() => setDraft(customColor), [customColor]);++ return (+ <div className="space-y-1.5">+ <Label className="text-xs">Background</Label>+ <Select+ value={mode}+ onValueChange={(nextMode) => {+ if (nextMode === "theme") onChange({ inverted: false, backgroundColor: undefined });+ if (nextMode === "alternate") onChange({ inverted: true, backgroundColor: undefined });+ if (nextMode === "custom") onChange({ inverted: false, backgroundColor: customColor });+ }}+ >+ <SelectTrigger aria-label="Background"><SelectValue /></SelectTrigger>+ <SelectContent>+ <SelectItem value="theme">Theme background</SelectItem>+ <SelectItem value="alternate">Theme alternate</SelectItem>+ <SelectItem value="custom">Custom color</SelectItem>+ </SelectContent>+ </Select>+ {mode === "custom" && (+ <div className="flex items-center gap-2">+ <input+ type="color"+ value={customColor}+ onChange={(event) => onChange({ backgroundColor: event.target.value.toUpperCase() })}+ className="h-8 w-10 cursor-pointer rounded border bg-transparent p-0.5"+ aria-label="Custom background color"+ />+ <Input+ value={draft}+ onChange={(event) => {+ const next = event.target.value.toUpperCase();+ setDraft(next);+ const color = cleanHexColor(next);+ if (color) onChange({ backgroundColor: color });+ }}+ onBlur={() => setDraft(customColor)}+ placeholder="#0B0908"+ className="h-8 font-mono text-xs uppercase"+ aria-label="Custom background hex color"+ />+ </div>+ )}+ {mode === "custom" && (+ <p className="text-[11px] text-muted-foreground">+ Caption text switches to a readable colour when the theme's colours would be too faint.+ </p>+ )}+ </div>+ );+}diff --git a/marketing/app-store-screenshots/src/components/editor/create-image-mask.ts b/marketing/app-store-screenshots/src/components/editor/create-image-mask.tsnew file mode 100644index 00000000..4e17abe3--- /dev/null+++ b/marketing/app-store-screenshots/src/components/editor/create-image-mask.ts@@ -0,0 +1,18 @@+import type { ImageElement } from "@/lib/types";++export function createImageMask(fade: ImageElement["fade"]): string | undefined {+ if (!fade || fade.amount <= 0) return undefined;++ const amount = Math.max(1, Math.min(100, fade.amount));++ const direction = {+ top: "to bottom",+ bottom: "to top",+ left: "to right",+ right: "to left",+ }[fade.edge];+ const transparentEdge = amount * 0.25;+ const solidOppositeEdge = amount * 0.75;++ return `linear-gradient(${direction}, transparent 0%, transparent ${transparentEdge}%, #000 ${solidOppositeEdge}%, #000 100%)`;+}diff --git a/marketing/app-store-screenshots/src/components/editor/device-frames.tsx b/marketing/app-store-screenshots/src/components/editor/device-frames.tsxnew file mode 100644index 00000000..f6182912--- /dev/null+++ b/marketing/app-store-screenshots/src/components/editor/device-frames.tsx@@ -0,0 +1,477 @@+"use client";+import * as React from "react";+import { MAC_RATIO, MAC_TITLE_BAR, PHONE_SCREEN } from "@/lib/constants";+import { img } from "@/lib/image-cache";++type FrameProps = {+ src: string;+ alt?: string;+ style?: React.CSSProperties;+ /** When true, hide EmptySlot placeholder (so it doesn't bake into exports). */+ hideEmpty?: boolean;+};++// iPhone — uses pre-measured mockup.png overlay+export function Phone({ src, alt = "", style, hideEmpty }: FrameProps) {+ const resolved = img(src);+ return (+ <div style={{ position: "relative", aspectRatio: "1022 / 2082", ...style }}>+ {/* The screen layer covers the bezel's centre, so the exporter checks the+ whole mockup (its visible bezel) rather than its hidden middle. */}+ <img+ src={img("/mockup.png")}+ alt=""+ data-export-check="full"+ style={{ display: "block", width: "100%", height: "100%" }}+ draggable={false}+ />+ <div+ style={{+ position: "absolute",+ zIndex: 10,+ overflow: "hidden",+ left: `${PHONE_SCREEN.L}%`,+ top: `${PHONE_SCREEN.T}%`,+ width: `${PHONE_SCREEN.W}%`,+ height: `${PHONE_SCREEN.H}%`,+ borderRadius: `${PHONE_SCREEN.RX}% / ${PHONE_SCREEN.RY}%`,+ background: "#111",+ }}+ >+ {resolved ? (+ <img+ src={resolved}+ alt={alt}+ style={{ display: "block", width: "100%", height: "100%", objectFit: "cover", objectPosition: "top" }}+ draggable={false}+ />+ ) : hideEmpty ? null : (+ <EmptySlot />+ )}+ </div>+ </div>+ );+}++export function AndroidPhone({ src, alt = "", style, hideEmpty }: FrameProps) {+ const resolved = img(src);+ return (+ <div style={{ position: "relative", aspectRatio: "9 / 19.5", ...style }}>+ <div+ style={{+ width: "100%",+ height: "100%",+ borderRadius: "8% / 4%",+ background: "linear-gradient(160deg, #2a2a2e 0%, #18181b 100%)",+ boxShadow: "inset 0 0 0 1px rgba(255,255,255,0.08), 0 8px 40px rgba(0,0,0,0.55)",+ position: "relative",+ overflow: "hidden",+ }}+ >+ <div+ style={{+ position: "absolute",+ top: "1.5%",+ left: "50%",+ transform: "translateX(-50%)",+ width: "3%",+ height: "1.4%",+ borderRadius: "50%",+ background: "#0d0d0f",+ border: "1px solid rgba(255,255,255,0.06)",+ zIndex: 20,+ }}+ />+ <div+ style={{+ position: "absolute",+ left: "3.5%",+ top: "2%",+ width: "93%",+ height: "96%",+ borderRadius: "5.5% / 2.6%",+ overflow: "hidden",+ background: "#000",+ }}+ >+ {resolved ? (+ <img+ src={resolved}+ alt={alt}+ style={{ display: "block", width: "100%", height: "100%", objectFit: "cover", objectPosition: "top" }}+ draggable={false}+ />+ ) : hideEmpty ? null : (+ <EmptySlot />+ )}+ </div>+ </div>+ </div>+ );+}++export function AndroidTabletP({ src, alt = "", style, hideEmpty }: FrameProps) {+ const resolved = img(src);+ return (+ <div style={{ position: "relative", aspectRatio: "5 / 8", ...style }}>+ <div+ style={{+ width: "100%",+ height: "100%",+ borderRadius: "4.5% / 2.8%",+ background: "linear-gradient(160deg, #2a2a2e 0%, #18181b 100%)",+ boxShadow: "inset 0 0 0 1px rgba(255,255,255,0.08), 0 8px 48px rgba(0,0,0,0.6)",+ position: "relative",+ overflow: "hidden",+ }}+ >+ <div+ style={{+ position: "absolute",+ top: "1.2%",+ left: "50%",+ transform: "translateX(-50%)",+ width: "1.4%",+ height: "0.88%",+ borderRadius: "50%",+ background: "#0d0d0f",+ zIndex: 20,+ }}+ />+ <div+ style={{+ position: "absolute",+ left: "3.5%",+ top: "2.2%",+ width: "93%",+ height: "95.6%",+ borderRadius: "2.5% / 1.6%",+ overflow: "hidden",+ background: "#000",+ }}+ >+ {resolved ? (+ <img+ src={resolved}+ alt={alt}+ style={{ display: "block", width: "100%", height: "100%", objectFit: "cover", objectPosition: "top" }}+ draggable={false}+ />+ ) : hideEmpty ? null : (+ <EmptySlot />+ )}+ </div>+ </div>+ </div>+ );+}++export function AndroidTabletL({ src, alt = "", style, hideEmpty }: FrameProps) {+ const resolved = img(src);+ return (+ <div style={{ position: "relative", aspectRatio: "8 / 5", ...style }}>+ <div+ style={{+ width: "100%",+ height: "100%",+ borderRadius: "2.8% / 4.5%",+ background: "linear-gradient(160deg, #2a2a2e 0%, #18181b 100%)",+ boxShadow: "inset 0 0 0 1px rgba(255,255,255,0.08), 0 8px 48px rgba(0,0,0,0.6)",+ position: "relative",+ overflow: "hidden",+ }}+ >+ <div+ style={{+ position: "absolute",+ left: "1.2%",+ top: "50%",+ transform: "translateY(-50%)",+ width: "0.88%",+ height: "1.4%",+ borderRadius: "50%",+ background: "#0d0d0f",+ zIndex: 20,+ }}+ />+ <div+ style={{+ position: "absolute",+ left: "2.2%",+ top: "3.5%",+ width: "95.6%",+ height: "93%",+ borderRadius: "1.6% / 2.5%",+ overflow: "hidden",+ background: "#000",+ }}+ >+ {resolved ? (+ <img+ src={resolved}+ alt={alt}+ style={{ display: "block", width: "100%", height: "100%", objectFit: "cover", objectPosition: "top" }}+ draggable={false}+ />+ ) : hideEmpty ? null : (+ <EmptySlot />+ )}+ </div>+ </div>+ </div>+ );+}++// Mac window: title bar + a content area that is exactly 16:10, the Mac App+// Store's own aspect, so a full-screen or 16:10 capture fills it uncropped.+export function MacWindow({ src, alt = "", style, hideEmpty }: FrameProps) {+ const resolved = img(src);+ const titleBar = `${(MAC_TITLE_BAR / (1 + MAC_TITLE_BAR)) * 100}%`;+ const light = (color: string) => (+ <span+ style={{+ width: "1.1%",+ aspectRatio: "1",+ borderRadius: "50%",+ background: color,+ boxShadow: "inset 0 0 0 0.5px rgba(0,0,0,0.25)",+ flexShrink: 0,+ }}+ />+ );+ return (+ <div style={{ position: "relative", aspectRatio: `${MAC_RATIO}`, ...style }}>+ <div+ style={{+ width: "100%",+ height: "100%",+ // Circular corners: the vertical radius is scaled by the frame aspect.+ borderRadius: `1.1% / ${1.1 * MAC_RATIO}%`,+ background: "#1C1C1E",+ boxShadow: "inset 0 0 0 1px rgba(255,255,255,0.12), 0 18px 60px rgba(0,0,0,0.40)",+ overflow: "hidden",+ display: "flex",+ flexDirection: "column",+ }}+ >+ <div+ style={{+ height: titleBar,+ boxSizing: "border-box",+ display: "flex",+ alignItems: "center",+ gap: "0.75%",+ padding: "0 1.3%",+ background: "linear-gradient(180deg, #3D3D40 0%, #323235 100%)",+ boxShadow: "inset 0 -1px 0 rgba(0,0,0,0.35)",+ flexShrink: 0,+ }}+ >+ {light("#FF5F57")}+ {light("#FEBC2E")}+ {light("#28C840")}+ </div>+ <div style={{ flex: 1, overflow: "hidden", background: "#111", minHeight: 0 }}>+ {resolved ? (+ <img+ src={resolved}+ alt={alt}+ style={{ display: "block", width: "100%", height: "100%", objectFit: "cover", objectPosition: "top" }}+ draggable={false}+ />+ ) : hideEmpty ? null : (+ <EmptySlot />+ )}+ </div>+ </div>+ </div>+ );+}++export function IPad({ src, alt = "", style, hideEmpty }: FrameProps) {+ const resolved = img(src);+ return (+ <div style={{ position: "relative", aspectRatio: "770 / 1000", ...style }}>+ <div+ style={{+ width: "100%",+ height: "100%",+ borderRadius: "5% / 3.6%",+ background: "linear-gradient(180deg, #2C2C2E 0%, #1C1C1E 100%)",+ position: "relative",+ overflow: "hidden",+ boxShadow: "inset 0 0 0 1px rgba(255,255,255,0.1), 0 8px 40px rgba(0,0,0,0.6)",+ }}+ >+ <div+ style={{+ position: "absolute",+ top: "1.2%",+ left: "50%",+ transform: "translateX(-50%)",+ width: "0.9%",+ height: "0.65%",+ borderRadius: "50%",+ background: "#111113",+ zIndex: 20,+ }}+ />+ <div+ style={{+ position: "absolute",+ left: "4%",+ top: "2.8%",+ width: "92%",+ height: "94.4%",+ borderRadius: "2.2% / 1.6%",+ overflow: "hidden",+ background: "#000",+ }}+ >+ {resolved ? (+ <img+ src={resolved}+ alt={alt}+ style={{ display: "block", width: "100%", height: "100%", objectFit: "cover", objectPosition: "top" }}+ draggable={false}+ />+ ) : hideEmpty ? null : (+ <EmptySlot />+ )}+ </div>+ </div>+ </div>+ );+}++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.+ return (+ <div+ style={{+ width: "100%",+ height: "100%",+ containerType: "inline-size",+ background: "linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%)",+ }}+ >+ <div+ style={{+ width: "100%",+ height: "100%",+ display: "flex",+ alignItems: "center",+ justifyContent: "center",+ color: "rgba(255,255,255,0.4)",+ fontSize: "6cqw",+ textAlign: "center",+ padding: "8%",+ boxSizing: "border-box",+ }}+ >+ Drop a screenshot here+ </div>+ </div>+ );+}++// ---------- Apple TV ----------+// The screenshot IS the content, so there is no device UI to draw. A thin dark+// bezel reads as "TV" without competing with the capture. `bare` renders the+// capture edge-to-edge with no bezel at all.+export function AppleTV({ src, alt = "", style, hideEmpty, bare }: FrameProps & { bare?: boolean }) {+ const resolved = img(src);+ return (+ <div style={{ position: "relative", aspectRatio: "16 / 9", ...style }}>+ <div+ style={{+ width: "100%", height: "100%",+ borderRadius: bare ? "0.6% / 1.1%" : "1.1% / 2.0%",+ background: bare ? "transparent" : "#0A0A0C",+ padding: bare ? "0" : "0.9%",+ boxSizing: "border-box",+ boxShadow: bare+ ? "0 18px 60px rgba(0,0,0,0.28)"+ : "0 22px 70px rgba(0,0,0,0.40), inset 0 0 0 1px rgba(255,255,255,0.06)",+ overflow: "hidden",+ }}+ >+ <div style={{ width: "100%", height: "100%", overflow: "hidden", background: "#111",+ borderRadius: bare ? "0.6% / 1.1%" : "0.5% / 0.9%" }}>+ {resolved ? (+ <img src={resolved} alt={alt} draggable={false}+ style={{ display: "block", width: "100%", height: "100%", objectFit: "cover", objectPosition: "center" }} />+ ) : hideEmpty ? null : (<EmptySlot />)}+ </div>+ </div>+ </div>+ );+}++// ---------- Apple Watch ----------+// Cushion-shaped body with a very large corner radius, plus the digital crown and+// side button on the right. The bezel is proportionally much thicker than a phone's,+// which is what makes a watch read as a watch at small sizes.+export function AppleWatch({ src, alt = "", style, hideEmpty }: FrameProps) {+ const resolved = img(src);+ return (+ <div style={{ position: "relative", aspectRatio: "422 / 514", ...style }}>+ {/* crown + side button */}+ <div style={{ position: "absolute", right: "-2.6%", top: "27%", width: "3.4%", height: "12%",+ background: "linear-gradient(180deg,#8E8E93,#5A5A5E)", borderRadius: "40%" }} />+ <div style={{ position: "absolute", right: "-1.8%", top: "45%", width: "2.4%", height: "14%",+ background: "linear-gradient(180deg,#6E6E73,#48484A)", borderRadius: "40%" }} />+ <div+ style={{+ width: "100%", height: "100%",+ borderRadius: "26% / 21%",+ background: "#0A0A0C",+ padding: "6.5%",+ boxSizing: "border-box",+ boxShadow: "0 18px 50px rgba(0,0,0,0.42), inset 0 0 0 1px rgba(255,255,255,0.08)",+ overflow: "hidden",+ }}+ >+ <div style={{ width: "100%", height: "100%", overflow: "hidden", background: "#000",+ borderRadius: "22% / 18%" }}>+ {resolved ? (+ <img src={resolved} alt={alt} draggable={false}+ style={{ display: "block", width: "100%", height: "100%", objectFit: "cover", objectPosition: "center" }} />+ ) : hideEmpty ? null : (<EmptySlot />)}+ </div>+ </div>+ </div>+ );+}++// ---------- CarPlay ----------+// A dashboard head unit: wide, squared-off, minimal bezel. Deliberately plainer than+// the TV frame because CarPlay screens are set into a fascia rather than being a+// product silhouette anyone recognises.+export function CarPlayScreen({ src, alt = "", style, hideEmpty }: FrameProps) {+ const resolved = img(src);+ return (+ <div style={{ position: "relative", aspectRatio: "800 / 480", ...style }}>+ <div+ style={{+ width: "100%", height: "100%",+ borderRadius: "2.2% / 3.6%",+ background: "#0B0B0D",+ padding: "1.6%",+ boxSizing: "border-box",+ boxShadow: "0 20px 60px rgba(0,0,0,0.40), inset 0 0 0 1px rgba(255,255,255,0.07)",+ overflow: "hidden",+ }}+ >+ <div style={{ width: "100%", height: "100%", overflow: "hidden", background: "#000",+ borderRadius: "1.4% / 2.3%" }}>+ {resolved ? (+ <img src={resolved} alt={alt} draggable={false}+ style={{ display: "block", width: "100%", height: "100%", objectFit: "cover", objectPosition: "center" }} />+ ) : hideEmpty ? null : (<EmptySlot />)}+ </div>+ </div>+ </div>+ );+}diff --git a/marketing/app-store-screenshots/src/components/editor/font-importer.tsx b/marketing/app-store-screenshots/src/components/editor/font-importer.tsxnew file mode 100644index 00000000..ebb2ea73--- /dev/null+++ b/marketing/app-store-screenshots/src/components/editor/font-importer.tsx@@ -0,0 +1,86 @@+"use client";+import * as React from "react";+import { toast } from "sonner";+import { cleanFontName } from "@/lib/clean-imported-font";+import type { ImportedFont } from "@/lib/types";++export type FontImporterHandle = { open: () => void };++type Props = {+ onImported: (font: ImportedFont) => void;+ onUploadingChange?: (uploading: boolean) => void;+};++const MAX_FONT_BYTES = 16 * 1024 * 1024;++async function fileToBase64(file: File): Promise<string> {+ const dataUrl = await new Promise<string>((resolve, reject) => {+ const reader = new FileReader();+ reader.onloadend = () => resolve(reader.result as string);+ reader.onerror = reject;+ reader.readAsDataURL(file);+ });+ return dataUrl.slice(dataUrl.indexOf(",") + 1);+}++// Hidden file input behind the toolbar's "Import font…" menu item. The server+// validates the file by its magic bytes and stores it under+// public/fonts/imported/<hash>.<ext>.+export const FontImporter = React.forwardRef<FontImporterHandle, Props>(function FontImporter(+ { onImported, onUploadingChange },+ ref,+) {+ const inputRef = React.useRef<HTMLInputElement>(null);+ const requestId = React.useRef(0);+ React.useEffect(() => () => { requestId.current += 1; }, []);+ React.useImperativeHandle(ref, () => ({ open: () => inputRef.current?.click() }), []);++ async function importFont(file: File) {+ const request = ++requestId.current;+ onUploadingChange?.(true);+ try {+ if (file.size > MAX_FONT_BYTES) throw new Error("Font file is too large (16MB maximum).");+ await new FontFace("Import validation", await file.arrayBuffer()).load();+ if (request !== requestId.current) return;+ const response = await fetch("/api/upload-font", {+ method: "POST",+ headers: { "content-type": "application/json" },+ body: JSON.stringify({ data: await fileToBase64(file) }),+ signal: AbortSignal.timeout(15000),+ });+ const data = (await response.json().catch(() => ({ ok: false }))) as {+ ok: boolean;+ error?: string;+ font?: ImportedFont;+ };+ if (request !== requestId.current) return;+ if (!response.ok || !data.ok || !data.font) throw new Error(data.error || "Could not import that font.");+ const name = cleanFontName(file.name.replace(/\.[^.]+$/, ""));+ onImported({ ...data.font, ...(name ? { name } : {}) });+ toast.success(`Imported ${name ?? "font"}`);+ } catch (caught) {+ if (request !== requestId.current) return;+ toast.error("Font import failed", {+ description: caught instanceof Error ? caught.message : "Could not import that font.",+ });+ } finally {+ if (request === requestId.current) onUploadingChange?.(false);+ }+ }++ return (+ <input+ ref={inputRef}+ type="file"+ accept=".woff2,.woff,.ttf,.otf,font/woff2,font/woff,font/ttf,font/otf"+ className="sr-only"+ tabIndex={-1}+ aria-hidden+ onChange={(event) => {+ const file = event.target.files?.[0];+ if (file) void importFont(file);+ event.target.value = "";+ }}+ />+ );+});diff --git a/marketing/app-store-screenshots/src/components/editor/image-element-canvas.tsx b/marketing/app-store-screenshots/src/components/editor/image-element-canvas.tsxnew file mode 100644index 00000000..a3388bb7--- /dev/null+++ b/marketing/app-store-screenshots/src/components/editor/image-element-canvas.tsx@@ -0,0 +1,46 @@+"use client";+import * as React from "react";+import { ImagePlus } from "lucide-react";+import { createImageMask } from "@/components/editor/create-image-mask";+import { img } from "@/lib/image-cache";+import type { ImageElement } from "@/lib/types";++type Props = {+ element: ImageElement;+ editable?: boolean;+};++// Image overlay content. Placement, rotation, and drag/resize handles come from+// the shared Movable wrapper in slide-canvas so overlays behave like text.+export function ImageElementCanvas({ element, editable }: Props) {+ const source = img(element.src);+ const maskImage = createImageMask(element.fade);++ if (!source) {+ // The empty placeholder is an editing affordance only; never export it.+ if (!editable) return null;+ return (+ <div className="flex h-full w-full items-center justify-center border border-dashed border-current/40 bg-black/10 text-current/70">+ <ImagePlus className="h-6 w-6" aria-hidden />+ <span className="sr-only">Pick an image in the inspector</span>+ </div>+ );+ }++ return (+ // eslint-disable-next-line @next/next/no-img-element+ <img+ src={source}+ alt=""+ draggable={false}+ style={{+ width: "100%",+ height: "100%",+ display: "block",+ objectFit: element.fit || "cover",+ maskImage,+ WebkitMaskImage: maskImage,+ }}+ />+ );+}diff --git a/marketing/app-store-screenshots/src/components/editor/inspector.tsx b/marketing/app-store-screenshots/src/components/editor/inspector.tsxnew file mode 100644index 00000000..e3505bb5--- /dev/null+++ b/marketing/app-store-screenshots/src/components/editor/inspector.tsx@@ -0,0 +1,1149 @@+"use client";+import * as React from "react";+import {+ AlignCenter,+ AlignLeft,+ AlignRight,+ ArrowDownToLine,+ ArrowUpToLine,+ ChevronDown,+ ChevronUp,+ ImagePlus,+ Lightbulb,+ Plus,+ RotateCcw,+ RotateCw,+ Trash2,+ Type,+} from "lucide-react";+import { Button } from "@/components/ui/button";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuLabel,+ DropdownMenuSeparator,+ DropdownMenuTrigger,+} from "@/components/ui/dropdown-menu";+import { Input } from "@/components/ui/input";+import { Label } from "@/components/ui/label";+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from "@/components/ui/select";+import { Textarea } from "@/components/ui/textarea";+import { LAYOUT_HINT, LAYOUT_LABEL } from "@/lib/constants";+import { COPY_IDEA_SLOTS } from "@/lib/copy-ideas";+import { nid } from "@/lib/defaults";+import { img } from "@/lib/image-cache";+import {+ isBuiltInElementId,+ imageElementKey,+ isImageElementId,+ isTextElementId,+ toImageElementId,+ textElementKey,+ toTextElementId,+} from "@/lib/elements";+import { pickText, writeLocalized } from "@/lib/locale";+import { slideColors } from "@/lib/contrast";+import { cn } from "@/lib/utils";+import {+ cleanTypography,+ defaultTextElementFontSize,+ FONT_SCALE_DEFAULT,+ FONT_SCALE_MAX,+ FONT_SCALE_MIN,+ slideFontScales,+ textElementFontSizeRange,+} from "@/lib/typography";+import type {+ BuiltInElementId,+ Device,+ ElementId,+ ElementTransform,+ ImageElement,+ Orientation,+ Slide,+ SlideLayout,+ SlideTypography,+ TextElement,+ Theme,+} from "@/lib/types";+import { BackgroundControls } from "./background-controls";+import { ScreenshotPicker } from "./screenshot-picker";+import { getCanvas, getElementTransform } from "./slide-canvas";++type Props = {+ slide: Slide;+ device: Device;+ orientation: Orientation;+ theme: Theme;+ locale: string;+ appIcon?: string;+ onAppIconChange: (src: string) => void;+ selectedElementId: ElementId | null;+ onChange: (patch: Partial<Slide>) => void;+ /** Patch computed from the slide's latest state (safe after async work). */+ onUpdate: (update: (slide: Slide) => Partial<Slide>) => void;+ onSelectElement: (id: ElementId | null) => void;+};++const ELEMENT_LABEL: Record<BuiltInElementId, string> = {+ caption: "Headline",+ device: "Device",+ deviceSecondary: "Back device",+};++export function Inspector({+ slide,+ device,+ orientation,+ theme,+ locale,+ appIcon,+ onAppIconChange,+ selectedElementId,+ onChange,+ onUpdate,+ onSelectElement,+}: Props) {+ 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 localeLabel = slide.label?.[locale] ?? "";+ const localeHeadline = slide.headline?.[locale] ?? "";+ // When the active locale is empty, surface the fallback (typically en) as+ // the placeholder so the user sees what they're translating from.+ const headlineDefault = isFeatureGraphic ? "Your tagline." : "One idea\nper slide.";+ const labelPlaceholder = localeLabel ? "FEATURE 01" : pickText(slide.label, locale) || "FEATURE 01";+ const headlinePlaceholder = localeHeadline+ ? headlineDefault+ : pickText(slide.headline, locale) || headlineDefault;++ function setLocaleField(key: "label" | "headline", value: string) {+ onChange({ [key]: writeLocalized(slide[key], locale, value) } as Partial<Slide>);+ }++ return (+ <div className="flex h-full flex-col">+ <div className="border-b p-3">+ <div className="flex items-baseline justify-between gap-2">+ <h2 className="text-sm font-semibold">Screen settings</h2>+ <span className="text-[10px] uppercase tracking-wide text-muted-foreground">+ editing · {locale.toUpperCase()}+ </span>+ </div>+ <p className="text-xs text-muted-foreground">{LAYOUT_HINT[layoutValue]}</p>+ </div>++ <div className="flex-1 space-y-4 overflow-y-auto p-3">+ <div className="space-y-1.5">+ <Label className="text-xs">Layout</Label>+ <Select+ value={layoutValue}+ onValueChange={(layout) => {+ const next = layout as SlideLayout;+ onChange({+ layout: next,+ transforms: undefined,+ screenshotSecondary:+ next === "two-devices" ? slide.screenshotSecondary || slide.screenshot : slide.screenshotSecondary,+ });+ }}+ >+ <SelectTrigger aria-label="Layout">+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ {layoutOptions.map(([layout, label]) => (+ <SelectItem key={layout} value={layout}>+ {label}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ </div>++ <BackgroundControls slide={isFeatureGraphic ? { ...slide, inverted: slide.inverted ?? true } : slide} theme={theme} onChange={onChange} />++ {!isFeatureGraphic && (+ <div className="space-y-1.5">+ <Label className="text-xs">Label</Label>+ <Input+ aria-label="Label"+ value={localeLabel}+ onChange={(e) => setLocaleField("label", e.target.value)}+ placeholder={labelPlaceholder}+ />+ </div>+ )}++ <div className="space-y-1.5">+ <div className="flex items-baseline justify-between">+ <Label className="text-xs">{isFeatureGraphic ? "Tagline" : "Headline"}</Label>+ <div className="flex items-center gap-2">+ <span className="text-[10px] text-muted-foreground">newline = break</span>+ <CopyIdeasMenu onPick={(formula) => setLocaleField("headline", formula)} />+ </div>+ </div>+ <Textarea+ aria-label={isFeatureGraphic ? "Tagline" : "Headline"}+ value={localeHeadline}+ onChange={(e) => setLocaleField("headline", e.target.value)}+ rows={3}+ placeholder={headlinePlaceholder}+ />+ </div>++ <TypographySection slide={slide} isFeatureGraphic={isFeatureGraphic} onChange={onChange} />++ {!isFeatureGraphic && !isNoDevice && (+ <div className="space-y-1.5">+ <Label className="text-xs">+ {slide.layout === "two-devices" ? "Front device screenshot" : "Screenshot"}+ </Label>+ <ScreenshotPicker+ label="Primary"+ value={slide.screenshot}+ locale={locale}+ onChange={(v) => onChange({ screenshot: v })}+ />+ </div>+ )}++ {slide.layout === "two-devices" && (+ <div className="space-y-1.5">+ <Label className="text-xs">Back device screenshot</Label>+ <ScreenshotPicker+ label="Secondary (back layer)"+ value={slide.screenshotSecondary || ""}+ locale={locale}+ onChange={(v) => onChange({ screenshotSecondary: v })}+ />+ </div>+ )}++ {!isFeatureGraphic && (+ <ElementTransformControls+ slide={slide}+ defaultTextColor={slideColors(theme, slide).fg}+ device={device}+ orientation={orientation}+ locale={locale}+ selectedElementId={selectedElementId}+ onChange={onChange}+ onUpdate={onUpdate}+ onSelectElement={onSelectElement}+ />+ )}++ {isFeatureGraphic && (+ <div className="space-y-1.5">+ <Label className="text-xs">App icon</Label>+ <ScreenshotPicker label="Icon (shared by every banner)" value={appIcon || ""} onChange={onAppIconChange} />+ <p className="text-[11px] leading-relaxed text-muted-foreground">+ Shows app icon + name + tagline. Leave the icon blank to use the app's initial. Name is set in the toolbar.+ </p>+ </div>+ )}+ </div>+ </div>+ );+}++function CopyIdeasMenu({ onPick }: { onPick: (formula: string) => void }) {+ return (+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <Button+ type="button"+ variant="ghost"+ size="sm"+ className="h-6 gap-1 px-1.5 text-[11px] text-muted-foreground"+ title="Insert a headline formula, then replace the [bracketed] words"+ >+ <Lightbulb className="h-3 w-3" />+ Copy ideas+ </Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end" className="max-h-[420px] w-72 overflow-y-auto">+ {COPY_IDEA_SLOTS.map((slot, i) => (+ <React.Fragment key={slot.id}>+ {i > 0 && <DropdownMenuSeparator />}+ <DropdownMenuLabel className="text-[10px] uppercase tracking-wide text-muted-foreground">+ {slot.name}+ </DropdownMenuLabel>+ {slot.ideas.map((idea) => (+ <DropdownMenuItem+ key={idea.formula}+ onSelect={() => onPick(idea.formula)}+ className="flex-col items-start gap-0.5"+ >+ <span className="text-xs font-medium">{idea.formula.replace(/\n/g, " / ")}</span>+ <span className="text-[11px] text-muted-foreground">{idea.example}</span>+ </DropdownMenuItem>+ ))}+ </React.Fragment>+ ))}+ </DropdownMenuContent>+ </DropdownMenu>+ );+}++function ElementTransformControls({+ slide,+ defaultTextColor,+ device,+ orientation,+ locale,+ selectedElementId,+ onChange,+ onUpdate,+ onSelectElement,+}: {+ slide: Slide;+ defaultTextColor: string;+ device: Device;+ orientation: Orientation;+ locale: string;+ selectedElementId: ElementId | null;+ onChange: (patch: Partial<Slide>) => void;+ onUpdate: (update: (slide: Slide) => Partial<Slide>) => void;+ onSelectElement: (id: ElementId | null) => void;+}) {+ const present: ElementId[] = ["caption"];+ if (slide.layout !== "no-device") present.push("device");+ if (slide.layout === "two-devices") present.push("deviceSecondary");+ for (const element of slide.textElements || []) present.push(toTextElementId(element.id));+ for (const element of slide.imageElements || []) present.push(toImageElementId(element.id));++ const transforms = slide.transforms || {};+ const activeId =+ selectedElementId && present.includes(selectedElementId) ? selectedElementId : null;+ const activeTransform = activeId+ ? getElementTransform(slide, device, orientation, activeId)+ : undefined;+ const { cW, cH } = getCanvas(device, orientation);+ const activeTextElement =+ activeId && isTextElementId(activeId)+ ? slide.textElements?.find((element) => element.id === textElementKey(activeId))+ : null;+ const activeImageElement =+ activeId && isImageElementId(activeId)+ ? slide.imageElements?.find((element) => element.id === imageElementKey(activeId))+ : null;++ function getTransform(id: ElementId) {+ return getElementTransform(slide, device, orientation, id);+ }++ function patchElement(id: ElementId, patch: Partial<ElementTransform>) {+ const cur = getTransform(id);+ if (!cur) return;+ if (isTextElementId(id)) {+ const textId = textElementKey(id);+ onChange({+ textElements: (slide.textElements || []).map((element) =>+ element.id === textId+ ? { ...element, transform: { ...element.transform, ...patch } }+ : element,+ ),+ });+ return;+ }+ if (isImageElementId(id)) {+ const imageId = imageElementKey(id);+ onUpdate((latest) => ({+ imageElements: (latest.imageElements || []).map((element) =>+ element.id === imageId+ ? { ...element, transform: { ...element.transform, ...patch } }+ : element,+ ),+ }));+ return;+ }+ if (!isBuiltInElementId(id)) return;+ onChange({+ transforms: { ...transforms, [id]: { ...cur, ...patch } },+ });+ }++ function patchTextElement(id: string, patch: Partial<TextElement>) {+ onChange({+ textElements: (slide.textElements || []).map((element) =>+ element.id === id ? { ...element, ...patch } : element,+ ),+ });+ }++ function setTextElementValue(element: TextElement, value: string) {+ patchTextElement(element.id, { text: writeLocalized(element.text, locale, value) });+ }++ function deleteTextElement(element: TextElement) {+ const nextTextElements = (slide.textElements || []).filter((item) => item.id !== element.id);+ onChange({+ textElements: nextTextElements.length > 0 ? nextTextElements : undefined,+ });+ onSelectElement(null);+ }++ // Functional updates: an image upload can finish after the user has moved or+ // resized the overlay, and a patch built from the render-time slide would+ // silently revert that move.+ function patchImageElement(id: string, patch: Partial<ImageElement>) {+ onUpdate((latest) => ({+ imageElements: (latest.imageElements || []).map((element) =>+ element.id === id ? { ...element, ...patch } : element,+ ),+ }));+ }++ // The first image picked for an overlay reshapes its frame to the image's+ // aspect ratio (centred on the old frame), so "Fill frame" doesn't crop a+ // wide logo into a square. Replacing an image keeps the frame as placed.+ const imageRequests = React.useRef(new Map<string, number>());+ React.useEffect(() => () => imageRequests.current.clear(), []);+ async function setImageSource(id: string, src: string) {+ const request = (imageRequests.current.get(id) || 0) + 1;+ imageRequests.current.set(id, request);+ const size = src ? await naturalSize(img(src)) : null;+ if (imageRequests.current.get(id) !== request) return;+ onUpdate((latest) => ({+ imageElements: (latest.imageElements || []).map((element) => {+ if (element.id !== id) return element;+ if (!size || element.src) return { ...element, src };+ return { ...element, src, transform: fitToAspect(element.transform, size.w / size.h, cH * 0.6) };+ }),+ }));+ }++ function deleteImageElement(element: ImageElement) {+ onUpdate((latest) => {+ const nextImageElements = (latest.imageElements || []).filter((item) => item.id !== element.id);+ return { imageElements: nextImageElements.length > 0 ? nextImageElements : undefined };+ });+ onSelectElement(null);+ }++ function addTextElement() {+ const id = nid();+ const zIndex =+ Math.max(+ 5,+ ...present.map((elementId) => getTransform(elementId)?.zIndex ?? defaultZ(elementId)),+ ) + 1;+ const element: TextElement = {+ id,+ text: writeLocalized({}, locale, "New text"),+ transform: {+ x: cW * 0.18,+ y: cH * 0.42,+ width: cW * 0.64,+ height: cH * 0.12,+ rotation: 0,+ zIndex,+ },+ fontWeight: 800,+ align: "center",+ };+ onChange({ textElements: [...(slide.textElements || []), element] });+ onSelectElement(toTextElementId(id));+ }++ function addImageElement() {+ const { cW, cH } = getCanvas(device, orientation);+ const id = nid();+ const zIndex = Math.max(5, ...present.map((elementId) => getTransform(elementId)?.zIndex ?? defaultZ(elementId))) + 1;+ const element: ImageElement = {+ id,+ src: "",+ transform: {+ x: cW * 0.25,+ y: cH * 0.36,+ width: cW * 0.5,+ height: cW * 0.5,+ rotation: 0,+ zIndex,+ },+ fit: "cover",+ };+ onChange({ imageElements: [...(slide.imageElements || []), element] });+ onSelectElement(toImageElementId(id));+ }++ // Z-order: re-rank zIndex among present elements so they remain contiguous.+ function reorder(id: ElementId, dir: "front" | "back" | "up" | "down") {+ const ranked = [...present].sort((a, b) => {+ const za = getTransform(a)?.zIndex ?? defaultZ(a);+ const zb = getTransform(b)?.zIndex ?? defaultZ(b);+ return za - zb;+ });+ const idx = ranked.indexOf(id);+ if (idx === -1) return;+ let target = idx;+ if (dir === "front") target = ranked.length - 1;+ else if (dir === "back") target = 0;+ else if (dir === "up") target = Math.min(ranked.length - 1, idx + 1);+ else if (dir === "down") target = Math.max(0, idx - 1);+ if (target === idx) return;+ ranked.splice(idx, 1);+ ranked.splice(target, 0, id);+ const nextTransforms = { ...transforms };+ const nextTextElements = (slide.textElements || []).map((element) => ({+ ...element,+ transform: { ...element.transform },+ }));+ const nextImageElements = (slide.imageElements || []).map((element) => ({+ ...element,+ transform: { ...element.transform },+ }));+ ranked.forEach((eid, i) => {+ const cur = getTransform(eid);+ if (!cur) return;+ if (isTextElementId(eid)) {+ const textId = textElementKey(eid);+ const textElement = nextTextElements.find((element) => element.id === textId);+ if (textElement) textElement.transform = { ...textElement.transform, zIndex: i + 1 };+ } else if (isImageElementId(eid)) {+ const imageId = imageElementKey(eid);+ const imageElement = nextImageElements.find((element) => element.id === imageId);+ if (imageElement) imageElement.transform = { ...imageElement.transform, zIndex: i + 1 };+ } else if (isBuiltInElementId(eid)) {+ nextTransforms[eid] = { ...cur, zIndex: i + 1 };+ }+ });+ onChange({ transforms: nextTransforms, textElements: nextTextElements, imageElements: nextImageElements });+ }++ return (+ <div className="space-y-3 rounded-md border bg-muted/30 p-3">+ <div className="space-y-1">+ <div className="flex items-center justify-between gap-2">+ <Label className="text-xs font-semibold">Elements</Label>+ <div className="flex items-center gap-1.5">+ <Button+ type="button"+ variant="outline"+ size="sm"+ className="h-7 shrink-0 px-2 text-xs"+ onClick={addTextElement}+ >+ <Plus className="h-3.5 w-3.5" />+ Text+ </Button>+ <Button+ type="button"+ variant="outline"+ size="sm"+ className="h-7 shrink-0 px-2 text-xs"+ onClick={addImageElement}+ title="Add a PNG or JPG overlay (logo, photo, badge)"+ >+ <ImagePlus className="h-3.5 w-3.5" />+ Image+ </Button>+ </div>+ </div>+ <p className="text-[11px] text-muted-foreground">+ {activeId+ ? "Fine-tune the selected element's rotation and stacking."+ : "Click an element on the canvas to fine-tune its rotation and stacking."}+ </p>+ </div>++ {activeId ? (+ <ActiveElementPanel+ key={activeId}+ activeId={activeId}+ transform={activeTransform}+ textElement={activeTextElement || undefined}+ imageElement={activeImageElement || undefined}+ locale={locale}+ canvas={{ cW, cH }}+ defaultTextColor={defaultTextColor}+ onRotate={(rotation) => patchElement(activeId, { rotation })}+ onReorder={(dir) => reorder(activeId, dir)}+ onTextChange={(value) => {+ if (activeTextElement) setTextElementValue(activeTextElement, value);+ }}+ onTextPatch={(patch) => {+ if (activeTextElement) patchTextElement(activeTextElement.id, patch);+ }}+ onDeleteText={() => {+ if (activeTextElement) deleteTextElement(activeTextElement);+ }}+ onImageSource={(src) => {+ if (activeImageElement) void setImageSource(activeImageElement.id, src);+ }}+ onImagePatch={(patch) => {+ if (activeImageElement) patchImageElement(activeImageElement.id, patch);+ }}+ onDeleteImage={() => {+ if (activeImageElement) deleteImageElement(activeImageElement);+ }}+ />+ ) : (+ <div className="rounded border border-dashed bg-background/40 p-4 text-center text-[11px] text-muted-foreground">+ No element selected+ </div>+ )}+ </div>+ );+}++function ActiveElementPanel({+ activeId,+ transform,+ textElement,+ imageElement,+ locale,+ canvas,+ defaultTextColor,+ onRotate,+ onReorder,+ onTextChange,+ onTextPatch,+ onDeleteText,+ onImagePatch,+ onImageSource,+ onDeleteImage,+}: {+ activeId: ElementId;+ transform: ElementTransform | undefined;+ textElement?: TextElement;+ imageElement?: ImageElement;+ locale: string;+ canvas: { cW: number; cH: number };+ defaultTextColor: string;+ onRotate: (rotation: number) => void;+ onReorder: (dir: "front" | "back" | "up" | "down") => void;+ onTextChange: (value: string) => void;+ onTextPatch: (patch: Partial<TextElement>) => void;+ onDeleteText: () => void;+ onImagePatch: (patch: Partial<ImageElement>) => void;+ onImageSource: (src: string) => void;+ onDeleteImage: () => void;+}) {+ const engaged = !!transform;+ const rotation = transform?.rotation ?? 0;+ const label = elementLabel(activeId);+ return (+ <div className="space-y-2 rounded border bg-background/60 p-2.5">+ <div className="flex items-center justify-between">+ <span className="flex items-center gap-1 text-xs font-medium">+ {textElement && <Type className="h-3.5 w-3.5" />}+ {imageElement && <ImagePlus className="h-3.5 w-3.5" />}+ {label}+ </span>+ {textElement || imageElement ? (+ <Button+ type="button"+ variant="ghost"+ size="icon"+ className="h-6 w-6 hover:text-destructive"+ onClick={textElement ? onDeleteText : onDeleteImage}+ title={textElement ? "Delete text element" : "Delete image element"}+ aria-label={textElement ? "Delete text element" : "Delete image element"}+ >+ <Trash2 className="h-3.5 w-3.5" />+ </Button>+ ) : !engaged ? (+ <span className="text-[10px] text-muted-foreground">drag to enable</span>+ ) : null}+ </div>++ {textElement && (+ <TextElementPanel+ key={textElement.id}+ element={textElement}+ locale={locale}+ canvas={canvas}+ defaultColor={defaultTextColor}+ onTextChange={onTextChange}+ onTextPatch={onTextPatch}+ />+ )}++ {imageElement && (+ <ImageElementPanel element={imageElement} onPatch={onImagePatch} onSourceChange={onImageSource} />+ )}++ <div className="space-y-1">+ <div className="flex items-center justify-between">+ <Label className="flex items-center gap-1 text-[11px] text-muted-foreground">+ <RotateCw className="h-3 w-3" /> Rotation+ </Label>+ <span className="text-[11px] tabular-nums text-muted-foreground">+ {rotation}°+ </span>+ </div>+ <input+ type="range"+ min={-180}+ max={180}+ step={1}+ value={rotation}+ disabled={!engaged}+ onChange={(e) => onRotate(Number(e.target.value))}+ className="w-full disabled:opacity-50"+ aria-label={`${label} rotation`}+ />+ </div>++ <div className="space-y-1">+ <Label className="text-[11px] text-muted-foreground">Layer</Label>+ <div className="grid grid-cols-4 gap-1">+ <LayerButton disabled={!engaged} onClick={() => onReorder("back")} label="Send to back">+ <ArrowDownToLine className="h-3.5 w-3.5" />+ </LayerButton>+ <LayerButton disabled={!engaged} onClick={() => onReorder("down")} label="Send backward">+ <ChevronDown className="h-3.5 w-3.5" />+ </LayerButton>+ <LayerButton disabled={!engaged} onClick={() => onReorder("up")} label="Bring forward">+ <ChevronUp className="h-3.5 w-3.5" />+ </LayerButton>+ <LayerButton disabled={!engaged} onClick={() => onReorder("front")} label="Bring to front">+ <ArrowUpToLine className="h-3.5 w-3.5" />+ </LayerButton>+ </div>+ </div>+ </div>+ );+}++function ImageElementPanel({+ element,+ onPatch,+ onSourceChange,+}: {+ element: ImageElement;+ onPatch: (patch: Partial<ImageElement>) => void;+ onSourceChange: (src: string) => void;+}) {+ return (+ <div className="space-y-2">+ <ScreenshotPicker label="Image" value={element.src} onChange={onSourceChange} />+ <div className="grid grid-cols-2 gap-2">+ <div className="space-y-1">+ <Label className="text-[11px] text-muted-foreground">Fit</Label>+ <Select value={element.fit || "cover"} onValueChange={(fit) => onPatch({ fit: fit as ImageElement["fit"] })}>+ <SelectTrigger className="h-8 text-xs" aria-label="Image fit"><SelectValue /></SelectTrigger>+ <SelectContent>+ <SelectItem value="cover">Fill frame</SelectItem>+ <SelectItem value="contain">Whole image</SelectItem>+ </SelectContent>+ </Select>+ </div>+ <div className="space-y-1">+ <Label className="text-[11px] text-muted-foreground">Edge fade</Label>+ <Select+ value={element.fade?.edge || "none"}+ onValueChange={(edge) =>+ onPatch({+ fade:+ edge === "none"+ ? undefined+ : { edge: edge as NonNullable<ImageElement["fade"]>["edge"], amount: element.fade?.amount ?? 35 },+ })+ }+ >+ <SelectTrigger className="h-8 text-xs" aria-label="Edge fade"><SelectValue /></SelectTrigger>+ <SelectContent>+ <SelectItem value="none">None</SelectItem>+ <SelectItem value="top">From top</SelectItem>+ <SelectItem value="bottom">From bottom</SelectItem>+ <SelectItem value="left">From left</SelectItem>+ <SelectItem value="right">From right</SelectItem>+ </SelectContent>+ </Select>+ </div>+ </div>+ {element.fade && (+ <div className="space-y-1">+ <div className="flex items-center justify-between">+ <Label className="text-[11px] text-muted-foreground">Fade strength</Label>+ <span className="text-[11px] tabular-nums text-muted-foreground">{Math.round(element.fade.amount)}%</span>+ </div>+ <input+ type="range"+ min={1}+ max={100}+ value={element.fade.amount}+ onChange={(event) => onPatch({ fade: { ...element.fade!, amount: Number(event.target.value) } })}+ className="w-full"+ aria-label="Fade strength"+ />+ </div>+ )}+ </div>+ );+}++function TextElementPanel({+ element,+ locale,+ canvas,+ defaultColor,+ onTextChange,+ onTextPatch,+}: {+ element: TextElement;+ locale: string;+ canvas: { cW: number; cH: number };+ defaultColor: string;+ onTextChange: (value: string) => void;+ onTextPatch: (patch: Partial<TextElement>) => void;+}) {+ // Like the headline field: the locale's own text, with the fallback shown as+ // a placeholder, so clearing a translation doesn't snap back to English.+ const text = element.text?.[locale] ?? "";+ const textPlaceholder = pickText(element.text, locale) || "Overlay text";+ const align = element.align ?? "center";+ const defaultSize = defaultTextElementFontSize(canvas.cW, canvas.cH);+ const range = textElementFontSizeRange(canvas.cW, canvas.cH);+ const hasCustomSize = typeof element.fontSize === "number" && Number.isFinite(element.fontSize);+ // Mirror the canvas: an unset size renders at the canvas-relative default.+ const size = Math.round(hasCustomSize ? (element.fontSize as number) : defaultSize);+ // Keep a value loaded from an older project reachable even if it sits+ // outside the canvas-relative range.+ const sliderMin = Math.min(range.min, size);+ const sliderMax = Math.max(range.max, size);+ // Typing is buffered so intermediate values ("1" on the way to "120") don't+ // get clamped mid-keystroke; the value is committed on blur / Enter.+ const [draft, setDraft] = React.useState<string | null>(null);+ const cancelDraft = React.useRef(false);++ function commitDraft() {+ if (cancelDraft.current) { cancelDraft.current = false; return; }+ if (draft === null) return;+ const n = Number(draft);+ if (draft.trim() !== "" && Number.isFinite(n)) {+ onTextPatch({ fontSize: Math.min(range.max, Math.max(range.min, Math.round(n))) });+ }+ setDraft(null);+ }++ return (+ <div className="space-y-2 rounded border bg-muted/30 p-2">+ <div className="space-y-1">+ <Label className="text-[11px] text-muted-foreground">Text</Label>+ <Textarea+ value={text}+ rows={2}+ onChange={(event) => onTextChange(event.target.value)}+ placeholder={textPlaceholder}+ aria-label="Overlay text"+ />+ </div>+ <div className="space-y-1">+ <div className="flex items-center justify-between gap-2">+ <Label className="text-[11px] text-muted-foreground">Size</Label>+ <ResetButton+ visible={hasCustomSize && size !== defaultSize}+ label={`Reset size to ${defaultSize}px`}+ onClick={() => onTextPatch({ fontSize: undefined })}+ />+ </div>+ <div className="flex items-center gap-2">+ <input+ type="range"+ min={sliderMin}+ max={sliderMax}+ step={1}+ value={size}+ onChange={(event) => onTextPatch({ fontSize: Number(event.target.value) })}+ onDoubleClick={() => onTextPatch({ fontSize: undefined })}+ className="min-w-0 flex-1"+ aria-label="Text size"+ />+ <div className="relative w-[76px] shrink-0">+ <Input+ type="number"+ min={range.min}+ max={range.max}+ value={draft ?? String(size)}+ onChange={(event) => setDraft(event.target.value)}+ onBlur={commitDraft}+ onKeyDown={(event) => {+ if (event.key === "Enter") event.currentTarget.blur();+ if (event.key === "Escape") {+ event.preventDefault();+ event.stopPropagation();+ cancelDraft.current = true;+ setDraft(null);+ event.currentTarget.blur();+ }+ }}+ className="h-8 pr-7 text-xs tabular-nums [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"+ aria-label="Text size in pixels"+ />+ <span className="pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-muted-foreground">+ px+ </span>+ </div>+ </div>+ </div>+ <div className="grid grid-cols-[76px_1fr] gap-2">+ <div className="space-y-1">+ <Label className="text-[11px] text-muted-foreground">Color</Label>+ <Input+ type="color"+ value={element.color || defaultColor}+ className="h-7 cursor-pointer p-0.5"+ onChange={(event) => onTextPatch({ color: event.target.value })}+ aria-label="Text color"+ />+ </div>+ <div className="space-y-1">+ <Label className="text-[11px] text-muted-foreground">Align</Label>+ <div className="grid grid-cols-3 gap-1">+ <LayerButton+ disabled={false}+ active={align === "left"}+ onClick={() => onTextPatch({ align: "left" })}+ label="Align left"+ >+ <AlignLeft className="h-3.5 w-3.5" />+ </LayerButton>+ <LayerButton+ disabled={false}+ active={align === "center"}+ onClick={() => onTextPatch({ align: "center" })}+ label="Align center"+ >+ <AlignCenter className="h-3.5 w-3.5" />+ </LayerButton>+ <LayerButton+ disabled={false}+ active={align === "right"}+ onClick={() => onTextPatch({ align: "right" })}+ label="Align right"+ >+ <AlignRight className="h-3.5 w-3.5" />+ </LayerButton>+ </div>+ </div>+ </div>+ </div>+ );+}++function LayerButton({+ disabled,+ active,+ onClick,+ label,+ children,+}: {+ disabled: boolean;+ active?: boolean;+ onClick: () => void;+ label: string;+ children: React.ReactNode;+}) {+ return (+ <Button+ type="button"+ variant="outline"+ size="sm"+ className={cn("h-7 px-0", active && "border-foreground/40 bg-accent text-accent-foreground")}+ disabled={disabled}+ aria-pressed={active}+ onClick={onClick}+ title={label}+ aria-label={label}+ >+ {children}+ </Button>+ );+}++function TypographySection({+ slide,+ isFeatureGraphic,+ onChange,+}: {+ slide: Slide;+ isFeatureGraphic: boolean;+ onChange: (patch: Partial<Slide>) => void;+}) {+ const scales = slideFontScales(slide);+ const customized = !!cleanTypography(slide.typography);++ function patchTypography(patch: Partial<SlideTypography>) {+ onChange({+ typography: cleanTypography({ ...slide.typography, ...patch }),+ });+ }++ return (+ <div className="space-y-3 rounded-md border bg-muted/30 p-3">+ <div className="flex items-start justify-between gap-2">+ <div>+ <Label className="text-xs font-semibold">Text size</Label>+ <p className="text-[11px] text-muted-foreground">+ Relative to the layout default.+ </p>+ </div>+ {customized && (+ <Button+ type="button"+ variant="ghost"+ size="sm"+ className="h-6 shrink-0 gap-1 px-1.5 text-[11px] text-muted-foreground"+ onClick={() => onChange({ typography: undefined })}+ title="Reset all text sizes to 100%"+ >+ <RotateCcw className="h-3 w-3" />+ Reset+ </Button>+ )}+ </div>+ {!isFeatureGraphic && (+ <FontScaleSlider+ label="Label"+ value={scales.labelScale}+ onChange={(value) => patchTypography({ labelScale: value })}+ />+ )}+ {isFeatureGraphic && (+ <FontScaleSlider+ label="App name"+ value={scales.appNameScale}+ onChange={(value) => patchTypography({ appNameScale: value })}+ />+ )}+ <FontScaleSlider+ label={isFeatureGraphic ? "Tagline" : "Headline"}+ value={scales.headlineScale}+ onChange={(value) => patchTypography({ headlineScale: value })}+ />+ </div>+ );+}++function FontScaleSlider({+ label,+ value,+ onChange,+}: {+ label: string;+ value: number;+ onChange: (value: number) => void;+}) {+ const pct = Math.round(value * 100);+ const minPct = Math.round(FONT_SCALE_MIN * 100);+ const maxPct = Math.round(FONT_SCALE_MAX * 100);+ const defaultPct = Math.round(FONT_SCALE_DEFAULT * 100);++ return (+ <div className="space-y-1">+ <div className="flex items-center justify-between gap-2">+ <Label className="text-[11px] text-muted-foreground">{label}</Label>+ <div className="flex items-center gap-1">+ <ResetButton+ visible={pct !== defaultPct}+ label={`Reset ${label.toLowerCase()} to ${defaultPct}%`}+ onClick={() => onChange(FONT_SCALE_DEFAULT)}+ />+ <span className="w-9 text-right text-[11px] tabular-nums text-muted-foreground">{pct}%</span>+ </div>+ </div>+ <input+ type="range"+ min={minPct}+ max={maxPct}+ step={5}+ value={pct}+ onChange={(event) => onChange(Number(event.target.value) / 100)}+ onDoubleClick={() => onChange(FONT_SCALE_DEFAULT)}+ className="w-full"+ aria-label={`${label} size`}+ aria-valuetext={`${pct}%`}+ title="Double-click to reset"+ />+ </div>+ );+}++/** Small inline reset affordance. Always occupies its slot so the row doesn't+ * shift when it appears. */+function ResetButton({+ visible,+ label,+ onClick,+}: {+ visible: boolean;+ label: string;+ onClick: () => void;+}) {+ return (+ <Button+ type="button"+ variant="ghost"+ size="icon"+ className={cn("h-5 w-5 text-muted-foreground [&_svg]:size-3", !visible && "invisible")}+ onClick={onClick}+ title={label}+ aria-label={label}+ tabIndex={visible ? 0 : -1}+ aria-hidden={!visible}+ >+ <RotateCcw />+ </Button>+ );+}++function naturalSize(src: string): Promise<{ w: number; h: number } | null> {+ if (!src) return Promise.resolve(null);+ return new Promise((resolve) => {+ const image = new Image();+ const finish = (size: { w: number; h: number } | null) => {+ clearTimeout(timeout);+ image.onload = image.onerror = null;+ resolve(size);+ };+ const timeout = setTimeout(() => finish(null), 10000);+ image.onload = () => finish(image.naturalWidth > 0 && image.naturalHeight > 0 ? { w: image.naturalWidth, h: image.naturalHeight } : null);+ image.onerror = () => finish(null);+ image.src = src;+ });+}++function fitToAspect(t: ElementTransform, aspect: number, maxHeight: number): ElementTransform {+ let width = t.width;+ let height = width / aspect;+ if (height > maxHeight) {+ height = maxHeight;+ width = height * aspect;+ }+ return {+ ...t,+ x: t.x + (t.width - width) / 2,+ y: t.y + (t.height - height) / 2,+ width,+ height,+ };+}++function elementLabel(id: ElementId): string {+ if (isBuiltInElementId(id)) return ELEMENT_LABEL[id];+ if (isImageElementId(id)) return "Image";+ return "Text";+}++function defaultZ(id: ElementId): number {+ if (isTextElementId(id)) return 5;+ if (isImageElementId(id)) return 5;+ if (id === "deviceSecondary") return 2;+ if (id === "device") return 3;+ return 4; // caption on top+}diff --git a/marketing/app-store-screenshots/src/components/editor/preview-stage.tsx b/marketing/app-store-screenshots/src/components/editor/preview-stage.tsxnew file mode 100644index 00000000..71634d59--- /dev/null+++ b/marketing/app-store-screenshots/src/components/editor/preview-stage.tsx@@ -0,0 +1,242 @@+"use client";+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 type {+ Device,+ ElementId,+ ElementTransform,+ Orientation,+ SelectedElement,+ Slide,+ Theme,+} from "@/lib/types";+import { DeckCanvas, getCanvas } from "./slide-canvas";++type Props = {+ slides: Slide[];+ activeSlideId: string | null;+ device: Device;+ orientation: Orientation;+ theme: Theme;+ locale: string;+ appName?: string;+ appIcon?: string;+ fontFamily: string;+ connectedCanvas: boolean;+ selectedElement: SelectedElement | null;+ onActiveSlideChange: (id: string) => void;+ onLabelChange: (slide: Slide, v: string) => void;+ onHeadlineChange: (slide: Slide, v: string) => void;+ onTextElementTextChange: (slideId: string, id: string, v: string) => void;+ onElementChange: (slideId: string, id: ElementId, t: ElementTransform) => void;+ onSelectElement: (element: SelectedElement | null) => void;+};++// Fits one full-resolution screen inside the viewport while keeping the whole+// deck horizontally scrollable as one connected canvas.+export function PreviewStage({+ slides,+ activeSlideId,+ device,+ orientation,+ theme,+ locale,+ appName,+ appIcon,+ fontFamily,+ connectedCanvas,+ selectedElement,+ onActiveSlideChange,+ onLabelChange,+ onHeadlineChange,+ onTextElementTextChange,+ onElementChange,+ onSelectElement,+}: Props) {+ const containerRef = React.useRef<HTMLDivElement>(null);+ const scrollerRef = React.useRef<HTMLDivElement>(null);+ const suppressNextActiveScreenPanRef = React.useRef(false);+ const [fitScale, setFitScale] = React.useState(0.2);+ const [zoom, setZoom] = React.useState(1);+ const { cW, cH } = getCanvas(device, orientation);+ const totalW = Math.max(1, slides.length) * cW;+ const scale = fitScale * zoom;+ const activeIndex = Math.max(0, slides.findIndex((slide) => slide.id === activeSlideId));+ const activeSlide = slides[activeIndex] || slides[0] || null;+ const activeId = activeSlide?.id;++ React.useEffect(() => {+ const el = containerRef.current;+ if (!el) return;+ const update = () => {+ const rect = el.getBoundingClientRect();+ const sx = (rect.width - 96) / cW;+ const sy = (rect.height - 96) / cH;+ setFitScale(Math.max(0.05, Math.min(sx, sy)));+ };+ update();+ const ro = new ResizeObserver(update);+ ro.observe(el);+ return () => ro.disconnect();+ }, [cW, cH]);++ React.useEffect(() => {+ setZoom(1);+ }, [device, orientation]);++ const panToActiveScreen = React.useCallback((nextScale: number) => {+ const scroller = scrollerRef.current;+ if (!scroller || !activeId) return;+ const screenLeft = activeIndex * cW * nextScale;+ const screenWidth = cW * nextScale;+ const targetLeft = Math.max(0, screenLeft - (scroller.clientWidth - screenWidth) / 2);+ scroller.scrollTo({ left: targetLeft, behavior: "smooth" });+ }, [activeIndex, activeId, cW]);++ React.useEffect(() => {+ if (suppressNextActiveScreenPanRef.current) {+ suppressNextActiveScreenPanRef.current = false;+ return;+ }+ panToActiveScreen(scale);+ }, [panToActiveScreen, scale]);++ const handleCanvasActiveSlideChange = React.useCallback(+ (id: string) => {+ if (id !== activeSlideId) {+ suppressNextActiveScreenPanRef.current = true;+ }+ onActiveSlideChange(id);+ },+ [activeSlideId, onActiveSlideChange],+ );++ return (+ <div+ ref={containerRef}+ className="relative h-full w-full overflow-hidden bg-[radial-gradient(70%_70%_at_50%_35%,_hsl(var(--background))_0%,_hsl(var(--muted))_100%)]"+ >+ <div ref={scrollerRef} className="h-full w-full overflow-auto p-12">+ <div+ style={{+ width: totalW * scale,+ height: cH * scale,+ position: "relative",+ flexShrink: 0,+ filter: "drop-shadow(0 32px 42px rgba(15, 23, 42, 0.18))",+ }}+ >+ <div+ style={{+ width: totalW,+ height: cH,+ transform: `scale(${scale})`,+ transformOrigin: "top left",+ }}+ >+ <DeckCanvas+ slides={slides}+ device={device}+ orientation={orientation}+ theme={theme}+ locale={locale}+ appName={appName}+ appIcon={appIcon}+ fontFamily={fontFamily}+ connectedCanvas={connectedCanvas}+ editable+ previewScale={scale}+ selectedElement={selectedElement}+ activeSlideId={activeSlide?.id || null}+ showGuides+ edit={{+ onLabelChange: (slideId, value) => {+ const slide = slides.find((s) => s.id === slideId);+ if (slide) onLabelChange(slide, value);+ },+ onHeadlineChange: (slideId, value) => {+ const slide = slides.find((s) => s.id === slideId);+ if (slide) onHeadlineChange(slide, value);+ },+ onTextElementTextChange,+ onElementChange,+ onSelectElement,+ onSelectScreen: handleCanvasActiveSlideChange,+ }}+ />+ </div>+ </div>+ </div>++ <div className="pointer-events-none absolute left-4 top-4 flex items-center gap-1.5 rounded-md bg-background/80 px-2 py-1 text-[11px] text-muted-foreground shadow-sm backdrop-blur">+ <span className="font-medium text-foreground">{DEVICE_LABEL[device]}</span>+ {activeSlide && (+ <>+ <span aria-hidden>·</span>+ <span>Screen {activeIndex + 1}</span>+ <span aria-hidden>·</span>+ <span>{LAYOUT_LABEL[activeSlide.layout]}</span>+ </>+ )}+ {orientation === "landscape" && (+ <>+ <span aria-hidden>·</span>+ <span>landscape</span>+ </>+ )}+ {!connectedCanvas && (+ <>+ <span aria-hidden>·</span>+ <span>isolated</span>+ </>+ )}+ </div>++ <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>+ <Button+ type="button"+ variant="ghost"+ size="icon"+ className="h-6 w-6"+ onClick={() => setZoom((value) => Math.max(0.25, Number((value - 0.1).toFixed(2))))}+ disabled={zoom <= 0.25}+ title="Zoom out"+ aria-label="Zoom out"+ >+ <ZoomOut className="h-3.5 w-3.5" />+ </Button>+ <span className="min-w-10 text-center">{(scale * 100).toFixed(0)}%</span>+ <Button+ type="button"+ variant="ghost"+ size="icon"+ className="h-6 w-6"+ onClick={() => setZoom((value) => Math.min(2, Number((value + 0.1).toFixed(2))))}+ disabled={zoom >= 2}+ title="Zoom in"+ aria-label="Zoom in"+ >+ <ZoomIn className="h-3.5 w-3.5" />+ </Button>+ <Button+ type="button"+ variant="ghost"+ size="icon"+ className="h-6 w-6"+ onClick={() => {+ setZoom(1);+ panToActiveScreen(fitScale);+ }}+ title="Fit active screen"+ aria-label="Fit active screen"+ >+ <Maximize2 className="h-3.5 w-3.5" />+ </Button>+ </div>+ </div>+ );+}diff --git a/marketing/app-store-screenshots/src/components/editor/screenshot-editor.tsx b/marketing/app-store-screenshots/src/components/editor/screenshot-editor.tsxnew file mode 100644index 00000000..1f3054c0--- /dev/null+++ b/marketing/app-store-screenshots/src/components/editor/screenshot-editor.tsx@@ -0,0 +1,879 @@+"use client";+import * as React from "react";+import JSZip from "jszip";+import { Toaster, toast } from "sonner";+import {+ DEFAULT_SCREENSHOT_FONT_ID,+ getExportSizes,+ hasTheme,+ IMPORTED_FONT_FAMILY,+ SCREENSHOT_FONTS,+ supportsLandscape,+ themeById,+} from "@/lib/constants";+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 { didFail, preloadImages } from "@/lib/image-cache";+import { resolveScreenshot, writeLocalized } from "@/lib/locale";+import { useProject } from "@/lib/storage";+import type {+ BuiltInElementId,+ Device,+ ElementId,+ ElementTransform,+ ImageElement,+ ImportedFont,+ SelectedElement,+ ProjectState,+ Slide,+} from "@/lib/types";+import { Inspector } from "./inspector";+import { PreviewStage } from "./preview-stage";+import { Sidebar } from "./sidebar";+import { DeckCanvas, getCanvas } from "./slide-canvas";+import { Toolbar } from "./toolbar";++export function ScreenshotEditor() {+ const { state, setState, hydrated, savedAt, saveError, retrySave, reset, resetDevice, undo, redo, canUndo, canRedo } = useProject();+ const [activeSlideId, setActiveSlideId] = React.useState<string | null>(null);+ const [selectedElement, setSelectedElement] = React.useState<SelectedElement | null>(null);+ const [exporting, setExporting] = React.useState<string | null>(null);+ const [ready, setReady] = React.useState(false);+ const [, refreshAssets] = React.useReducer((version: number) => version + 1, 0);+ const [exportLocaleOverride, setExportLocaleOverride] = React.useState<string | null>(null);+ const [exportSlideIndex, setExportSlideIndex] = React.useState(0);+ const exportInProgress = React.useRef(false);+ const [exportProject, setExportProject] = React.useState<ProjectState | null>(null);+ const exportRef = React.useRef<HTMLDivElement | null>(null);++ const currentSlides = state.slidesByDevice[state.device] || [];+ const activeSlide =+ currentSlides.find((s) => s.id === activeSlideId) || currentSlides[0] || null;+ const theme = themeById(state.themeId);+ const fontId = state.fontId || DEFAULT_SCREENSHOT_FONT_ID;+ const fontFamily = SCREENSHOT_FONTS[fontId].family;+ useImportedFontFace(state.importedFont);++ React.useEffect(() => {+ if (selectedElement && selectedElement.slideId !== activeSlide?.id) {+ setSelectedElement(null);+ }+ }, [activeSlide?.id, selectedElement]);++ React.useEffect(() => {+ if (!hydrated) return;+ if (!activeSlide && currentSlides.length > 0) {+ setActiveSlideId(currentSlides[0].id);+ }+ }, [hydrated, currentSlides, activeSlide]);++ React.useEffect(() => {+ if (!supportsLandscape(state.device) && state.orientation !== "portrait") {+ setState((p) => ({ ...p, orientation: "portrait" }), { history: false });+ }+ }, [state.device, state.orientation, setState]);++ React.useEffect(() => {+ if (hydrated && state.themeId && !hasTheme(state.themeId)) {+ toast.warning("Using fallback theme", {+ description: `Theme "${state.themeId}" is not defined in src/lib/constants.ts.`,+ duration: 8000,+ });+ }+ }, [hydrated, state.themeId]);++ const assetPaths = React.useMemo(() => {+ const paths = new Set<string>();+ paths.add("/mockup.png");+ 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();+ for (const s of allSlides) {+ for (const raw of [s.screenshot, s.screenshotSecondary]) {+ if (!raw || raw.startsWith("data:")) continue;+ if (raw.includes("{locale}")) {+ for (const loc of state.locales) paths.add(resolveScreenshot(raw, loc));+ } else {+ paths.add(raw);+ }+ }+ for (const imageElement of s.imageElements || []) {+ if (imageElement.src && !imageElement.src.startsWith("data:")) paths.add(imageElement.src);+ }+ }+ return Array.from(paths).sort();+ }, [state.slidesByDevice, state.appIcon, state.locales]);+ const assetSig = assetPaths.join("|");++ React.useEffect(() => {+ if (!hydrated) return;+ let cancelled = false;+ preloadImages(assetPaths).finally(() => {+ if (!cancelled) { setReady(true); refreshAssets(); }+ });+ return () => { cancelled = true; };+ // 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]);++ // Surface storage failures (quota exceeded etc.) so the user knows their work isn't safe.+ React.useEffect(() => {+ if (saveError) {+ toast.error("Couldn't load or save project file", {+ description: saveError,+ duration: 8000,+ });+ }+ }, [saveError]);++ // ---------- Mutations ----------++ const patchSlide = React.useCallback(+ (id: string, patch: Partial<Slide>) => {+ setState((prev) => ({+ ...prev,+ slidesByDevice: {+ ...prev.slidesByDevice,+ [state.device]: (prev.slidesByDevice[state.device] || []).map((s) =>+ s.id === id ? { ...s, ...patch } : s,+ ),+ },+ }));+ },+ [setState, state.device],+ );++ const updateSlide = React.useCallback(+ (id: string, update: (slide: Slide) => Partial<Slide>) => {+ setState((prev) => ({+ ...prev,+ slidesByDevice: {+ ...prev.slidesByDevice,+ [state.device]: (prev.slidesByDevice[state.device] || []).map((s) =>+ s.id === id ? { ...s, ...update(s) } : s,+ ),+ },+ }));+ },+ [setState, state.device],+ );++ const reorderSlides = React.useCallback(+ (next: Slide[]) => {+ setState((prev) => ({+ ...prev,+ slidesByDevice: { ...prev.slidesByDevice, [prev.device]: next },+ }));+ },+ [setState],+ );++ const deleteSlide = React.useCallback(+ (id: string) => {+ const dev = state.device;+ const slides = state.slidesByDevice[dev] || [];+ const idx = slides.findIndex((s) => s.id === id);+ if (idx === -1) return;+ const snap = slides[idx];+ const fallback = slides[idx + 1] || slides[idx - 1] || null;++ setState((prev) => {+ const cur = prev.slidesByDevice[dev] || [];+ return {+ ...prev,+ slidesByDevice: { ...prev.slidesByDevice, [dev]: cur.filter((s) => s.id !== id) },+ };+ });+ setActiveSlideId((cur) => (cur === id ? fallback?.id || null : cur));++ toast("Screen deleted", {+ action: {+ label: "Undo",+ onClick: () => {+ setState((prev) => {+ const cur = prev.slidesByDevice[dev] || [];+ if (cur.some((s) => s.id === snap.id)) return prev;+ const restored = [...cur.slice(0, idx), snap, ...cur.slice(idx)];+ return {+ ...prev,+ slidesByDevice: { ...prev.slidesByDevice, [dev]: restored },+ };+ });+ setActiveSlideId(snap.id);+ },+ },+ duration: 6000,+ });+ },+ [setState, state.device, state.slidesByDevice],+ );++ const addSlide = React.useCallback(+ (slide: Slide) => {+ setState((prev) => ({+ ...prev,+ slidesByDevice: {+ ...prev.slidesByDevice,+ [prev.device]: [...(prev.slidesByDevice[prev.device] || []), slide],+ },+ }));+ setActiveSlideId(slide.id);+ },+ [setState],+ );++ const patchLocalized = React.useCallback(+ (slide: Slide, key: "label" | "headline", value: string) => {+ patchSlide(slide.id, {+ [key]: writeLocalized(slide[key], state.locale, value),+ } as Partial<Slide>);+ },+ [patchSlide, state.locale],+ );++ const patchElementTransform = React.useCallback(+ (slideId: string, elementId: ElementId, transform: ElementTransform) => {+ setState((prev) => ({+ ...prev,+ slidesByDevice: {+ ...prev.slidesByDevice,+ [prev.device]: (prev.slidesByDevice[prev.device] || []).map((slide) => {+ if (slide.id !== slideId) return slide;+ if (isTextElementId(elementId)) {+ const textId = textElementKey(elementId);+ return {+ ...slide,+ textElements: (slide.textElements || []).map((element) =>+ element.id === textId ? { ...element, transform } : element,+ ),+ };+ }+ if (isImageElementId(elementId)) {+ const imageId = imageElementKey(elementId);+ return {+ ...slide,+ imageElements: (slide.imageElements || []).map((element) =>+ element.id === imageId ? { ...element, transform } : element,+ ),+ };+ }+ if (!isBuiltInElementId(elementId)) return slide;+ return {+ ...slide,+ transforms: {+ ...(slide.transforms || {}),+ [elementId]: transform,+ } as Partial<Record<BuiltInElementId, ElementTransform>>,+ };+ }),+ },+ }));+ },+ [setState],+ );++ const patchTextElementText = React.useCallback(+ (slideId: string, textId: string, value: string) => {+ setState((prev) => ({+ ...prev,+ slidesByDevice: {+ ...prev.slidesByDevice,+ [prev.device]: (prev.slidesByDevice[prev.device] || []).map((slide) =>+ slide.id === slideId+ ? {+ ...slide,+ textElements: (slide.textElements || []).map((element) =>+ element.id === textId+ ? { ...element, text: writeLocalized(element.text, prev.locale, value) }+ : element,+ ),+ }+ : slide,+ ),+ },+ }));+ },+ [setState],+ );++ const duplicateSlide = React.useCallback(+ (id: string) => {+ let newId: string | null = null;+ setState((prev) => {+ const slides = prev.slidesByDevice[prev.device] || [];+ const idx = slides.findIndex((s) => s.id === id);+ if (idx === -1) return prev;+ const src = slides[idx];+ newId = nid();+ const copy: Slide = {+ ...src,+ id: newId,+ label: { ...src.label },+ headline: { ...src.headline },+ transforms: src.transforms+ ? Object.fromEntries(+ Object.entries(src.transforms).map(([key, value]) => [key, { ...value }]),+ )+ : undefined,+ textElements: src.textElements?.map((element) => ({+ ...element,+ id: nid(),+ text: { ...element.text },+ transform: { ...element.transform },+ })),+ imageElements: src.imageElements?.map((element): ImageElement => ({+ ...element,+ id: nid(),+ transform: { ...element.transform },+ })),+ };+ const next = [...slides.slice(0, idx + 1), copy, ...slides.slice(idx + 1)];+ return {+ ...prev,+ slidesByDevice: { ...prev.slidesByDevice, [prev.device]: next },+ };+ });+ if (newId) setActiveSlideId(newId);+ },+ [setState],+ );++ // ---------- Keyboard shortcuts ----------++ React.useEffect(() => {+ function onKey(e: KeyboardEvent) {+ const target = e.target as HTMLElement | null;+ const inTextField = isTextEditable(target);+ const inControl =+ inTextField || (!!target && (target.tagName === "INPUT" || target.tagName === "SELECT"));+ if (exportInProgress.current || e.defaultPrevented) return;+ // Radix menus/dialogs and dnd-kit own keyboard navigation while active.+ if (target?.closest('[role="dialog"], [role="alertdialog"], [role="menu"], [role="listbox"], [role="combobox"], [role="tablist"], [aria-roledescription="sortable"]')) return;++ if (e.key === "Escape") {+ setSelectedElement(null);+ if (target && "blur" in target && typeof target.blur === "function") target.blur();+ return;+ }++ // Undo/redo belongs to the text field while one is focused.+ const mod = e.metaKey || e.ctrlKey;+ if (mod && !e.altKey && (e.key === "z" || e.key === "Z" || e.key === "y" || e.key === "Y")) {+ if (inTextField) return;+ e.preventDefault();+ if (e.key === "y" || e.key === "Y" || e.shiftKey) redo();+ else undo();+ return;+ }++ // Arrow keys, deletion etc. keep their native meaning inside any input.+ if (inControl) return;++ if (!currentSlides.length) return;+ const idx = activeSlide ? currentSlides.findIndex((s) => s.id === activeSlide.id) : -1;+ if (e.key === "ArrowDown" || (e.key === "j" && !e.metaKey && !e.ctrlKey)) {+ e.preventDefault();+ const next = currentSlides[Math.min(currentSlides.length - 1, idx + 1)];+ if (next) setActiveSlideId(next.id);+ } else if (e.key === "ArrowUp" || (e.key === "k" && !e.metaKey && !e.ctrlKey)) {+ e.preventDefault();+ const next = currentSlides[Math.max(0, idx - 1)];+ if (next) setActiveSlideId(next.id);+ } else if ((e.key === "d" || e.key === "D") && (e.metaKey || e.ctrlKey)) {+ if (activeSlide) {+ e.preventDefault();+ duplicateSlide(activeSlide.id);+ }+ } else if ((e.key === "Backspace" || e.key === "Delete") && (e.metaKey || e.ctrlKey)) {+ if (activeSlide) {+ e.preventDefault();+ deleteSlide(activeSlide.id);+ }+ }+ }+ window.addEventListener("keydown", onKey);+ return () => window.removeEventListener("keydown", onKey);+ }, [activeSlide, currentSlides, duplicateSlide, deleteSlide, exporting, undo, redo]);++ // ---------- Export ----------++ // Wait two animation frames so React's render → browser layout/paint of the+ // off-screen container settles before html-to-image snapshots it. One frame+ // is occasionally not enough on slower machines.+ const waitForPaint = () =>+ new Promise<void>((resolve) => {+ requestAnimationFrame(() => requestAnimationFrame(() => resolve()));+ });++ async function exportAll() {+ if (exportInProgress.current) return;+ exportInProgress.current = true;+ setExporting("Preparing…");+ setExportProject(state);+ try {+ await generateBundle();+ } catch (error) {+ toast.error("Export failed", {+ description: error instanceof Error ? error.message : String(error),+ });+ } finally {+ setExportLocaleOverride(null);+ setExportProject(null);+ setExporting(null);+ exportInProgress.current = false;+ }+ }++ async function generateBundle() {+ if (!currentSlides.length) {+ toast.error("No screens to export");+ return;+ }++ const sizes = getExportSizes(state.device, state.orientation);+ if (!sizes.length) {+ toast.error("Nothing to export");+ return;+ }+ const locales = state.locales;+ const exportPaths = exportAssetPaths(state);+ await preloadImages(exportPaths, { retryFailed: true });+ const missingPaths = exportPaths.filter(didFail);+ if (missingPaths.length) {+ throw new Error(`Images could not be loaded: ${missingPaths.slice(0, 3).join(", ")}`);+ }+ await waitForPaint();++ const missingScreens = currentSlides+ .map((slide, index) => ({ slide, index }))+ .filter(({ slide }) => slideNeedsScreenshot(state.device, slide) && !slide.screenshot);+ const reusedBackScreens = currentSlides+ .map((slide, index) => ({ slide, index }))+ .filter(+ ({ slide }) =>+ state.device !== "feature-graphic" &&+ slide.layout === "two-devices" &&+ slide.screenshot &&+ !slide.screenshotSecondary,+ );+ if (missingScreens.length > 0 || reusedBackScreens.length > 0) {+ const details = [+ missingScreens.length+ ? `${missingScreens.length} screen${missingScreens.length === 1 ? "" : "s"} will export with an empty device.`+ : null,+ reusedBackScreens.length+ ? `${reusedBackScreens.length} two-device screen${reusedBackScreens.length === 1 ? "" : "s"} will reuse the primary screenshot in back.`+ : null,+ ].filter(Boolean);+ toast.warning("Export includes placeholder screenshots", {+ description: details.join(" "),+ duration: 7000,+ });+ }++ // Make sure custom fonts are loaded before snapshot so typography in PNG+ // matches what's on screen.+ if (typeof document !== "undefined" && document.fonts && document.fonts.ready) {+ let timeout: ReturnType<typeof setTimeout> | undefined;+ try {+ await Promise.race([+ (async () => {+ // fonts.ready only covers faces already requested; explicitly load an+ // imported font so a not-yet-used face can't export as the fallback.+ if (fontId === "self-hosted") await document.fonts.load(`64px ${fontFamily}`);+ await document.fonts.ready;+ })(),+ new Promise<never>((_, reject) => {+ timeout = setTimeout(() => reject(new Error("Font loading timed out")), 15000);+ }),+ ]);+ } catch {+ throw new Error("The screenshot font could not be loaded. Check the imported font file and connection, then retry.");+ } finally {+ clearTimeout(timeout);+ }+ }++ const { cW, cH } = getCanvas(state.device, state.orientation);+ const platform = detectPlatform(state.device);+ const zip = new JSZip();+ const totalUnits = sizes.length * locales.length * currentSlides.length;+ const totalRenders = locales.length * currentSlides.length;+ let render = 0;+ let okCount = 0;+ let failed = 0;+ const errors: string[] = [];+ const incomplete: string[] = [];++ // Render each slide once per locale at canvas resolution, then scale that+ // one render to every export size. The sizes are all scalings of the same+ // design, so re-rendering the DOM per size only added time. PNG encoding+ // runs in workers, so a screen encodes while the next one renders; waiting+ // for the previous screen first keeps at most one screen's pixels queued.+ let encoding: Promise<void> = Promise.resolve();+ for (const locale of locales) {+ setExportLocaleOverride(locale);+ await waitForPaint();++ for (let i = 0; i < currentSlides.length; i++) {+ const slide = currentSlides[i];+ render += 1;+ setExporting(`${render}/${totalRenders}`);+ setExportSlideIndex(i);+ await waitForPaint();+ const el = exportRef.current;+ if (!el) {+ await encoding;+ failed += sizes.length;+ errors.push(`${locale} screen ${i + 1}: render target missing`);+ continue;+ }+ const filename = `${String(i + 1).padStart(2, "0")}-${slide.layout}.png`;+ const label = `${locale} screen ${i + 1}`;+ const fail = (e: unknown) => {+ const msg = e instanceof Error ? e.message : String(e);+ errors.push(`${label}: ${msg}`);+ console.error("Export failed", { slideId: slide.id, locale }, e);+ };+ let pngs: Promise<Uint8Array[]>;+ try {+ const rendered = await captureSlide(el, cW, cH);+ if (rendered.missingImages > 0) incomplete.push(label);+ pngs = Promise.all(sizes.map((size) => rendered.toPng(size.w, size.h)));+ } catch (e) {+ fail(e);+ await encoding;+ failed += sizes.length;+ continue;+ }+ // Attach rejection handling now: this screen can fail while the+ // previous screen is still encoding.+ const nextEncoding = pngs.then(+ (files) => {+ sizes.forEach((size, index) => {+ zip.file(`${platform}/${state.device}/${size.w}x${size.h}/${locale}/${filename}`, files[index]);+ });+ okCount += sizes.length;+ },+ (e) => {+ fail(e);+ failed += sizes.length;+ },+ );+ await encoding;+ encoding = nextEncoding;+ }+ }+ await encoding;++ setExporting("Bundling…");++ if (okCount > 0) {+ try {+ const blob = await zip.generateAsync({ type: "blob" });+ const url = URL.createObjectURL(blob);+ const a = document.createElement("a");+ a.href = url;+ a.download = `${slugify(state.appName)}-${platform}-${state.device}-${stamp()}.zip`;+ a.click();+ setTimeout(() => URL.revokeObjectURL(url), 5000);+ } catch (e) {+ toast.error("Couldn't bundle export");+ console.error(e);+ return;+ }+ }++ if (incomplete.length > 0) {+ toast.warning("Some screenshots may be missing from the export", {+ description: `${incomplete.slice(0, 3).join(", ")}${incomplete.length > 3 ? "…" : ""}: a screenshot never finished rendering. Check those files, or export again.`,+ duration: 12000,+ });+ }++ const summary = `${locales.length} locale${locales.length === 1 ? "" : "s"} × ${sizes.length} size${sizes.length === 1 ? "" : "s"}`;+ if (failed === 0) {+ toast.success(`Exported ${okCount} PNGs (${summary})`);+ } else if (okCount === 0) {+ toast.error(`All ${failed} renders failed`, {+ description: errors.slice(0, 3).join("\n"),+ });+ } else {+ toast.error(`${failed} of ${totalUnits} renders failed`, {+ description: errors.slice(0, 3).join("\n"),+ });+ }+ }++ async function captureSlide(el: HTMLElement, sourceW: number, sourceH: number) {+ // html-to-image needs the node at (0,0) and untransformed. Each export size+ // is a scaled draw of this one render, so aspect ratios that differ by a few+ // pixels are cover-scaled rather than leaving transparent gutters.+ const prev = {+ left: el.style.left,+ top: el.style.top,+ position: el.style.position,+ transform: el.style.transform,+ transformOrigin: el.style.transformOrigin,+ zIndex: el.style.zIndex,+ };+ el.style.left = "0px";+ el.style.top = "0px";+ el.style.position = "absolute";+ el.style.transform = "none";+ el.style.transformOrigin = "top left";+ el.style.zIndex = "-1";+ try {+ return await renderSlide(el, sourceW, sourceH);+ } finally {+ el.style.left = prev.left || "-99999px";+ el.style.top = prev.top || "0px";+ el.style.position = prev.position || "absolute";+ el.style.transform = prev.transform;+ el.style.transformOrigin = prev.transformOrigin;+ el.style.zIndex = prev.zIndex;+ }+ }++ // ---------- Render ----------++ if (!hydrated || !ready) {+ return (+ <div className="flex h-screen items-center justify-center">+ <div className="flex flex-col items-center gap-2 text-muted-foreground">+ <div className="h-6 w-6 animate-spin rounded-full border-2 border-current border-t-transparent" />+ <p className="text-sm">Loading editor…</p>+ </div>+ </div>+ );+ }++ const busy = !!exporting;+ const exportState = exportProject ?? state;+ const exportSlides = exportState.slidesByDevice[exportState.device] || [];+ const exportCanvas = getCanvas(exportState.device, exportState.orientation);++ return (+ <div className="flex h-dvh flex-col overflow-hidden bg-background">+ <Toaster position="bottom-center" richColors closeButton />+ <Toolbar+ appName={state.appName}+ setAppName={(v) => setState((p) => ({ ...p, appName: v }))}+ themeId={state.themeId}+ setThemeId={(v) => setState((p) => ({ ...p, themeId: v }))}+ connectedCanvas={state.connectedCanvas}+ setConnectedCanvas={(v) => setState((p) => ({ ...p, connectedCanvas: v }))}+ fontId={fontId}+ setFontId={(v) => setState((p) => ({ ...p, fontId: v }))}+ importedFont={state.importedFont}+ setImportedFont={(importedFont) => setState((p) => ({ ...p, fontId: "self-hosted", importedFont }))}+ locale={state.locale}+ setLocale={(v) => setState((p) => ({ ...p, locale: v }), { history: false })}+ locales={state.locales}+ device={state.device}+ setDevice={(v) => setState((p) => ({ ...p, device: v }), { history: false })}+ orientation={state.orientation}+ setOrientation={(v) => setState((p) => ({ ...p, orientation: v }), { history: false })}+ onExport={exportAll}+ onResetAll={() => {+ reset();+ setActiveSlideId(null);+ toast.success("Reset all devices to defaults");+ }}+ onResetDevice={() => {+ resetDevice(state.device);+ setActiveSlideId(null);+ toast.success(`Reset ${state.device} to defaults`);+ }}+ onUndo={undo}+ onRedo={redo}+ canUndo={canUndo}+ canRedo={canRedo}+ exporting={exporting}+ savedAt={savedAt}+ saveError={saveError}+ onRetrySave={retrySave}+ busy={busy}+ />++ <div inert={busy} aria-busy={busy} className="flex min-h-0 flex-1 flex-col overflow-y-auto lg:flex-row lg:overflow-hidden">+ <aside className="lg:w-72 w-full shrink-0 border-r bg-card lg:max-h-none max-h-64 overflow-hidden">+ <Sidebar+ slides={currentSlides}+ activeId={activeSlide?.id || null}+ device={state.device}+ orientation={state.orientation}+ theme={theme}+ locale={state.locale}+ appName={state.appName}+ appIcon={state.appIcon}+ fontFamily={fontFamily}+ connectedCanvas={state.connectedCanvas}+ disabled={busy}+ onReorder={reorderSlides}+ onSelect={setActiveSlideId}+ onDelete={deleteSlide}+ onDuplicate={duplicateSlide}+ onAdd={addSlide}+ />+ </aside>++ <main className="flex h-[26rem] shrink-0 items-stretch overflow-hidden lg:h-auto lg:min-h-0 lg:flex-1">+ {activeSlide && currentSlides.length > 0 ? (+ <PreviewStage+ slides={currentSlides}+ activeSlideId={activeSlide.id}+ device={state.device}+ orientation={state.orientation}+ theme={theme}+ locale={state.locale}+ appName={state.appName}+ appIcon={state.appIcon}+ fontFamily={fontFamily}+ connectedCanvas={state.connectedCanvas}+ selectedElement={selectedElement}+ onActiveSlideChange={setActiveSlideId}+ onLabelChange={(slide, v) => patchLocalized(slide, "label", v)}+ onHeadlineChange={(slide, v) => patchLocalized(slide, "headline", v)}+ onTextElementTextChange={patchTextElementText}+ onElementChange={patchElementTransform}+ onSelectElement={setSelectedElement}+ />+ ) : (+ <div className="flex flex-1 flex-col items-center justify-center gap-2 p-8 text-center text-sm text-muted-foreground">+ <p className="font-medium text-foreground">No screen selected</p>+ <p>Add a screen on the left to get started.</p>+ </div>+ )}+ </main>++ <aside className="lg:w-80 w-full shrink-0 border-l bg-card lg:max-h-none max-h-96 overflow-hidden">+ {activeSlide ? (+ <Inspector+ key={`${state.device}:${activeSlide.id}`}+ slide={activeSlide}+ device={state.device}+ orientation={state.orientation}+ theme={theme}+ locale={state.locale}+ appIcon={state.appIcon}+ onAppIconChange={(appIcon) => setState((p) => ({ ...p, appIcon }))}+ selectedElementId={+ selectedElement?.slideId === activeSlide.id ? selectedElement.elementId : null+ }+ onChange={(patch) => patchSlide(activeSlide.id, patch)}+ onUpdate={(update) => updateSlide(activeSlide.id, update)}+ onSelectElement={(elementId) =>+ setSelectedElement(+ elementId ? { slideId: activeSlide.id, elementId } : null,+ )+ }+ />+ ) : (+ <div className="flex h-full flex-col items-center justify-center gap-2 p-6 text-center text-sm text-muted-foreground">+ <p className="font-medium text-foreground">Nothing to inspect</p>+ <p className="text-xs">Screen settings will appear here once you add or select one.</p>+ </div>+ )}+ </aside>+ </div>++ {/* Off-screen export container — full-resolution canvases for html-to-image. */}+ <div+ aria-hidden+ style={{+ position: "absolute",+ left: -99999,+ top: 0,+ pointerEvents: "none",+ }}+ >+ {exportSlides.length > 0 && (+ <div+ ref={exportRef}+ style={{+ width: exportCanvas.cW,+ height: exportCanvas.cH,+ overflow: "hidden",+ position: "absolute",+ left: -99999,+ top: 0,+ }}+ >+ <div+ style={{+ position: "absolute",+ left: -exportSlideIndex * exportCanvas.cW,+ top: 0,+ width: exportCanvas.cW * exportSlides.length,+ height: exportCanvas.cH,+ }}+ >+ <DeckCanvas+ slides={exportSlides}+ device={exportState.device}+ orientation={exportState.orientation}+ theme={themeById(exportState.themeId)}+ locale={exportLocaleOverride ?? exportState.locale}+ appName={exportState.appName}+ appIcon={exportState.appIcon}+ fontFamily={SCREENSHOT_FONTS[exportState.fontId || DEFAULT_SCREENSHOT_FONT_ID].family}+ connectedCanvas={exportState.connectedCanvas}+ hideEmpty+ />+ </div>+ </div>+ )}+ </div>+ </div>+ );+}++// Text fields and contenteditable text keep their native undo/redo, selection,+// and deletion. Sliders, colour pickers, checkboxes and buttons have no text+// history of their own, so the editor's shortcuts still apply while they're focused.+const NON_TEXT_INPUT_TYPES = new Set(["range", "color", "checkbox", "radio", "button", "submit", "reset", "file"]);++function isTextEditable(target: HTMLElement | null) {+ if (!target) return false;+ if (target.isContentEditable || target.tagName === "TEXTAREA" || target.tagName === "SELECT") return true;+ if (target.tagName === "INPUT") return !NON_TEXT_INPUT_TYPES.has((target as HTMLInputElement).type);+ return false;+}++// Registers the imported font in <head>, not inside the canvases: html-to-image+// embeds @font-face rules it finds in document.styleSheets, while a <style>+// cloned into the export SVG would point at a URL the SVG image can't load.+function useImportedFontFace(font: ImportedFont | undefined) {+ React.useEffect(() => {+ if (!font) return;+ const style = document.createElement("style");+ style.dataset.importedScreenshotFont = "";+ style.textContent = `@font-face { font-family: "${IMPORTED_FONT_FAMILY}"; src: url("${font.src}") format("${font.format}"); font-display: block; }`;+ document.head.appendChild(style);+ return () => style.remove();+ }, [font?.src, font?.format]);+}++function slugify(s: string) {+ return (+ s+ .toLowerCase()+ .replace(/[^a-z0-9]+/g, "-")+ .replace(/(^-|-$)/g, "") || "screenshots"+ );+}++function slideNeedsScreenshot(device: Device, slide: Slide) {+ if (device === "feature-graphic") return false;+ return slide.layout !== "no-device" && slide.layout !== "feature-graphic";+}++function stamp() {+ const d = new Date();+ const pad = (n: number) => String(n).padStart(2, "0");+ return `${d.getFullYear()}${pad(d.getMonth() + 1)}${pad(d.getDate())}-${pad(d.getHours())}${pad(d.getMinutes())}`;+}diff --git a/marketing/app-store-screenshots/src/components/editor/screenshot-picker.tsx b/marketing/app-store-screenshots/src/components/editor/screenshot-picker.tsxnew file mode 100644index 00000000..951e6f89--- /dev/null+++ b/marketing/app-store-screenshots/src/components/editor/screenshot-picker.tsx@@ -0,0 +1,216 @@+"use client";+import * as React from "react";+import { Image as ImageIcon, Upload, X } from "lucide-react";+import { Button } from "@/components/ui/button";+import { didFail, img, setImage } from "@/lib/image-cache";+import { resolveScreenshot } from "@/lib/locale";++type Props = {+ label: string;+ value: string;+ locale?: string;+ onChange: (v: string) => void;+};++const ACCEPTED = ["image/png", "image/jpeg"];+class UploadRejectedError extends Error {}++async function fileToDataUrl(file: File): Promise<string> {+ return new Promise((resolve, reject) => {+ const reader = new FileReader();+ reader.onloadend = () => resolve(reader.result as string);+ reader.onerror = reject;+ reader.readAsDataURL(file);+ });+}++async function uploadDataUrl(dataUrl: string): Promise<string | null> {+ try {+ const resp = await fetch("/api/upload", {+ method: "POST",+ headers: { "content-type": "application/json" },+ body: JSON.stringify({ dataUrl }),+ signal: AbortSignal.timeout(15000),+ });+ if (resp.status >= 400 && resp.status < 500 && resp.status !== 404) {+ const error = await resp.json().catch(() => ({}));+ throw new UploadRejectedError(error.error || "Image upload was rejected");+ }+ if (!resp.ok) return null;+ const json = (await resp.json()) as { ok: boolean; path?: string };+ return json.ok && json.path ? json.path : null;+ } catch (error) {+ if (error instanceof UploadRejectedError) throw error;+ return null;+ }+}++export function ScreenshotPicker({ label, value, locale, onChange }: Props) {+ const requestId = React.useRef(0);+ React.useEffect(() => () => { requestId.current += 1; }, []);+ const inputRef = React.useRef<HTMLInputElement>(null);+ const [dragging, setDragging] = React.useState(false);+ const [error, setError] = React.useState<string | null>(null);+ const [uploading, setUploading] = React.useState(false);++ React.useEffect(() => {+ setError(null);+ }, [value, locale]);++ async function handleFile(file: File) {+ const request = ++requestId.current;+ setUploading(false);+ setError(null);+ if (!ACCEPTED.includes(file.type)) {+ setError("Use PNG or JPG (App Store rejects other formats)");+ return;+ }+ if (file.size > 8 * 1024 * 1024) {+ setError("Image too large (>8MB)");+ return;+ }+ let dataUrl: string;+ try {+ dataUrl = await fileToDataUrl(file);+ } catch {+ if (request === requestId.current) setError("Failed to read file");+ return;+ }+ if (request !== requestId.current) return;+ try {+ const image = new Image();+ image.src = dataUrl;+ await image.decode();+ if (image.naturalWidth * image.naturalHeight > 64 * 1024 * 1024) throw new Error("too large");+ } catch {+ if (request === requestId.current) setError("Image is corrupt or exceeds 64 megapixels");+ return;+ }+ if (request !== requestId.current) return;+ // Try to persist to disk so the screenshot survives a git clone.+ // If the upload endpoint is unreachable (e.g. static export), fall back+ // to the inline data URI — still works in the current session.+ setUploading(true);+ let uploadedPath: string | null;+ try { uploadedPath = await uploadDataUrl(dataUrl); }+ catch (error) {+ if (request === requestId.current) {+ setUploading(false);+ setError(error instanceof Error ? error.message : "Image upload failed");+ }+ return;+ }+ if (request !== requestId.current) return;+ setUploading(false);+ if (uploadedPath) {+ setImage(uploadedPath, dataUrl);+ onChange(uploadedPath);+ } else {+ setImage(dataUrl, dataUrl);+ onChange(dataUrl);+ }+ }++ const hasValue = !!value;+ const isData = hasValue && value.startsWith("data:");+ const resolvedValue = hasValue && !isData && locale ? resolveScreenshot(value, locale) : value;+ const previewSrc = isData ? value : hasValue ? img(resolvedValue) : "";+ // Only flag "image not found" when the path is a real URL that we tried and failed.+ const knownMissing = hasValue && !isData && didFail(resolvedValue);+ const valueLabel = uploading+ ? "saving…"+ : !hasValue+ ? "drop image, or click Pick"+ : isData+ ? "uploaded image (not on disk)"+ : value.replace(/^.*\/(?=[^/]+\/[^/]+$)/, "…/");++ return (+ <div className="space-y-1">+ <div+ className={`flex items-center gap-3 rounded-md border p-2 transition-colors ${+ dragging ? "border-primary bg-accent ring-2 ring-primary/30" : "border-input"+ }`}+ onDragOver={(e) => {+ e.preventDefault();+ if (!dragging) setDragging(true);+ }}+ onDragLeave={(e) => {+ if (e.currentTarget === e.target) setDragging(false);+ }}+ onDrop={async (e) => {+ e.preventDefault();+ setDragging(false);+ const file = e.dataTransfer.files?.[0];+ if (file) await handleFile(file);+ }}+ >+ <div className="flex h-12 w-12 shrink-0 items-center justify-center overflow-hidden rounded-md border bg-muted">+ {previewSrc ? (+ // eslint-disable-next-line @next/next/no-img-element+ <img+ src={previewSrc}+ alt=""+ className="h-full w-full object-cover"+ draggable={false}+ onError={() => setError("Image failed to load")}+ />+ ) : (+ <ImageIcon className="h-4 w-4 text-muted-foreground" />+ )}+ </div>+ <div className="flex min-w-0 flex-1 flex-col">+ <span className="truncate text-xs font-medium">{label}</span>+ <span className="truncate text-[10px] text-muted-foreground">+ {dragging ? "Drop to upload" : valueLabel}+ </span>+ </div>+ <input+ ref={inputRef}+ type="file"+ accept="image/png,image/jpeg"+ className="hidden"+ onChange={async (e) => {+ const input = e.currentTarget;+ const file = input.files?.[0];+ if (file) await handleFile(file);+ input.value = "";+ }}+ />+ <Button+ type="button"+ variant="outline"+ size="sm"+ className="h-8"+ onClick={() => inputRef.current?.click()}+ >+ <Upload className="h-3.5 w-3.5" />+ Pick+ </Button>+ {hasValue && (+ <Button+ type="button"+ variant="ghost"+ size="icon"+ className="h-8 w-8"+ onClick={() => {+ requestId.current += 1;+ setUploading(false);+ onChange("");+ setError(null);+ }}+ aria-label="Clear screenshot"+ title="Clear"+ >+ <X className="h-4 w-4" />+ </Button>+ )}+ </div>+ {error ? (+ <p className="text-[11px] text-destructive">{error}</p>+ ) : knownMissing ? (+ <p className="text-[11px] text-destructive">Image not found at {resolvedValue}</p>+ ) : null}+ </div>+ );+}diff --git a/marketing/app-store-screenshots/src/components/editor/sidebar.tsx b/marketing/app-store-screenshots/src/components/editor/sidebar.tsxnew file mode 100644index 00000000..4214b4e1--- /dev/null+++ b/marketing/app-store-screenshots/src/components/editor/sidebar.tsx@@ -0,0 +1,144 @@+"use client";+import * as React from "react";+import {+ DndContext,+ KeyboardSensor,+ PointerSensor,+ closestCenter,+ useSensor,+ useSensors,+ type DragEndEvent,+} from "@dnd-kit/core";+import {+ SortableContext,+ arrayMove,+ sortableKeyboardCoordinates,+ verticalListSortingStrategy,+} from "@dnd-kit/sortable";+import { Plus } from "lucide-react";+import { Button } from "@/components/ui/button";+import type { Device, Orientation, Slide, Theme } from "@/lib/types";+import { newSlide } from "@/lib/defaults";+import { SlideThumb } from "./slide-thumb";++type Props = {+ slides: Slide[];+ activeId: string | null;+ device: Device;+ orientation: Orientation;+ theme: Theme;+ locale: string;+ appName?: string;+ appIcon?: string;+ fontFamily?: string;+ connectedCanvas: boolean;+ disabled?: boolean;+ onReorder: (next: Slide[]) => void;+ onSelect: (id: string) => void;+ onDelete: (id: string) => void;+ onDuplicate: (id: string) => void;+ onAdd: (slide: Slide) => void;+};++export function Sidebar({+ slides,+ activeId,+ device,+ orientation,+ theme,+ locale,+ appName,+ appIcon,+ fontFamily,+ connectedCanvas,+ disabled,+ onReorder,+ onSelect,+ onDelete,+ onDuplicate,+ onAdd,+}: Props) {+ const sensors = useSensors(+ useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),+ useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates }),+ );++ const handleDragEnd = (e: DragEndEvent) => {+ const { active, over } = e;+ if (!over || active.id === over.id) return;+ const oldIdx = slides.findIndex((s) => s.id === active.id);+ const newIdx = slides.findIndex((s) => s.id === over.id);+ if (oldIdx === -1 || newIdx === -1) return;+ onReorder(arrayMove(slides, oldIdx, newIdx));+ };++ return (+ <div className="flex h-full flex-col">+ <div className="border-b p-3">+ <h2 className="text-sm font-semibold">Screens</h2>+ <p className="text-xs text-muted-foreground">+ {slides.length} screen{slides.length === 1 ? "" : "s"} · drag to reorder+ </p>+ </div>++ <div className="flex-1 overflow-y-auto p-2">+ <DndContext sensors={sensors} collisionDetection={closestCenter} onDragEnd={handleDragEnd}>+ <SortableContext items={slides.map((s) => s.id)} strategy={verticalListSortingStrategy}>+ <div className="space-y-1.5">+ {slides.map((slide, i) => (+ <SlideThumb+ key={slide.id}+ slide={slide}+ slides={slides}+ index={i}+ active={slide.id === activeId}+ device={device}+ orientation={orientation}+ theme={theme}+ locale={locale}+ appName={appName}+ appIcon={appIcon}+ fontFamily={fontFamily}+ connectedCanvas={connectedCanvas}+ onSelect={() => onSelect(slide.id)}+ onDelete={() => onDelete(slide.id)}+ onDuplicate={() => onDuplicate(slide.id)}+ />+ ))}+ {slides.length === 0 && (+ <div className="rounded-lg border border-dashed p-6 text-center">+ <p className="text-xs font-medium text-foreground">No screens yet</p>+ <p className="mt-1 text-[11px] text-muted-foreground">+ Click <span className="font-semibold">Add screen</span> to get started.+ </p>+ </div>+ )}+ </div>+ </SortableContext>+ </DndContext>+ </div>++ <div className="border-t bg-card p-3">+ <Button+ type="button"+ className="w-full"+ variant="default"+ onClick={() =>+ onAdd(+ newSlide(+ device === "feature-graphic"+ ? "feature-graphic"+ : device === "mac"+ ? "split-landscape"+ : "device-bottom",+ ),+ )+ }+ disabled={disabled}+ >+ <Plus className="h-4 w-4" /> Add screen+ </Button>+ </div>+ </div>+ );+}diff --git a/marketing/app-store-screenshots/src/components/editor/slide-canvas.tsx b/marketing/app-store-screenshots/src/components/editor/slide-canvas.tsxnew file mode 100644index 00000000..0415ccba--- /dev/null+++ b/marketing/app-store-screenshots/src/components/editor/slide-canvas.tsx@@ -0,0 +1,1466 @@+"use client";+import * as React from "react";+import { Rnd } from "react-rnd";+import { RotateCw } from "lucide-react";+import type {+ BuiltInElementId,+ Device,+ ElementId,+ ElementTransform,+ ImageElement,+ Orientation,+ SelectedElement,+ Slide,+ TextElement,+ Theme,+} from "@/lib/types";+import {+ CANVAS,+ CARPLAY_RATIO,+ IPAD_RATIO,+ MAC_RATIO,+ MK_RATIO,+ TV_RATIO,+ WATCH_RATIO,+ carPlayW,+ ipadW,+ macW,+ phoneW,+ phoneWSmall,+ tabletLW,+ tabletPW,+ tvW,+ watchW,+} from "@/lib/constants";+import { imageElementKey, isImageElementId, toImageElementId, toTextElementId } from "@/lib/elements";+import { img } from "@/lib/image-cache";+import { pickText, resolveScreenshot } from "@/lib/locale";+import { slideColors } from "@/lib/contrast";+import { defaultTextElementFontSize, slideFontScales } from "@/lib/typography";+import {+ AndroidPhone,+ AppleTV,+ AppleWatch,+ CarPlayScreen,+ AndroidTabletL,+ AndroidTabletP,+ IPad,+ MacWindow,+ Phone,+} from "./device-frames";+import { ImageElementCanvas } from "./image-element-canvas";++type FrameComp = React.ComponentType<{+ src: string;+ alt?: string;+ style?: React.CSSProperties;+ hideEmpty?: boolean;+}>;++export function getCanvas(device: Device, orientation: Orientation) {+ const c = CANVAS[device];+ if ((device === "android-7" || device === "android-10") && orientation === "landscape") {+ return { cW: c.wL!, cH: c.hL! };+ }+ return { cW: c.w, cH: c.h };+}++// Aspect ratio (w/h) of each device frame — must match device-frames.tsx+function getFrameAspect(device: Device, orientation: Orientation) {+ switch (device) {+ case "iphone": return MK_RATIO;+ case "android": return 9 / 19.5;+ case "ipad": return IPAD_RATIO;+ case "tvos": return TV_RATIO;+ case "watchos": return WATCH_RATIO;+ case "carplay": return CARPLAY_RATIO;+ case "mac": return MAC_RATIO;+ case "android-7":+ case "android-10": return orientation === "landscape" ? 8 / 5 : 5 / 8;+ default: return 1;+ }+}++export function getFrameForDevice(device: Device, orientation: Orientation): {+ Comp: FrameComp;+ widthFn: (cW: number, cH: number) => number;+ smallWidthFn: (cW: number, cH: number) => number;+} {+ switch (device) {+ case "iphone":+ return { Comp: Phone, widthFn: phoneW, smallWidthFn: phoneWSmall };+ case "ipad":+ return { Comp: IPad, widthFn: ipadW, smallWidthFn: (cW, cH) => ipadW(cW, cH, 0.6) };+ case "tvos":+ return { Comp: AppleTV, widthFn: tvW, smallWidthFn: (cW, cH) => tvW(cW, cH, 0.56) };+ case "watchos":+ return { Comp: AppleWatch, widthFn: watchW, smallWidthFn: (cW, cH) => watchW(cW, cH, 0.42) };+ case "carplay":+ return { Comp: CarPlayScreen, widthFn: carPlayW, smallWidthFn: (cW, cH) => carPlayW(cW, cH, 0.7) };+ case "mac":+ return { Comp: MacWindow, widthFn: macW, smallWidthFn: (cW, cH) => macW(cW, cH, 0.46) };+ case "android":+ return { Comp: AndroidPhone, widthFn: phoneW, smallWidthFn: phoneWSmall };+ case "android-7":+ case "android-10":+ if (orientation === "landscape") {+ return { Comp: AndroidTabletL, widthFn: tabletLW, smallWidthFn: (cW, cH) => tabletLW(cW, cH, 0.5) };+ }+ return { Comp: AndroidTabletP, widthFn: tabletPW, smallWidthFn: (cW, cH) => tabletPW(cW, cH, 0.62) };+ default:+ return { Comp: Phone, widthFn: phoneW, smallWidthFn: phoneWSmall };+ }+}++type EditHandlers = {+ onLabelChange?: (v: string) => void;+ onHeadlineChange?: (v: string) => void;+ onTextElementTextChange?: (id: string, v: string) => void;+ onElementChange?: (id: ElementId, t: ElementTransform) => void;+ onSelectElement?: (id: ElementId | null) => void;+};++type Props = {+ slide: Slide;+ device: Device;+ orientation: Orientation;+ theme: Theme;+ locale: string;+ appName?: string;+ appIcon?: string;+ fontFamily?: string;+ editable?: boolean;+ edit?: EditHandlers;+ selectedElementId?: ElementId | null;+ // Preview scale (1.0 = full size). Used so react-rnd maps drag deltas correctly+ // when the canvas is rendered inside a CSS-transformed container.+ previewScale?: number;+ /** When true, suppress the "Drop a screenshot here" placeholder. Used for export. */+ hideEmpty?: boolean;+};++type DeckEditHandlers = {+ onLabelChange?: (slideId: string, v: string) => void;+ onHeadlineChange?: (slideId: string, v: string) => void;+ onTextElementTextChange?: (slideId: string, id: string, v: string) => void;+ onElementChange?: (slideId: string, id: ElementId, t: ElementTransform) => void;+ onSelectElement?: (element: SelectedElement | null) => void;+ onSelectScreen?: (slideId: string) => void;+};++type DeckCanvasProps = {+ slides: Slide[];+ device: Device;+ orientation: Orientation;+ theme: Theme;+ locale: string;+ appName?: string;+ appIcon?: string;+ fontFamily?: string;+ connectedCanvas?: boolean;+ editable?: boolean;+ edit?: DeckEditHandlers;+ selectedElement?: SelectedElement | null;+ activeSlideId?: string | null;+ previewScale?: number;+ hideEmpty?: boolean;+ showGuides?: boolean;+};++// ---------- Editable text helpers ----------++function EditableText({+ value,+ editable,+ onChange,+ style,+ multiline = false,+ placeholder,+ onFocus,+}: {+ value: string;+ editable?: boolean;+ onChange?: (v: string) => void;+ style?: React.CSSProperties;+ multiline?: boolean;+ placeholder?: string;+ onFocus?: () => void;+}) {+ const ref = React.useRef<HTMLDivElement>(null);+ React.useEffect(() => {+ const el = ref.current;+ if (!el) return;+ const incoming = value || "";+ if (el.textContent !== incoming && document.activeElement !== el) {+ el.textContent = incoming;+ }+ }, [value]);++ const handleInput = (e: React.FormEvent<HTMLDivElement>) => {+ if (!onChange) return;+ // A cleared contenteditable keeps a placeholder <br>, which innerText+ // reports as "\n"; that would save a blank line instead of clearing.+ const raw = e.currentTarget.textContent ? e.currentTarget.innerText : "";+ const text = (raw || "").replace(/\u00a0/g, " ");+ onChange(multiline ? text : text.replace(/\n/g, ""));+ };++ return (+ <div+ ref={ref}+ // Per-text base direction: RTL copy (ar, he, fa, ur) keeps its+ // punctuation on the correct side without flipping LTR locales.+ dir="auto"+ // Plain text only: pasted or dropped rich text would otherwise keep its+ // colours and fonts on the canvas while the export uses the plain copy.+ contentEditable={editable ? "plaintext-only" : false}+ suppressContentEditableWarning+ data-placeholder={placeholder}+ onInput={handleInput}+ onFocus={() => onFocus?.()}+ onBlur={(e) => {+ // Edits skip syncing while focused; catch up so the canvas shows what+ // will export (e.g. clearing a translation falls back to English).+ const incoming = value || "";+ if (e.currentTarget.textContent !== incoming) e.currentTarget.textContent = incoming;+ }}+ onKeyDown={(e) => {+ if (!multiline && e.key === "Enter") {+ e.preventDefault();+ e.currentTarget.blur();+ }+ }}+ onMouseDown={(e) => {+ // Allow text editing without starting an Rnd drag.+ if (editable) {+ e.stopPropagation();+ onFocus?.();+ }+ }}+ onPointerDown={(e) => {+ if (editable) e.stopPropagation();+ }}+ style={{+ outline: "none",+ whiteSpace: multiline ? "pre-wrap" : "nowrap",+ cursor: editable ? "text" : "default",+ ...style,+ }}+ />+ );+}++// ---------- Caption (label + headline) ----------++function Caption({+ cW,+ cH,+ slide,+ theme,+ locale,+ editable,+ edit,+ align = "center",+ inverted,+ onFocus,+}: {+ cW: number;+ cH: number;+ slide: Slide;+ theme: Theme;+ locale: string;+ editable?: boolean;+ edit?: EditHandlers;+ align?: "center" | "left";+ inverted?: boolean;+ onFocus?: () => void;+}) {+ 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);+ 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%" }}>+ <EditableText+ value={pickText(slide.label, locale)}+ editable={editable}+ onChange={edit?.onLabelChange}+ onFocus={onFocus}+ placeholder="LABEL"+ style={{+ // Floor keeps the label legible on the 422×514 Apple Watch canvas;+ // the per-slide scale is applied on top of the floored base.+ fontSize: Math.max(unit * 0.028, 16) * labelScale,+ fontWeight: 600,+ letterSpacing: Math.max(unit * 0.0015, 0.8) * labelScale,+ color: accent,+ textTransform: "uppercase",+ marginBottom: unit * 0.018,+ minHeight: unit * 0.03,+ }}+ />+ <EditableText+ value={pickText(slide.headline, locale)}+ editable={editable}+ multiline+ onChange={edit?.onHeadlineChange}+ onFocus={onFocus}+ placeholder="Headline goes here"+ style={{+ fontSize: unit * 0.092 * headlineScale,+ fontWeight: 700,+ lineHeight: 0.96,+ letterSpacing: -unit * 0.001 * headlineScale,+ color: fg,+ }}+ />+ </div>+ );+}++// ---------- Background ----------++function backgroundFor(theme: Theme, inverted?: boolean, customColor?: string) {+ if (customColor) {+ return `linear-gradient(160deg, ${customColor} 0%, ${shade(customColor, -6)} 100%)`;+ }+ if (inverted) {+ return `linear-gradient(160deg, ${theme.bgAlt} 0%, ${shade(theme.bgAlt, -8)} 100%)`;+ }+ return `linear-gradient(160deg, ${theme.bg} 0%, ${shade(theme.bg, -6)} 100%)`;+}++function shade(hex: string, percent: number) {+ const c = hex.replace("#", "");+ const num = parseInt(c.length === 3 ? c.split("").map((x) => x + x).join("") : c, 16);+ let r = (num >> 16) & 0xff;+ let g = (num >> 8) & 0xff;+ let b = num & 0xff;+ const amt = Math.round((255 * percent) / 100);+ r = Math.max(0, Math.min(255, r + amt));+ g = Math.max(0, Math.min(255, g + amt));+ b = Math.max(0, Math.min(255, b + amt));+ return `#${((r << 16) | (g << 8) | b).toString(16).padStart(6, "0")}`;+}++// ---------- Halftone field ----------++// Dot grid whose dots shrink away from two corners, like the Codync icon.+// The heavy corner sits on the device side so the headline stays on a clean ground.+function Halftone({ cW, cH, color, topText }: { cW: number; cH: number; color: string; topText: boolean }) {+ const step = cW * 0.036;+ const fields = topText+ ? [{ x: 0, y: 0, r: cW * 1.05 }, { x: cW, y: cH, r: cW * 0.55 }]+ : [{ x: cW, y: cH, r: cW * 1.05 }, { x: 0, y: 0, r: cW * 0.55 }];+ const dots: React.ReactElement[] = [];+ for (let y = step / 2; y < cH; y += step) {+ for (let x = step / 2; x < cW; x += step) {+ const t = Math.max(...fields.map((f) => 1 - Math.hypot(x - f.x, y - f.y) / f.r));+ const r = step * 0.46 * t;+ if (r > step * 0.07) dots.push(<circle key={`${x}-${y}`} cx={x} cy={y} r={r} />);+ }+ }+ return (+ <svg width={cW} height={cH} style={{ position: "absolute", inset: 0 }} fill={color} opacity={0.22}>+ {dots}+ </svg>+ );+}++// ---------- Decorative blob ----------++function Blob({+ cW,+ color,+ x,+ y,+ size,+ opacity = 0.4,+}: {+ cW: number;+ color: string;+ x: number;+ y: number;+ size: number;+ opacity?: number;+}) {+ return (+ <div+ style={{+ position: "absolute",+ left: `${x}%`,+ top: `${y}%`,+ width: `${size}%`,+ aspectRatio: "1 / 1",+ background: color,+ borderRadius: "50%",+ filter: `blur(${cW * 0.06}px)`,+ opacity,+ pointerEvents: "none",+ }}+ />+ );+}++// ---------- Default element rects per layout ----------++type Rect = { x: number; y: number; width: number; height: number };+type LayoutRects = {+ caption?: Rect & { align?: "center" | "left" };+ device?: Rect;+ deviceSecondary?: Rect;+};++function getDefaultRects(+ layout: Slide["layout"],+ cW: number,+ cH: number,+ frameAspect: number,+ fwFrac: number,+ fwSmallFrac: number,+ // Phones and tablets are deliberately hung past the canvas edge so they bleed off+ // it. When true (TV, watch, CarPlay, Mac), every device rect stays fully inside the+ // canvas instead.+ contain = false,+): LayoutRects {+ const deviceW = fwFrac * cW;+ const deviceH = deviceW / frameAspect;+ const smallW = fwSmallFrac * cW;+ const smallH = smallW / frameAspect;+ const capW = cW * 0.84;+ const capH = cH * 0.28;++ switch (layout) {+ case "hero":+ return {+ caption: { x: cW * 0.08, y: cH * 0.09, width: capW, height: capH, align: "center" },+ device: {+ x: (cW - deviceW) / 2,+ y: contain ? cH - deviceH - cH * 0.05 : cH - deviceH + deviceH * 0.15,+ width: deviceW,+ height: deviceH,+ },+ };+ case "device-bottom":+ return {+ caption: { x: cW * 0.08, y: cH * 0.08, width: capW, height: capH, align: "center" },+ device: {+ x: (cW - deviceW) / 2,+ y: cH - deviceH - cH * 0.02,+ width: deviceW,+ height: deviceH,+ },+ };+ case "device-top":+ return {+ caption: { x: cW * 0.08, y: cH * 0.65, width: capW, height: capH, align: "center" },+ device: {+ x: (cW - deviceW) / 2,+ y: contain ? cH * 0.05 : -cH * 0.1,+ width: deviceW,+ height: deviceH,+ },+ };+ case "two-devices":+ return {+ caption: { x: cW * 0.08, y: cH * 0.08, width: capW, height: capH, align: "center" },+ deviceSecondary: {+ x: contain ? cW * 0.04 : -cW * 0.06,+ y: cH - smallH - cH * 0.05,+ width: smallW,+ height: smallH,+ },+ device: {+ x: contain ? cW - deviceW * 0.9 - cW * 0.04 : cW - deviceW * 0.9 + cW * 0.06,+ y: contain ? cH - (deviceW * 0.9) / frameAspect - cH * 0.05 : cH - deviceH * 0.9 - cH * 0.02,+ width: deviceW * 0.9,+ height: (deviceW * 0.9) / frameAspect,+ },+ };+ case "no-device":+ return {+ caption: {+ x: cW * 0.1,+ y: cH * 0.35,+ width: cW * 0.8,+ height: cH * 0.3,+ align: "center",+ },+ };+ case "split-landscape": {+ // Contained devices sit beside the caption instead of sliding under it.+ // The caption is beside it, not above, so it can be taller than elsewhere.+ const splitW = contain ? Math.min(cW * 0.5, cH * 0.84 * frameAspect) : deviceW;+ const splitH = splitW / frameAspect;+ return {+ caption: {+ x: cW * 0.05,+ y: cH * 0.25,+ width: cW * 0.38,+ height: cH * 0.5,+ align: "left",+ },+ device: {+ x: contain ? cW - splitW - cW * 0.05 : cW - deviceW + cW * 0.03,+ y: (cH - splitH) / 2,+ width: splitW,+ height: splitH,+ },+ };+ }+ default:+ return {};+ }+}++function rectFor(+ id: BuiltInElementId,+ slide: Slide,+ defaults: LayoutRects,+): (Rect & { align?: "center" | "left" }) | undefined {+ const saved = slide.transforms?.[id];+ const def = defaults[id];+ if (!def && !saved) return undefined;+ if (!saved) return def;+ return {+ x: saved.x,+ y: saved.y,+ width: saved.width,+ height: saved.height,+ align: (def as { align?: "center" | "left" } | undefined)?.align,+ };+}++// 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"]);++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);+ const fwFrac = widthFn(cW, cH);+ const fwSmallFrac = smallWidthFn(cW, cH);+ const defaults = getDefaultRects(+ slide.layout, cW, cH, frameAspect, fwFrac, fwSmallFrac,+ CONTAINED_DEVICES.has(device),+ );+ return { cW, cH, Frame, frameAspect, defaults };+}++export function getElementTransform(+ slide: Slide,+ device: Device,+ orientation: Orientation,+ id: ElementId,+): ElementTransform | undefined {+ if (id.startsWith("text:")) {+ const textId = id.slice("text:".length);+ const textElement = slide.textElements?.find((element) => element.id === textId);+ return textElement?.transform;+ }+ if (isImageElementId(id)) {+ const imageId = imageElementKey(id);+ return slide.imageElements?.find((element) => element.id === imageId)?.transform;+ }+ const { defaults } = getSlideGeometry(slide, device, orientation);+ const rect = rectFor(id as BuiltInElementId, slide, defaults);+ if (!rect) return undefined;+ const saved = slide.transforms?.[id as BuiltInElementId];+ return {+ x: rect.x,+ y: rect.y,+ width: rect.width,+ height: rect.height,+ rotation: saved?.rotation ?? 0,+ zIndex: saved?.zIndex ?? defaultElementZ(id as BuiltInElementId),+ };+}++function defaultElementZ(id: BuiltInElementId): number {+ if (id === "deviceSecondary") return 2;+ if (id === "device") return 3;+ return 4;+}++// ---------- Main single-screen canvas ----------++export function SlideCanvas({+ slide,+ device,+ orientation,+ theme,+ locale,+ appName,+ appIcon,+ fontFamily,+ editable,+ edit,+ selectedElementId = null,+ previewScale = 1,+ hideEmpty,+}: Props) {+ const { cW, cH } = getCanvas(device, orientation);++ if (slide.layout === "feature-graphic" || device === "feature-graphic") {+ return (+ <div style={{ width: "100%", height: "100%", fontFamily }}>+ <FeatureGraphicCanvas+ slide={slide}+ cW={cW}+ theme={theme}+ locale={locale}+ appName={appName}+ appIcon={appIcon}+ editable={editable}+ edit={edit}+ />+ </div>+ );+ }++ const handleBackgroundMouseDown = editable+ ? (e: React.MouseEvent<HTMLDivElement>) => {+ if (e.target === e.currentTarget) edit?.onSelectElement?.(null);+ }+ : undefined;++ return (+ <div+ onMouseDown={handleBackgroundMouseDown}+ style={{+ width: "100%",+ height: "100%",+ position: "relative",+ overflow: "hidden",+ fontFamily,+ }}+ >+ <SlideBackground slide={slide} cW={cW} cH={cH} theme={theme} />+ <SlideElements+ slide={slide}+ device={device}+ orientation={orientation}+ theme={theme}+ locale={locale}+ editable={editable}+ edit={edit}+ selectedElementId={selectedElementId}+ previewScale={previewScale}+ hideEmpty={hideEmpty}+ screenX={0}+ boundsW={cW}+ boundsH={cH}+ allowCrossScreen={false}+ />+ </div>+ );+}++// ---------- Connected deck canvas ----------++export function DeckCanvas({+ slides,+ device,+ orientation,+ theme,+ locale,+ appName,+ appIcon,+ fontFamily,+ connectedCanvas = true,+ editable,+ edit,+ selectedElement = null,+ activeSlideId = null,+ previewScale = 1,+ hideEmpty,+ showGuides = false,+}: DeckCanvasProps) {+ const { cW, cH } = getCanvas(device, orientation);+ const totalW = Math.max(1, slides.length) * cW;++ return (+ <div+ style={{+ width: totalW,+ height: cH,+ position: "relative",+ overflow: "hidden",+ fontFamily,+ }}+ >+ {slides.map((slide, index) => {+ const screenX = index * cW;+ const active = activeSlideId === slide.id;+ if (slide.layout === "feature-graphic" || device === "feature-graphic") {+ return (+ <div+ key={`${slide.id}-feature`}+ onMouseDown={(e) => {+ if (!editable || e.defaultPrevented) return;+ edit?.onSelectScreen?.(slide.id);+ edit?.onSelectElement?.(null);+ }}+ style={{+ position: "absolute",+ left: screenX,+ top: 0,+ width: cW,+ height: cH,+ overflow: "hidden",+ }}+ >+ <FeatureGraphicCanvas+ slide={slide}+ cW={cW}+ theme={theme}+ locale={locale}+ appName={appName}+ appIcon={appIcon}+ editable={editable}+ edit={{+ onHeadlineChange: (v) => edit?.onHeadlineChange?.(slide.id, v),+ onSelectElement: () => edit?.onSelectScreen?.(slide.id),+ }}+ />+ {showGuides && <ScreenGuide cW={cW} cH={cH} index={index} active={active} />}+ </div>+ );+ }+ return (+ <div+ key={`${slide.id}-bg`}+ onMouseDown={(e) => {+ if (!editable || e.defaultPrevented) return;+ edit?.onSelectScreen?.(slide.id);+ edit?.onSelectElement?.(null);+ }}+ style={{+ position: "absolute",+ left: screenX,+ top: 0,+ width: cW,+ height: cH,+ overflow: "hidden",+ }}+ >+ <SlideBackground slide={slide} cW={cW} cH={cH} theme={theme} />+ {showGuides && <ScreenGuide cW={cW} cH={cH} index={index} active={active} />}+ </div>+ );+ })}++ {slides.map((slide, index) => {+ if (slide.layout === "feature-graphic" || device === "feature-graphic") return null;+ const selectedElementId =+ selectedElement?.slideId === slide.id ? selectedElement.elementId : null;+ const perSlideEdit: EditHandlers | undefined = editable+ ? {+ onLabelChange: (v) => edit?.onLabelChange?.(slide.id, v),+ onHeadlineChange: (v) => edit?.onHeadlineChange?.(slide.id, v),+ onTextElementTextChange: (id, v) => edit?.onTextElementTextChange?.(slide.id, id, v),+ onElementChange: (id, t) => edit?.onElementChange?.(slide.id, id, t),+ onSelectElement: (id) => {+ edit?.onSelectScreen?.(slide.id);+ edit?.onSelectElement?.(id ? { slideId: slide.id, elementId: id } : null);+ },+ }+ : undefined;++ const elements = (+ <SlideElements+ key={`${slide.id}-elements`}+ slide={slide}+ device={device}+ orientation={orientation}+ theme={theme}+ locale={locale}+ editable={editable}+ edit={perSlideEdit}+ selectedElementId={selectedElementId}+ previewScale={previewScale}+ hideEmpty={hideEmpty}+ screenX={connectedCanvas ? index * cW : 0}+ boundsW={connectedCanvas ? totalW : cW}+ boundsH={cH}+ allowCrossScreen={connectedCanvas}+ />+ );+ if (connectedCanvas) return elements;+ return (+ <div+ key={`${slide.id}-elements-isolated`}+ style={{+ position: "absolute",+ left: index * cW,+ top: 0,+ width: cW,+ height: cH,+ overflow: "hidden",+ }}+ >+ {elements}+ </div>+ );+ })}+ </div>+ );+}++function SlideBackground({+ slide,+ cW,+ cH,+ theme,+}: {+ slide: Slide;+ cW: number;+ cH: number;+ theme: Theme;+}) {+ const inverted = !!slide.inverted;+ return (+ <div+ style={{+ position: "absolute",+ inset: 0,+ overflow: "hidden",+ background: backgroundFor(theme, inverted, slide.backgroundColor),+ color: slideColors(theme, slide).fg,+ }}+ >+ {theme.halftone ? (+ <Halftone cW={cW} cH={cH} color={slideColors(theme, slide).fg} topText={slide.layout === "device-top"} />+ ) : (+ <>+ <Blob cW={cW} color={theme.accent} x={-15} y={-10} size={55} opacity={inverted ? 0.25 : 0.32} />+ <Blob cW={cW} color={theme.accent} x={70} y={75} size={45} opacity={inverted ? 0.18 : 0.25} />+ </>+ )}+ </div>+ );+}++function ScreenGuide({+ cW,+ cH,+ index,+ active,+}: {+ cW: number;+ cH: number;+ index: number;+ active: boolean;+}) {+ return (+ <div+ aria-hidden+ style={{+ position: "absolute",+ inset: 0,+ pointerEvents: "none",+ outline: `${active ? Math.max(4, cW * 0.003) : Math.max(2, cW * 0.0015)}px solid ${+ active ? "rgba(91, 124, 250, 0.95)" : "rgba(15, 23, 42, 0.22)"+ }`,+ outlineOffset: active ? -Math.max(4, cW * 0.003) : -Math.max(2, cW * 0.0015),+ boxShadow: active+ ? "inset 0 0 0 9999px rgba(91, 124, 250, 0.03)"+ : "inset 0 0 0 1px rgba(255, 255, 255, 0.22)",+ }}+ >+ <div+ style={{+ position: "absolute",+ left: cW * 0.035,+ top: cH * 0.024,+ borderRadius: cW * 0.018,+ padding: `${cH * 0.006}px ${cW * 0.018}px`,+ background: active ? "rgba(91, 124, 250, 0.92)" : "rgba(15, 23, 42, 0.72)",+ color: "white",+ fontSize: Math.max(24, cW * 0.022),+ lineHeight: 1,+ fontWeight: 700,+ letterSpacing: 0,+ }}+ >+ {index + 1}+ </div>+ </div>+ );+}++function FeatureGraphicCanvas({+ slide,+ cW,+ theme,+ locale,+ appName,+ appIcon,+ editable,+ edit,+}: {+ slide: Slide;+ cW: number;+ theme: Theme;+ locale: string;+ appName?: string;+ appIcon?: string;+ editable?: boolean;+ edit?: EditHandlers;+}) {+ const { headlineScale, appNameScale } = slideFontScales(slide);+ const inverted = slide.inverted ?? true;+ const bg = inverted ? theme.bgAlt : theme.bg;+ const colors = slideColors(theme, { ...slide, inverted });+ return (+ <div+ style={{+ width: "100%",+ height: "100%",+ position: "relative",+ overflow: "hidden",+ background: slide.backgroundColor || `linear-gradient(135deg, ${bg} 0%, ${shade(bg, -10)} 50%, ${theme.accent} 200%)`,+ display: "flex",+ alignItems: "center",+ padding: `0 ${cW * 0.06}px`,+ color: colors.fg,+ }}+ >+ <Blob cW={cW} color={theme.accent} x={70} y={20} size={50} opacity={0.45} />+ <div style={{ display: "flex", alignItems: "center", gap: cW * 0.03, zIndex: 2 }}>+ {appIcon && img(appIcon) ? (+ <img+ src={img(appIcon)}+ alt=""+ style={{+ width: cW * 0.13,+ height: cW * 0.13,+ borderRadius: cW * 0.022,+ boxShadow: "0 4px 16px rgba(0,0,0,0.3)",+ }}+ draggable={false}+ />+ ) : (+ <div+ aria-hidden+ style={{+ width: cW * 0.13,+ height: cW * 0.13,+ borderRadius: cW * 0.022,+ background: `linear-gradient(135deg, ${theme.accent}55, ${theme.accent})`,+ display: "flex",+ alignItems: "center",+ justifyContent: "center",+ color: colors.fg,+ fontWeight: 800,+ fontSize: cW * 0.07,+ boxShadow: "0 4px 16px rgba(0,0,0,0.3)",+ }}+ >+ {(appName || "A").slice(0, 1).toUpperCase()}+ </div>+ )}+ <div>+ <div style={{ fontSize: cW * 0.06 * appNameScale, fontWeight: 800, lineHeight: 1.05 }}>{appName || "App"}</div>+ <EditableText+ value={pickText(slide.headline, locale)}+ editable={editable}+ multiline+ onChange={edit?.onHeadlineChange}+ onFocus={() => edit?.onSelectElement?.("caption")}+ style={{+ fontSize: cW * 0.028 * headlineScale,+ color: colors.fg,+ opacity: 0.85,+ marginTop: cW * 0.012,+ lineHeight: 1.25,+ }}+ />+ </div>+ </div>+ </div>+ );+}++function SlideElements({+ slide,+ device,+ orientation,+ theme,+ locale,+ editable,+ edit,+ selectedElementId,+ previewScale,+ hideEmpty,+ screenX,+ boundsW,+ boundsH,+ allowCrossScreen,+}: {+ slide: Slide;+ device: Device;+ orientation: Orientation;+ theme: Theme;+ locale: string;+ editable?: boolean;+ edit?: EditHandlers;+ selectedElementId: ElementId | null;+ previewScale: number;+ hideEmpty?: boolean;+ screenX: number;+ boundsW: number;+ boundsH: number;+ allowCrossScreen: boolean;+}) {+ const screenshot = resolveScreenshot(slide.screenshot, locale);+ const screenshotSecondary = resolveScreenshot(slide.screenshotSecondary, locale);+ const { cW, cH, Frame, frameAspect, defaults } = getSlideGeometry(slide, device, orientation);+ const inverted = !!slide.inverted;+ const colors = slideColors(theme, slide);+ const captionRect = rectFor("caption", slide, defaults);+ const deviceRect = rectFor("device", slide, defaults);+ const secondaryRect = rectFor("deviceSecondary", slide, defaults);++ function toGlobal(rect: Rect): Rect {+ return { ...rect, x: rect.x + screenX };+ }++ function toLocal(t: ElementTransform): ElementTransform {+ return { ...t, x: t.x - screenX };+ }++ function renderCaption() {+ if (!captionRect) return null;+ const saved = slide.transforms?.caption;+ const rotation = saved?.rotation ?? 0;+ const zIndex = saved?.zIndex ?? 4;+ const inner = (+ <Caption+ cW={cW}+ cH={cH}+ slide={slide}+ theme={theme}+ locale={locale}+ editable={editable}+ edit={edit}+ align={captionRect.align || "center"}+ inverted={inverted}+ onFocus={() => edit?.onSelectElement?.("caption")}+ />+ );+ return (+ <Movable+ rect={toGlobal(captionRect)}+ boundsW={boundsW}+ boundsH={boundsH}+ editable={editable}+ previewScale={previewScale}+ rotation={rotation}+ onChange={(t) =>+ edit?.onElementChange?.(+ "caption",+ toLocal({+ ...t,+ rotation: t.rotation ?? rotation,+ zIndex: t.zIndex ?? zIndex,+ }),+ )+ }+ zIndex={zIndex}+ selected={selectedElementId === "caption"}+ onSelect={() => edit?.onSelectElement?.("caption")}+ allowOverflow={allowCrossScreen}+ >+ <div style={{ width: "100%", height: "100%", display: "flex", alignItems: "flex-start" }}>+ {inner}+ </div>+ </Movable>+ );+ }++ function renderDevice(id: "device" | "deviceSecondary", rect: Rect, src: string, extraStyle?: React.CSSProperties) {+ const saved = slide.transforms?.[id];+ const rotation = saved?.rotation ?? 0;+ const zIndex = saved?.zIndex ?? (id === "deviceSecondary" ? 2 : 3);+ return (+ <Movable+ rect={toGlobal(rect)}+ boundsW={boundsW}+ boundsH={boundsH}+ editable={editable}+ previewScale={previewScale}+ rotation={rotation}+ onChange={(t) =>+ edit?.onElementChange?.(+ id,+ toLocal({+ ...t,+ rotation: t.rotation ?? rotation,+ zIndex: t.zIndex ?? zIndex,+ }),+ )+ }+ lockAspectRatio={frameAspect}+ zIndex={zIndex}+ allowOverflow+ selected={selectedElementId === id}+ onSelect={() => edit?.onSelectElement?.(id)}+ >+ <Frame+ src={src}+ hideEmpty={hideEmpty}+ style={{ width: "100%", height: "100%", ...extraStyle }}+ />+ </Movable>+ );+ }++ function renderTextElement(textElement: TextElement, index: number) {+ const elementId = toTextElementId(textElement.id);+ const rect = textElement.transform;+ const rotation = rect.rotation ?? 0;+ const zIndex = rect.zIndex ?? 5 + index;+ const textColor = textElement.color || colors.fg;+ return (+ <Movable+ key={textElement.id}+ rect={toGlobal(rect)}+ boundsW={boundsW}+ boundsH={boundsH}+ editable={editable}+ previewScale={previewScale}+ rotation={rotation}+ onChange={(t) =>+ edit?.onElementChange?.(+ elementId,+ toLocal({+ ...t,+ rotation: t.rotation ?? rotation,+ zIndex: t.zIndex ?? zIndex,+ }),+ )+ }+ zIndex={zIndex}+ selected={selectedElementId === elementId}+ onSelect={() => edit?.onSelectElement?.(elementId)}+ allowOverflow={allowCrossScreen}+ >+ <div+ style={{+ width: "100%",+ height: "100%",+ display: "flex",+ alignItems: "center",+ justifyContent:+ textElement.align === "right"+ ? "flex-end"+ : textElement.align === "left"+ ? "flex-start"+ : "center",+ padding: `${Math.min(cW, cH) * 0.012}px`,+ }}+ >+ <EditableText+ value={pickText(textElement.text, locale)}+ editable={editable}+ multiline+ onChange={(value) => edit?.onTextElementTextChange?.(textElement.id, value)}+ onFocus={() => edit?.onSelectElement?.(elementId)}+ placeholder="Text"+ style={{+ width: "100%",+ color: textColor,+ fontSize: textElement.fontSize ?? defaultTextElementFontSize(cW, cH),+ fontWeight: textElement.fontWeight ?? 700,+ lineHeight: 1.05,+ textAlign: textElement.align ?? "center",+ textShadow: colors.dark ? "0 2px 18px rgba(0,0,0,0.22)" : "0 2px 18px rgba(255,255,255,0.2)",+ }}+ />+ </div>+ </Movable>+ );+ }++ function renderImageElement(imageElement: ImageElement, index: number) {+ const elementId = toImageElementId(imageElement.id);+ const rect = imageElement.transform;+ const rotation = rect.rotation ?? 0;+ const zIndex = rect.zIndex ?? 5 + index;+ return (+ <Movable+ key={imageElement.id}+ rect={toGlobal(rect)}+ boundsW={boundsW}+ boundsH={boundsH}+ editable={editable}+ previewScale={previewScale}+ rotation={rotation}+ onChange={(t) =>+ edit?.onElementChange?.(+ elementId,+ toLocal({+ ...t,+ rotation: t.rotation ?? rotation,+ zIndex: t.zIndex ?? zIndex,+ }),+ )+ }+ zIndex={zIndex}+ selected={selectedElementId === elementId}+ onSelect={() => edit?.onSelectElement?.(elementId)}+ allowOverflow={allowCrossScreen}+ >+ <ImageElementCanvas element={imageElement} editable={editable} />+ </Movable>+ );+ }++ return (+ <>+ {secondaryRect &&+ renderDevice(+ "deviceSecondary",+ secondaryRect,+ screenshotSecondary || screenshot,+ { opacity: 0.85 },+ )}+ {deviceRect && renderDevice("device", deviceRect, screenshot)}+ {renderCaption()}+ {(slide.imageElements || []).map(renderImageElement)}+ {(slide.textElements || []).map(renderTextElement)}+ </>+ );+}++// ---------- Movable wrapper ----------++// Fraction of an element's width/height that must remain inside the canvas+// when overflow is allowed. Keeps a graspable handle visible so the user can+// always drag the element back onto the canvas.+const MIN_VISIBLE_FRAC = 0.1;++function clampRect(+ r: { x: number; y: number; width: number; height: number },+ boundsW: number,+ boundsH: number,+ allowOverflow = false,+) {+ if (allowOverflow) {+ const width = r.width;+ const height = r.height;+ const minVisX = Math.max(8, width * MIN_VISIBLE_FRAC);+ const minVisY = Math.max(8, height * MIN_VISIBLE_FRAC);+ const x = Math.max(-(width - minVisX), Math.min(r.x, boundsW - minVisX));+ const y = Math.max(-(height - minVisY), Math.min(r.y, boundsH - minVisY));+ return { x, y, width, height };+ }+ const width = Math.min(r.width, boundsW);+ const height = Math.min(r.height, boundsH);+ const x = Math.max(0, Math.min(r.x, boundsW - width));+ const y = Math.max(0, Math.min(r.y, boundsH - height));+ return { x, y, width, height };+}++function Movable({+ rect,+ boundsW,+ boundsH,+ editable,+ previewScale,+ onChange,+ children,+ lockAspectRatio,+ zIndex,+ rotation = 0,+ allowOverflow = false,+ selected = false,+ onSelect,+}: {+ rect: Rect;+ boundsW: number;+ boundsH: number;+ editable?: boolean;+ previewScale: number;+ onChange: (t: ElementTransform) => void;+ children: React.ReactNode;+ lockAspectRatio?: number | boolean;+ zIndex?: number;+ rotation?: number;+ allowOverflow?: boolean;+ selected?: boolean;+ onSelect?: () => void;+}) {+ const rotationRef = React.useRef(rotation);+ React.useEffect(() => {+ rotationRef.current = rotation;+ }, [rotation]);++ function startRotate(e: React.PointerEvent<HTMLButtonElement>) {+ e.preventDefault();+ e.stopPropagation();+ onSelect?.();++ const root = e.currentTarget.closest(".rnd-editable") as HTMLElement | null;+ if (!root) return;+ const box = root.getBoundingClientRect();+ const centerX = box.left + box.width / 2;+ const centerY = box.top + box.height / 2;+ const startAngle = pointerAngle(e.clientX, e.clientY, centerX, centerY);+ const startRotation = rotationRef.current;++ const handleMove = (event: PointerEvent) => {+ event.preventDefault();+ const nextRotation = normalizeRotation(+ startRotation + pointerAngle(event.clientX, event.clientY, centerX, centerY) - startAngle,+ );+ rotationRef.current = nextRotation;+ onChange({+ x: display.x,+ y: display.y,+ width: display.width,+ height: display.height,+ rotation: nextRotation,+ zIndex,+ });+ };+ const stopRotate = () => {+ window.removeEventListener("pointermove", handleMove);+ window.removeEventListener("pointerup", stopRotate);+ window.removeEventListener("pointercancel", stopRotate);+ };++ window.addEventListener("pointermove", handleMove, { passive: false });+ window.addEventListener("pointerup", stopRotate, { once: true });+ window.addEventListener("pointercancel", stopRotate, { once: true });+ }++ // Rotation lives on the inner wrapper so the Rnd's axis-aligned rect remains+ // the authoritative bounding box for drag/resize math. A bare mousedown+ // listener (no stopPropagation — that would prevent react-rnd from starting+ // a drag) marks the element as the current selection.+ const rotated = (+ <div+ onMouseDown={() => {+ if (editable) onSelect?.();+ }}+ style={{+ width: "100%",+ height: "100%",+ transform: rotation ? `rotate(${rotation}deg)` : undefined,+ transformOrigin: "center center",+ }}+ >+ {children}+ </div>+ );++ // The editor shows the clamped rect, so export and thumbnails must place the+ // element there too — an out-of-bounds saved rect would otherwise export+ // somewhere the user never saw it.+ const display = clampRect(rect, boundsW, boundsH, allowOverflow);++ // Non-editable (export/thumb) path: plain absolute-positioned div, no Rnd.+ if (!editable) {+ return (+ <div+ style={{+ position: "absolute",+ left: display.x,+ top: display.y,+ width: display.width,+ height: display.height,+ zIndex,+ }}+ >+ {rotated}+ </div>+ );+ }++ const controlScale = Math.max(0.05, previewScale);++ return (+ <Rnd+ bounds={allowOverflow ? undefined : "parent"}+ scale={previewScale}+ lockAspectRatio={lockAspectRatio}+ position={{ x: display.x, y: display.y }}+ size={{ width: display.width, height: display.height }}+ onDragStart={() => onSelect?.()}+ onResizeStart={() => onSelect?.()}+ onDragStop={(_e, d) => {+ const next = clampRect(+ { x: d.x, y: d.y, width: display.width, height: display.height },+ boundsW,+ boundsH,+ allowOverflow,+ );+ onChange({ ...next, rotation, zIndex });+ }}+ onResizeStop={(_e, _dir, ref, _delta, position) => {+ const next = clampRect(+ {+ x: position.x,+ y: position.y,+ width: parseFloat(ref.style.width),+ height: parseFloat(ref.style.height),+ },+ boundsW,+ boundsH,+ allowOverflow,+ );+ onChange({ ...next, rotation, zIndex });+ }}+ style={{ zIndex }}+ resizeHandleStyles={handleStyle}+ className={selected ? "rnd-editable rnd-selected" : "rnd-editable"}+ >+ {rotated}+ <button+ type="button"+ className="rnd-rotate-handle"+ style={{+ right: -14 / controlScale,+ top: -14 / controlScale,+ width: 28 / controlScale,+ height: 28 / controlScale,+ }}+ onPointerDown={startRotate}+ onFocus={() => onSelect?.()}+ title="Rotate"+ aria-label="Rotate element"+ >+ <RotateCw style={{ width: 14 / controlScale, height: 14 / controlScale }} />+ </button>+ </Rnd>+ );+}++function pointerAngle(x: number, y: number, centerX: number, centerY: number) {+ return (Math.atan2(y - centerY, x - centerX) * 180) / Math.PI;+}++function normalizeRotation(degrees: number) {+ let next = degrees;+ while (next > 180) next -= 360;+ while (next < -180) next += 360;+ return Math.round(next);+}++// Subtle resize handles (visible only on hover via globals.css).+const handleSize = 14;+const handleStyle: Record<string, React.CSSProperties> = {+ top: { height: handleSize },+ right: { width: handleSize },+ bottom: { height: handleSize },+ left: { width: handleSize },+ topRight: { width: handleSize, height: handleSize },+ bottomRight: { width: handleSize, height: handleSize },+ bottomLeft: { width: handleSize, height: handleSize },+ topLeft: { width: handleSize, height: handleSize },+};diff --git a/marketing/app-store-screenshots/src/components/editor/slide-thumb.tsx b/marketing/app-store-screenshots/src/components/editor/slide-thumb.tsxnew file mode 100644index 00000000..c47f621e--- /dev/null+++ b/marketing/app-store-screenshots/src/components/editor/slide-thumb.tsx@@ -0,0 +1,184 @@+"use client";+import * as React from "react";+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 { pickText } from "@/lib/locale";+import type { Device, Orientation, Slide, Theme } from "@/lib/types";+import { cn } from "@/lib/utils";+import { DeckCanvas, SlideCanvas, getCanvas } from "./slide-canvas";++type Props = {+ slide: Slide;+ slides: Slide[];+ index: number;+ active: boolean;+ device: Device;+ orientation: Orientation;+ theme: Theme;+ locale: string;+ appName?: string;+ appIcon?: string;+ fontFamily?: string;+ connectedCanvas: boolean;+ onSelect: () => void;+ onDelete: () => void;+ onDuplicate: () => void;+};++// Thumb tile target width (pixels). Height is derived from device aspect.+const THUMB_W = 60;++export function SlideThumb({+ slide,+ slides,+ index,+ active,+ device,+ orientation,+ theme,+ locale,+ appName,+ appIcon,+ fontFamily,+ connectedCanvas,+ onSelect,+ onDelete,+ onDuplicate,+}: Props) {+ const headline = pickText(slide.headline, locale);+ const label = pickText(slide.label, locale);+ const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({+ id: slide.id,+ });++ const { cW, cH } = getCanvas(device, orientation);+ const aspect = cW / cH;+ const tileH = Math.max(34, Math.min(120, Math.round(THUMB_W / aspect)));+ const scale = THUMB_W / cW;+ const start = connectedCanvas ? Math.max(0, index - 1) : index;+ const visibleSlides = connectedCanvas ? slides.slice(start, Math.min(slides.length, index + 2)) : [slide];+ const localIndex = index - start;++ const style: React.CSSProperties = {+ transform: CSS.Transform.toString(transform),+ transition,+ opacity: isDragging ? 0.5 : 1,+ };++ return (+ <div+ ref={setNodeRef}+ style={style}+ className={cn(+ "group relative flex items-stretch gap-2 rounded-lg border bg-card p-1.5 transition-all hover:border-foreground/30 hover:bg-accent",+ active && "border-primary ring-1 ring-primary",+ )}+ >+ <button+ type="button"+ className="flex w-3 cursor-grab items-center justify-center text-muted-foreground/60 hover:text-foreground focus-visible:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring active:cursor-grabbing"+ {...attributes}+ {...listeners}+ aria-label={`Reorder screen ${index + 1} (press space, then arrow keys)`}+ >+ <GripVertical className="h-4 w-4" />+ </button>++ <button+ type="button"+ onClick={onSelect}+ className="flex flex-1 items-center gap-3 overflow-hidden text-left"+ >+ <div+ aria-hidden+ className="relative shrink-0 overflow-hidden rounded border bg-muted"+ style={{ width: THUMB_W, height: tileH }}+ >+ <div+ style={{+ width: cW * visibleSlides.length,+ height: cH,+ position: "absolute",+ top: 0,+ left: -localIndex * cW * scale,+ transformOrigin: "top left",+ transform: `scale(${scale})`,+ pointerEvents: "none",+ }}+ >+ {connectedCanvas ? (+ <DeckCanvas+ slides={visibleSlides}+ device={device}+ orientation={orientation}+ theme={theme}+ locale={locale}+ appName={appName}+ appIcon={appIcon}+ fontFamily={fontFamily}+ connectedCanvas+ editable={false}+ />+ ) : (+ <SlideCanvas+ slide={slide}+ device={device}+ orientation={orientation}+ theme={theme}+ locale={locale}+ appName={appName}+ appIcon={appIcon}+ fontFamily={fontFamily}+ editable={false}+ />+ )}+ </div>+ </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]}`}+ </span>+ <span className="truncate text-sm font-medium leading-tight">+ {headline.split("\n")[0] || (+ <em className="font-normal text-muted-foreground">Untitled</em>+ )}+ </span>+ {label ? (+ <span className="truncate text-[10px] uppercase tracking-wide text-muted-foreground">+ {label}+ </span>+ ) : null}+ </div>+ </button>++ {/* Keep actions discoverable on touch tablets as well as phones. */}+ <div className="flex flex-col items-center justify-center gap-0.5 opacity-60 transition-opacity focus-within:opacity-100 group-hover:opacity-100">+ <Button+ type="button"+ size="icon"+ variant="ghost"+ className="h-6 w-6"+ onClick={onDuplicate}+ aria-label={`Duplicate screen ${index + 1}`}+ title="Duplicate screen"+ >+ <Copy className="h-3.5 w-3.5" />+ </Button>+ <Button+ type="button"+ size="icon"+ variant="ghost"+ className="h-6 w-6 hover:text-destructive"+ onClick={onDelete}+ aria-label={`Delete screen ${index + 1}`}+ title="Delete screen (undoable)"+ >+ <Trash2 className="h-3.5 w-3.5" />+ </Button>+ </div>+ </div>+ );+}diff --git a/marketing/app-store-screenshots/src/components/editor/toolbar.tsx b/marketing/app-store-screenshots/src/components/editor/toolbar.tsxnew file mode 100644index 00000000..74edfd18--- /dev/null+++ b/marketing/app-store-screenshots/src/components/editor/toolbar.tsx@@ -0,0 +1,397 @@+"use client";+import * as React from "react";+import { AlertTriangle, Check, Cloud, Download, Redo2, RotateCcw, Undo2, UnfoldHorizontal, Upload } from "lucide-react";+import { Button } from "@/components/ui/button";+import {+ Dialog,+ DialogContent,+ DialogDescription,+ DialogHeader,+ DialogTitle,+} from "@/components/ui/dialog";+import { Input } from "@/components/ui/input";+import {+ Select,+ SelectContent,+ SelectItem,+ SelectSeparator,+ SelectTrigger,+ SelectValue,+} from "@/components/ui/select";+import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";+import {+ DEVICE_LABEL,+ IMPORTED_FONT_FAMILY,+ PLATFORM_DEVICES,+ SCREENSHOT_FONTS,+ THEMES,+ supportsLandscape,+ themeById,+} from "@/lib/constants";+import { detectPlatform } from "@/lib/defaults";+import type { Device, ImportedFont, Orientation, Platform, ScreenshotFontId, Theme } from "@/lib/types";+import { FontImporter, type FontImporterHandle } from "./font-importer";++const IMPORT_FONT_ACTION = "__import-font__";++type Props = {+ appName: string;+ setAppName: (v: string) => void;+ themeId: string;+ setThemeId: (v: string) => void;+ connectedCanvas: boolean;+ setConnectedCanvas: (v: boolean) => void;+ fontId: ScreenshotFontId;+ setFontId: (v: ScreenshotFontId) => void;+ importedFont?: ImportedFont;+ setImportedFont: (font: ImportedFont) => void;+ locale: string;+ setLocale: (v: string) => void;+ locales: string[];+ device: Device;+ setDevice: (v: Device) => void;+ orientation: Orientation;+ setOrientation: (v: Orientation) => void;+ onExport: () => void;+ onResetAll: () => void;+ onResetDevice: () => void;+ onUndo: () => void;+ onRedo: () => void;+ canUndo: boolean;+ canRedo: boolean;+ exporting: string | null;+ savedAt: number | null;+ saveError: string | null;+ onRetrySave?: () => void;+ busy: boolean;+};++export function Toolbar(props: Props) {+ const platform = detectPlatform(props.device);+ const hasLandscape = supportsLandscape(props.device);+ const [resetOpen, setResetOpen] = React.useState(false);++ // Track last device per platform so the platform tabs preserve the user's choice.+ const lastByPlatform = React.useRef<Record<Platform, Device>>({+ ios: platform === "ios" ? props.device : "iphone",+ macos: platform === "macos" ? props.device : "mac",+ android: platform === "android" ? props.device : "android",+ });+ React.useEffect(() => {+ lastByPlatform.current[platform] = props.device;+ }, [platform, props.device]);++ const showLocale = props.locales.length > 1;++ const deviceLabel = DEVICE_LABEL[props.device];+ const platformDevices = PLATFORM_DEVICES[platform];+ const activeTheme = themeById(props.themeId);++ const fontImporter = React.useRef<FontImporterHandle>(null);+ const [importingFont, setImportingFont] = React.useState(false);+ // "Imported font" is only a choice once a file has actually been imported.+ const fontIds = (Object.keys(SCREENSHOT_FONTS) as ScreenshotFontId[]).filter(+ (id) => id !== "self-hosted" || !!props.importedFont,+ );+ const fontLabel = (id: ScreenshotFontId) =>+ id === "self-hosted" && props.importedFont?.name ? props.importedFont.name : SCREENSHOT_FONTS[id].name;+ const fontPreviewFamily = (id: ScreenshotFontId) =>+ id === "self-hosted" ? `"${IMPORTED_FONT_FAMILY}", sans-serif` : SCREENSHOT_FONTS[id].family;++ return (+ <div className="flex flex-wrap items-center gap-x-2 gap-y-1.5 border-b bg-card/40 px-4 py-2">+ <Input+ value={props.appName}+ onChange={(e) => props.setAppName(e.target.value)}+ className="h-8 w-36 border-dashed text-sm font-semibold focus-visible:border-input focus-visible:border-solid focus-visible:bg-background"+ placeholder="App name"+ aria-label="App name"+ title="App name (click to edit)"+ disabled={props.busy}+ />++ <span aria-hidden className="mx-1 h-5 w-px bg-border" />++ <Button+ type="button"+ variant={props.connectedCanvas ? "secondary" : "outline"}+ size="sm"+ className="h-8 gap-1.5 px-2 text-xs"+ onClick={() => props.setConnectedCanvas(!props.connectedCanvas)}+ aria-pressed={props.connectedCanvas}+ title={+ props.connectedCanvas+ ? "Connected canvas enabled"+ : "Isolated screens; turn on to let elements cross screen edges"+ }+ disabled={props.busy}+ >+ <UnfoldHorizontal className="h-3.5 w-3.5" />+ {props.connectedCanvas ? "Connected" : "Isolated"}+ </Button>++ <Select value={activeTheme.id} onValueChange={props.setThemeId} disabled={props.busy}>+ <SelectTrigger className="h-8 w-40 text-xs" title="Theme" aria-label="Theme">+ <SelectValue>+ <ThemeOption theme={activeTheme} />+ </SelectValue>+ </SelectTrigger>+ <SelectContent>+ {Object.values(THEMES).map((theme) => (+ <SelectItem key={theme.id} value={theme.id}>+ <ThemeOption theme={theme} />+ </SelectItem>+ ))}+ </SelectContent>+ </Select>++ <Select+ value={props.fontId}+ onValueChange={(fontId) => {+ if (fontId === IMPORT_FONT_ACTION) fontImporter.current?.open();+ else props.setFontId(fontId as ScreenshotFontId);+ }}+ disabled={props.busy || importingFont}+ >+ <SelectTrigger className="h-8 w-36 text-xs" title="Screenshot font" aria-label="Screenshot font">+ <SelectValue placeholder="Font">+ <span className="truncate">{importingFont ? "Importing font…" : fontLabel(props.fontId)}</span>+ </SelectValue>+ </SelectTrigger>+ <SelectContent>+ {fontIds.map((id) => (+ <SelectItem key={id} value={id}>+ <span style={{ fontFamily: fontPreviewFamily(id) }}>{fontLabel(id)}</span>+ </SelectItem>+ ))}+ <SelectSeparator />+ <SelectItem value={IMPORT_FONT_ACTION}>+ <span className="flex items-center gap-1.5">+ <Upload className="h-3.5 w-3.5" />+ {props.importedFont ? "Replace imported font…" : "Import font…"}+ </span>+ </SelectItem>+ </SelectContent>+ </Select>+ <FontImporter ref={fontImporter} onImported={props.setImportedFont} onUploadingChange={setImportingFont} />++ <span aria-hidden className="mx-1 h-5 w-px bg-border" />++ <Tabs+ value={platform}+ onValueChange={(p) => {+ if (props.busy) return;+ const next = lastByPlatform.current[p as Platform];+ props.setDevice(next);+ }}+ >+ <TabsList className="h-8 p-0.5">+ <TabsTrigger value="ios" className="h-7 px-3 text-xs" disabled={props.busy}>+ iOS+ </TabsTrigger>+ <TabsTrigger value="macos" className="h-7 px-3 text-xs" disabled={props.busy}>+ Mac+ </TabsTrigger>+ <TabsTrigger value="android" className="h-7 px-3 text-xs" disabled={props.busy}>+ Android+ </TabsTrigger>+ </TabsList>+ </Tabs>++ {/* 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)}+ disabled={props.busy}+ >+ <SelectTrigger className="h-8 w-36 text-xs" aria-label="Device" title="Device">+ <SelectValue placeholder="Device">{deviceLabel}</SelectValue>+ </SelectTrigger>+ <SelectContent>+ {platformDevices.map((d) => (+ <SelectItem key={d} value={d}>{DEVICE_LABEL[d]}</SelectItem>+ ))}+ </SelectContent>+ </Select>+ )}++ {hasLandscape && (+ <Select+ value={props.orientation}+ onValueChange={(v) => props.setOrientation(v as Orientation)}+ disabled={props.busy}+ >+ <SelectTrigger className="h-8 w-28 text-xs" aria-label="Orientation">+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ <SelectItem value="portrait">Portrait</SelectItem>+ <SelectItem value="landscape">Landscape</SelectItem>+ </SelectContent>+ </Select>+ )}++ {showLocale && (+ <Select value={props.locale} onValueChange={props.setLocale} disabled={props.busy}>+ <SelectTrigger className="h-8 w-20 text-xs" aria-label="Locale">+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ {props.locales.map((l) => (+ <SelectItem key={l} value={l}>+ {l.toUpperCase()}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ )}++ <div className="ml-auto flex shrink-0 items-center gap-2">+ <SaveStatus savedAt={props.savedAt} saveError={props.saveError} />+ {props.saveError && props.onRetrySave && (+ <Button variant="ghost" size="sm" disabled={props.busy} onClick={props.onRetrySave}>Retry save</Button>+ )}+ <span aria-hidden className="h-5 w-px bg-border" />+ <Button+ type="button"+ variant="ghost"+ size="icon"+ className="h-8 w-8"+ onClick={props.onUndo}+ title="Undo (⌘Z)"+ aria-label="Undo"+ disabled={props.busy || !props.canUndo}+ >+ <Undo2 className="h-4 w-4" />+ </Button>+ <Button+ type="button"+ variant="ghost"+ size="icon"+ className="h-8 w-8"+ onClick={props.onRedo}+ title="Redo (⌘⇧Z)"+ aria-label="Redo"+ disabled={props.busy || !props.canRedo}+ >+ <Redo2 className="h-4 w-4" />+ </Button>+ <Button+ variant="ghost"+ size="icon"+ className="h-8 w-8"+ onClick={() => setResetOpen(true)}+ title="Reset screens to defaults"+ aria-label="Reset"+ disabled={props.busy}+ >+ <RotateCcw className="h-4 w-4" />+ </Button>+ <Button+ onClick={props.onExport}+ disabled={!!props.exporting || importingFont}+ size="sm"+ className="h-8"+ title="Export every size × locale for this device as a zip"+ >+ <Download className="h-4 w-4" />+ {props.exporting ? `Exporting ${props.exporting}` : "Export bundle"}+ </Button>+ </div>++ <Dialog open={resetOpen} onOpenChange={setResetOpen}>+ <DialogContent className="max-w-md">+ <DialogHeader>+ <DialogTitle>Reset to defaults?</DialogTitle>+ <DialogDescription>+ Choose whether to reset just <span className="font-medium">{deviceLabel}</span> or every device deck. Your canvas edits, uploaded screenshots, and copy will be lost.+ </DialogDescription>+ </DialogHeader>+ <div className="flex flex-wrap justify-end gap-2">+ <Button variant="ghost" size="sm" onClick={() => setResetOpen(false)}>+ Cancel+ </Button>+ <Button+ variant="outline"+ size="sm"+ onClick={() => {+ setResetOpen(false);+ props.onResetDevice();+ }}+ >+ Reset {deviceLabel} only+ </Button>+ <Button+ variant="destructive"+ size="sm"+ onClick={() => {+ setResetOpen(false);+ props.onResetAll();+ }}+ >+ Reset all devices+ </Button>+ </div>+ </DialogContent>+ </Dialog>+ </div>+ );+}++function ThemeOption({ theme }: { theme: Theme }) {+ return (+ <span className="flex min-w-0 items-center gap-2">+ <span+ aria-hidden+ className="flex h-4 w-7 shrink-0 overflow-hidden rounded-sm ring-1 ring-black/10"+ >+ <span className="flex-1" style={{ background: theme.bg }} />+ <span className="flex-1" style={{ background: theme.bgAlt }} />+ <span className="w-1.5" style={{ background: theme.accent }} />+ </span>+ <span className="truncate">{theme.name}</span>+ </span>+ );+}++function SaveStatus({ savedAt, saveError }: { savedAt: number | null; saveError: string | null }) {+ const [, setTick] = React.useState(0);+ React.useEffect(() => {+ const t = setInterval(() => setTick((x) => x + 1), 60_000);+ return () => clearInterval(t);+ }, []);++ if (saveError) {+ return (+ <span+ className="flex items-center gap-1 text-xs text-destructive"+ title={saveError}+ >+ <AlertTriangle className="h-3.5 w-3.5" /> save failed+ </span>+ );+ }++ if (!savedAt) {+ return (+ <span className="flex items-center gap-1 text-xs text-muted-foreground" title="Not saved yet">+ <Cloud className="h-3.5 w-3.5" /> <span className="hidden 2xl:inline">not saved yet</span>+ </span>+ );+ }+ const seconds = Math.max(0, Math.round((Date.now() - savedAt) / 1000));+ const label =+ seconds < 5+ ? "saved"+ : seconds < 60+ ? `saved ${seconds}s ago`+ : seconds < 3600+ ? `saved ${Math.round(seconds / 60)}m ago`+ : `saved ${Math.round(seconds / 3600)}h ago`;+ return (+ <span className="flex items-center gap-1 text-xs text-muted-foreground" title={`Project ${label}`}>+ <Check className="h-3.5 w-3.5 text-green-500" /> <span className="hidden 2xl:inline">{label}</span>+ </span>+ );+}diff --git a/marketing/app-store-screenshots/src/components/ui/button.tsx b/marketing/app-store-screenshots/src/components/ui/button.tsxnew file mode 100644index 00000000..e928171d--- /dev/null+++ b/marketing/app-store-screenshots/src/components/ui/button.tsx@@ -0,0 +1,43 @@+import * as React from "react";+import { Slot } from "@radix-ui/react-slot";+import { cva, type VariantProps } from "class-variance-authority";+import { cn } from "@/lib/utils";++const buttonVariants = cva(+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",+ {+ variants: {+ variant: {+ default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",+ destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",+ outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",+ secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",+ ghost: "hover:bg-accent hover:text-accent-foreground",+ link: "text-primary underline-offset-4 hover:underline",+ },+ size: {+ default: "h-9 px-4 py-2",+ sm: "h-8 rounded-md px-3 text-xs",+ lg: "h-10 rounded-md px-8",+ icon: "h-9 w-9",+ },+ },+ defaultVariants: { variant: "default", size: "default" },+ },+);++export interface ButtonProps+ extends React.ButtonHTMLAttributes<HTMLButtonElement>,+ VariantProps<typeof buttonVariants> {+ asChild?: boolean;+}++const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(+ ({ className, variant, size, asChild = false, ...props }, ref) => {+ const Comp = asChild ? Slot : "button";+ return <Comp className={cn(buttonVariants({ variant, size, className }))} ref={ref} {...props} />;+ },+);+Button.displayName = "Button";++export { Button, buttonVariants };diff --git a/marketing/app-store-screenshots/src/components/ui/card.tsx b/marketing/app-store-screenshots/src/components/ui/card.tsxnew file mode 100644index 00000000..5dbc4d0c--- /dev/null+++ b/marketing/app-store-screenshots/src/components/ui/card.tsx@@ -0,0 +1,30 @@+import * as React from "react";+import { cn } from "@/lib/utils";++const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(+ ({ className, ...props }, ref) => (+ <div ref={ref} className={cn("rounded-xl border bg-card text-card-foreground shadow", className)} {...props} />+ ),+);+Card.displayName = "Card";++const CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(+ ({ className, ...props }, ref) => (+ <div ref={ref} className={cn("flex flex-col space-y-1.5 p-6", className)} {...props} />+ ),+);+CardHeader.displayName = "CardHeader";++const CardTitle = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(+ ({ className, ...props }, ref) => (+ <div ref={ref} className={cn("font-semibold leading-none tracking-tight", className)} {...props} />+ ),+);+CardTitle.displayName = "CardTitle";++const CardContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(+ ({ className, ...props }, ref) => <div ref={ref} className={cn("p-6 pt-0", className)} {...props} />,+);+CardContent.displayName = "CardContent";++export { Card, CardHeader, CardTitle, CardContent };diff --git a/marketing/app-store-screenshots/src/components/ui/dialog.tsx b/marketing/app-store-screenshots/src/components/ui/dialog.tsxnew file mode 100644index 00000000..b0f9b899--- /dev/null+++ b/marketing/app-store-screenshots/src/components/ui/dialog.tsx@@ -0,0 +1,82 @@+"use client";+import * as React from "react";+import * as DialogPrimitive from "@radix-ui/react-dialog";+import { X } from "lucide-react";+import { cn } from "@/lib/utils";++const Dialog = DialogPrimitive.Root;+const DialogTrigger = DialogPrimitive.Trigger;+const DialogPortal = DialogPrimitive.Portal;+const DialogClose = DialogPrimitive.Close;++const DialogOverlay = React.forwardRef<+ React.ElementRef<typeof DialogPrimitive.Overlay>,+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>+>(({ className, ...props }, ref) => (+ <DialogPrimitive.Overlay+ ref={ref}+ className={cn(+ "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",+ className,+ )}+ {...props}+ />+));+DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;++const DialogContent = React.forwardRef<+ React.ElementRef<typeof DialogPrimitive.Content>,+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>+>(({ className, children, ...props }, ref) => (+ <DialogPortal>+ <DialogOverlay />+ <DialogPrimitive.Content+ ref={ref}+ className={cn(+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 sm:rounded-lg",+ className,+ )}+ {...props}+ >+ {children}+ <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none">+ <X className="h-4 w-4" />+ <span className="sr-only">Close</span>+ </DialogPrimitive.Close>+ </DialogPrimitive.Content>+ </DialogPortal>+));+DialogContent.displayName = DialogPrimitive.Content.displayName;++const DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (+ <div className={cn("flex flex-col space-y-1.5 text-center sm:text-left", className)} {...props} />+);+DialogHeader.displayName = "DialogHeader";++const DialogTitle = React.forwardRef<+ React.ElementRef<typeof DialogPrimitive.Title>,+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>+>(({ className, ...props }, ref) => (+ <DialogPrimitive.Title ref={ref} className={cn("text-lg font-semibold leading-none tracking-tight", className)} {...props} />+));+DialogTitle.displayName = DialogPrimitive.Title.displayName;++const DialogDescription = React.forwardRef<+ React.ElementRef<typeof DialogPrimitive.Description>,+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>+>(({ className, ...props }, ref) => (+ <DialogPrimitive.Description ref={ref} className={cn("text-sm text-muted-foreground", className)} {...props} />+));+DialogDescription.displayName = DialogPrimitive.Description.displayName;++export {+ Dialog,+ DialogPortal,+ DialogOverlay,+ DialogClose,+ DialogTrigger,+ DialogContent,+ DialogHeader,+ DialogTitle,+ DialogDescription,+};diff --git a/marketing/app-store-screenshots/src/components/ui/dropdown-menu.tsx b/marketing/app-store-screenshots/src/components/ui/dropdown-menu.tsxnew file mode 100644index 00000000..edf0c9ef--- /dev/null+++ b/marketing/app-store-screenshots/src/components/ui/dropdown-menu.tsx@@ -0,0 +1,98 @@+"use client";+import * as React from "react";+import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";+import { Check } from "lucide-react";+import { cn } from "@/lib/utils";++const DropdownMenu = DropdownMenuPrimitive.Root;+const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;+const DropdownMenuGroup = DropdownMenuPrimitive.Group;+const DropdownMenuPortal = DropdownMenuPrimitive.Portal;++const DropdownMenuContent = React.forwardRef<+ React.ElementRef<typeof DropdownMenuPrimitive.Content>,+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>+>(({ className, sideOffset = 4, ...props }, ref) => (+ <DropdownMenuPrimitive.Portal>+ <DropdownMenuPrimitive.Content+ ref={ref}+ sideOffset={sideOffset}+ className={cn(+ "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",+ className,+ )}+ {...props}+ />+ </DropdownMenuPrimitive.Portal>+));+DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;++const DropdownMenuItem = React.forwardRef<+ React.ElementRef<typeof DropdownMenuPrimitive.Item>,+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item>+>(({ className, ...props }, ref) => (+ <DropdownMenuPrimitive.Item+ ref={ref}+ className={cn(+ "relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",+ className,+ )}+ {...props}+ />+));+DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;++const DropdownMenuCheckboxItem = React.forwardRef<+ React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>+>(({ className, children, checked, ...props }, ref) => (+ <DropdownMenuPrimitive.CheckboxItem+ ref={ref}+ className={cn(+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground",+ className,+ )}+ checked={checked}+ {...props}+ >+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">+ <DropdownMenuPrimitive.ItemIndicator>+ <Check className="h-4 w-4" />+ </DropdownMenuPrimitive.ItemIndicator>+ </span>+ {children}+ </DropdownMenuPrimitive.CheckboxItem>+));+DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;++const DropdownMenuSeparator = React.forwardRef<+ React.ElementRef<typeof DropdownMenuPrimitive.Separator>,+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>+>(({ className, ...props }, ref) => (+ <DropdownMenuPrimitive.Separator ref={ref} className={cn("-mx-1 my-1 h-px bg-muted", className)} {...props} />+));+DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;++const DropdownMenuLabel = React.forwardRef<+ React.ElementRef<typeof DropdownMenuPrimitive.Label>,+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label>+>(({ className, ...props }, ref) => (+ <DropdownMenuPrimitive.Label+ ref={ref}+ className={cn("px-2 py-1.5 text-sm font-semibold", className)}+ {...props}+ />+));+DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;++export {+ DropdownMenu,+ DropdownMenuTrigger,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuCheckboxItem,+ DropdownMenuSeparator,+ DropdownMenuLabel,+ DropdownMenuGroup,+ DropdownMenuPortal,+};diff --git a/marketing/app-store-screenshots/src/components/ui/input.tsx b/marketing/app-store-screenshots/src/components/ui/input.tsxnew file mode 100644index 00000000..14abe6bb--- /dev/null+++ b/marketing/app-store-screenshots/src/components/ui/input.tsx@@ -0,0 +1,19 @@+import * as React from "react";+import { cn } from "@/lib/utils";++const Input = React.forwardRef<HTMLInputElement, React.InputHTMLAttributes<HTMLInputElement>>(+ ({ className, type, ...props }, ref) => (+ <input+ type={type}+ className={cn(+ "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",+ className,+ )}+ ref={ref}+ {...props}+ />+ ),+);+Input.displayName = "Input";++export { Input };diff --git a/marketing/app-store-screenshots/src/components/ui/label.tsx b/marketing/app-store-screenshots/src/components/ui/label.tsxnew file mode 100644index 00000000..a1217fa5--- /dev/null+++ b/marketing/app-store-screenshots/src/components/ui/label.tsx@@ -0,0 +1,19 @@+"use client";+import * as React from "react";+import * as LabelPrimitive from "@radix-ui/react-label";+import { cva, type VariantProps } from "class-variance-authority";+import { cn } from "@/lib/utils";++const labelVariants = cva(+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",+);++const Label = React.forwardRef<+ React.ElementRef<typeof LabelPrimitive.Root>,+ React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> & VariantProps<typeof labelVariants>+>(({ className, ...props }, ref) => (+ <LabelPrimitive.Root ref={ref} className={cn(labelVariants(), className)} {...props} />+));+Label.displayName = LabelPrimitive.Root.displayName;++export { Label };diff --git a/marketing/app-store-screenshots/src/components/ui/select.tsx b/marketing/app-store-screenshots/src/components/ui/select.tsxnew file mode 100644index 00000000..180208e6--- /dev/null+++ b/marketing/app-store-screenshots/src/components/ui/select.tsx@@ -0,0 +1,91 @@+"use client";+import * as React from "react";+import * as SelectPrimitive from "@radix-ui/react-select";+import { Check, ChevronDown } from "lucide-react";+import { cn } from "@/lib/utils";++const Select = SelectPrimitive.Root;+const SelectGroup = SelectPrimitive.Group;+const SelectValue = SelectPrimitive.Value;++const SelectTrigger = React.forwardRef<+ React.ElementRef<typeof SelectPrimitive.Trigger>,+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>+>(({ className, children, ...props }, ref) => (+ <SelectPrimitive.Trigger+ ref={ref}+ className={cn(+ "flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",+ className,+ )}+ {...props}+ >+ {children}+ <SelectPrimitive.Icon asChild>+ <ChevronDown className="h-4 w-4 opacity-50" />+ </SelectPrimitive.Icon>+ </SelectPrimitive.Trigger>+));+SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;++const SelectContent = React.forwardRef<+ React.ElementRef<typeof SelectPrimitive.Content>,+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>+>(({ className, children, position = "popper", ...props }, ref) => (+ <SelectPrimitive.Portal>+ <SelectPrimitive.Content+ ref={ref}+ className={cn(+ "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",+ position === "popper" &&+ "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",+ className,+ )}+ position={position}+ {...props}+ >+ <SelectPrimitive.Viewport+ className={cn(+ "p-1",+ position === "popper" &&+ "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]",+ )}+ >+ {children}+ </SelectPrimitive.Viewport>+ </SelectPrimitive.Content>+ </SelectPrimitive.Portal>+));+SelectContent.displayName = SelectPrimitive.Content.displayName;++const SelectItem = React.forwardRef<+ React.ElementRef<typeof SelectPrimitive.Item>,+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>+>(({ className, children, ...props }, ref) => (+ <SelectPrimitive.Item+ ref={ref}+ className={cn(+ "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",+ className,+ )}+ {...props}+ >+ <span className="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">+ <SelectPrimitive.ItemIndicator>+ <Check className="h-4 w-4" />+ </SelectPrimitive.ItemIndicator>+ </span>+ <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>+ </SelectPrimitive.Item>+));+SelectItem.displayName = SelectPrimitive.Item.displayName;++const SelectSeparator = React.forwardRef<+ React.ElementRef<typeof SelectPrimitive.Separator>,+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>+>(({ className, ...props }, ref) => (+ <SelectPrimitive.Separator ref={ref} className={cn("-mx-1 my-1 h-px bg-muted", className)} {...props} />+));+SelectSeparator.displayName = SelectPrimitive.Separator.displayName;++export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectItem, SelectSeparator };diff --git a/marketing/app-store-screenshots/src/components/ui/tabs.tsx b/marketing/app-store-screenshots/src/components/ui/tabs.tsxnew file mode 100644index 00000000..c7141104--- /dev/null+++ b/marketing/app-store-screenshots/src/components/ui/tabs.tsx@@ -0,0 +1,53 @@+"use client";+import * as React from "react";+import * as TabsPrimitive from "@radix-ui/react-tabs";+import { cn } from "@/lib/utils";++const Tabs = TabsPrimitive.Root;++const TabsList = React.forwardRef<+ React.ElementRef<typeof TabsPrimitive.List>,+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>+>(({ className, ...props }, ref) => (+ <TabsPrimitive.List+ ref={ref}+ className={cn(+ "inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",+ className,+ )}+ {...props}+ />+));+TabsList.displayName = TabsPrimitive.List.displayName;++const TabsTrigger = React.forwardRef<+ React.ElementRef<typeof TabsPrimitive.Trigger>,+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>+>(({ className, ...props }, ref) => (+ <TabsPrimitive.Trigger+ ref={ref}+ className={cn(+ "inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",+ className,+ )}+ {...props}+ />+));+TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;++const TabsContent = React.forwardRef<+ React.ElementRef<typeof TabsPrimitive.Content>,+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>+>(({ className, ...props }, ref) => (+ <TabsPrimitive.Content+ ref={ref}+ className={cn(+ "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",+ className,+ )}+ {...props}+ />+));+TabsContent.displayName = TabsPrimitive.Content.displayName;++export { Tabs, TabsList, TabsTrigger, TabsContent };diff --git a/marketing/app-store-screenshots/src/components/ui/textarea.tsx b/marketing/app-store-screenshots/src/components/ui/textarea.tsxnew file mode 100644index 00000000..2b1b9005--- /dev/null+++ b/marketing/app-store-screenshots/src/components/ui/textarea.tsx@@ -0,0 +1,18 @@+import * as React from "react";+import { cn } from "@/lib/utils";++const Textarea = React.forwardRef<HTMLTextAreaElement, React.TextareaHTMLAttributes<HTMLTextAreaElement>>(+ ({ className, ...props }, ref) => (+ <textarea+ ref={ref}+ className={cn(+ "flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",+ className,+ )}+ {...props}+ />+ ),+);+Textarea.displayName = "Textarea";++export { Textarea };diff --git a/marketing/app-store-screenshots/src/components/ui/tooltip.tsx b/marketing/app-store-screenshots/src/components/ui/tooltip.tsxnew file mode 100644index 00000000..7099e9d7--- /dev/null+++ b/marketing/app-store-screenshots/src/components/ui/tooltip.tsx@@ -0,0 +1,26 @@+"use client";+import * as React from "react";+import * as TooltipPrimitive from "@radix-ui/react-tooltip";+import { cn } from "@/lib/utils";++const TooltipProvider = TooltipPrimitive.Provider;+const Tooltip = TooltipPrimitive.Root;+const TooltipTrigger = TooltipPrimitive.Trigger;++const TooltipContent = React.forwardRef<+ React.ElementRef<typeof TooltipPrimitive.Content>,+ React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>+>(({ className, sideOffset = 4, ...props }, ref) => (+ <TooltipPrimitive.Content+ ref={ref}+ sideOffset={sideOffset}+ className={cn(+ "z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95",+ className,+ )}+ {...props}+ />+));+TooltipContent.displayName = TooltipPrimitive.Content.displayName;++export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };diff --git a/marketing/app-store-screenshots/src/lib/clean-hex-color.ts b/marketing/app-store-screenshots/src/lib/clean-hex-color.tsnew file mode 100644index 00000000..41925542--- /dev/null+++ b/marketing/app-store-screenshots/src/lib/clean-hex-color.ts@@ -0,0 +1,5 @@+export function cleanHexColor(value: unknown): string | undefined {+ if (typeof value !== "string") return undefined;+ const color = value.trim();+ return /^#[0-9a-f]{6}$/i.test(color) ? color.toUpperCase() : undefined;+}diff --git a/marketing/app-store-screenshots/src/lib/clean-imported-font.ts b/marketing/app-store-screenshots/src/lib/clean-imported-font.tsnew file mode 100644index 00000000..85e14301--- /dev/null+++ b/marketing/app-store-screenshots/src/lib/clean-imported-font.ts@@ -0,0 +1,19 @@+import type { ImportedFont } from "./types";++const FORMATS = ["woff2", "woff", "truetype", "opentype"] as const;++// Display names come from the uploaded file name; keep them short and printable.+export function cleanFontName(value: unknown): string | undefined {+ if (typeof value !== "string") return undefined;+ const name = value.replace(/[\u0000-\u001f\u007f]/g, "").replace(/\s+/g, " ").trim().slice(0, 60);+ return name || undefined;+}++export function cleanImportedFont(value: unknown): ImportedFont | undefined {+ if (!value || typeof value !== "object") return undefined;+ const font = value as Partial<ImportedFont>;+ if (typeof font.src !== "string" || !/^\/fonts\/imported\/[a-z0-9]+\.(woff2|woff|ttf|otf)$/i.test(font.src)) return undefined;+ if (!FORMATS.includes(font.format as ImportedFont["format"])) return undefined;+ const name = cleanFontName(font.name);+ return { src: font.src, format: font.format as ImportedFont["format"], ...(name ? { name } : {}) };+}diff --git a/marketing/app-store-screenshots/src/lib/constants.ts b/marketing/app-store-screenshots/src/lib/constants.tsnew file mode 100644index 00000000..54a1aa2f--- /dev/null+++ b/marketing/app-store-screenshots/src/lib/constants.ts@@ -0,0 +1,510 @@+import type { Device, Orientation, Platform, ScreenshotFontId, SlideLayout, Theme, ThemeId } from "./types";++// ---------- Canvas dimensions (design at largest required resolution) ----------+export const CANVAS: Record<Device, { w: number; h: number; wL?: number; hL?: number }> = {+ iphone: { w: 1320, h: 2868 },+ ipad: { w: 2064, h: 2752 },+ // 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+ // smaller size is a downscale rather than an upscale.+ watchos: { w: 422, h: 514 },+ // CarPlay has NO App Store screenshot slot of its own - see EXPORT_SIZES below.+ // It is submitted in an iPhone slot, which accepts landscape, so the canvas is+ // the 6.9" iPhone size turned sideways to fit a wide head unit.+ carplay: { w: 2868, h: 1320 },+ // Mac App Store is landscape-only 16:10. Design at 2880x1800; every other Mac+ // slot is an exact 16:10 downscale.+ mac: { w: 2880, h: 1800 },+ android: { w: 1080, h: 1920 },+ "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 },+};++// ---------- Export sizes per device ----------+export type ExportSize = { label: string; w: number; h: number };++export const EXPORT_SIZES: Record<Device, ExportSize[]> = {+ iphone: [+ { label: '6.9"', w: 1320, h: 2868 },+ { label: '6.5"', w: 1284, h: 2778 },+ { label: '6.3"', w: 1206, h: 2622 },+ { label: '6.1"', w: 1125, h: 2436 },+ ],+ ipad: [+ { label: '13" iPad', w: 2064, h: 2752 },+ { label: '12.9" iPad Pro', w: 2048, h: 2732 },+ ],+ // App Store Connect display type APP_APPLE_TV. Verified 18 Aug 2026 via+ // `asc screenshots sizes --all`; these are the only accepted dimensions.+ tvos: [+ { label: "4K (3840 x 2160)", w: 3840, h: 2160 },+ { label: "HD (1920 x 1080)", w: 1920, h: 1080 },+ ],+ // Apple Watch display types, all verified the same way:+ // APP_WATCH_ULTRA 410x502 + 422x514 | SERIES_10 416x496+ // SERIES_7 396x484 | SERIES_4 368x448 | SERIES_3 312x390+ watchos: [+ { label: "Ultra (422 x 514)", w: 422, h: 514 },+ { label: "Ultra (410 x 502)", w: 410, h: 502 },+ { label: "Series 10 (416x496)", w: 416, h: 496 },+ { label: "Series 7 (396 x 484)", w: 396, h: 484 },+ { label: "Series 4 (368 x 448)", w: 368, h: 448 },+ { label: "Series 3 (312 x 390)", w: 312, h: 390 },+ ],+ // 🚨 CarPlay has NO display type in App Store Connect - confirmed against its own+ // metadata, not documentation: `asc screenshots sizes --all` lists APPLE_TV,+ // VISION_PRO, DESKTOP, IPAD*, IPHONE*, WATCH* and nothing for CarPlay. A CarPlay+ // app ships inside its iPhone app, so a CarPlay shot is submitted in an iPhone+ // slot. These are therefore the iPhone sizes on purpose, in landscape (every+ // iPhone slot accepts both orientations).+ carplay: [+ { label: '6.9" landscape', w: 2868, h: 1320 },+ { label: '6.5" landscape', w: 2778, h: 1284 },+ { label: '6.3" landscape', w: 2622, h: 1206 },+ { label: '6.1" landscape', w: 2436, h: 1125 },+ ],+ // App Store Connect display type APP_DESKTOP (Mac App Store). These four+ // 16:10 sizes are the only accepted dimensions.+ mac: [+ { label: "2880 x 1800", w: 2880, h: 1800 },+ { label: "2560 x 1600", w: 2560, h: 1600 },+ { label: "1440 x 900", w: 1440, h: 900 },+ { label: "1280 x 800", w: 1280, h: 800 },+ ],+ android: [{ label: "Phone", w: 1080, h: 1920 }],+ "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 }],+};++// Landscape sizes (tablets only)+export const EXPORT_SIZES_LANDSCAPE: Partial<Record<Device, ExportSize[]>> = {+ "android-7": [{ label: '7" Landscape', w: 1920, h: 1200 }],+ "android-10": [{ label: '10" Landscape', w: 2560, h: 1600 }],+};++export function supportsLandscape(device: Device): boolean {+ return device in EXPORT_SIZES_LANDSCAPE;+}++export function getExportSizes(device: Device, orientation: Orientation): ExportSize[] {+ if (orientation === "landscape") {+ return EXPORT_SIZES_LANDSCAPE[device] || EXPORT_SIZES[device];+ }+ return EXPORT_SIZES[device];+}++// ---------- Frame aspect ratios ----------+export const MK_RATIO = 1022 / 2082; // iPhone PNG mockup+export const TAB_P_RATIO = 0.667; // tablet portrait+export const TAB_L_RATIO = 1.5; // tablet landscape+export const IPAD_RATIO = 0.770; // iPad+export const TV_RATIO = 16 / 9; // Apple TV - landscape only+export const WATCH_RATIO = 422 / 514; // Apple Watch Ultra, the largest accepted slot+// CarPlay head units vary by vehicle and Apple ships five presets in CarPlay+// Simulator.app/Contents/Resources/VehicleConfigs: Minimum 748x456, Standard 800x480,+// Widescreen 1920x720, Portrait 900x1200, Standard Video Playback 1920x1080.+// "Standard" is the default here; change this constant to target another.+export const CARPLAY_RATIO = 800 / 480;+// Mac window: a 16:10 content area under a title bar MAC_TITLE_BAR x the content+// height tall, so a 16:10 capture (the Mac App Store's own aspect) fills the+// window without being cropped.+export const MAC_TITLE_BAR = 0.045;+export const MAC_RATIO = 16 / (10 * (1 + MAC_TITLE_BAR));++// iPhone mockup screen overlay (pre-measured)+export const PHONE_SCREEN = {+ L: (52 / 1022) * 100,+ T: (46 / 2082) * 100,+ W: (918 / 1022) * 100,+ H: (1990 / 2082) * 100,+ RX: (126 / 918) * 100,+ RY: (126 / 1990) * 100,+};++// ---------- Width formula helpers ----------+export function phoneW(cW: number, cH: number, clamp = 0.84) {+ return Math.min(clamp, 0.72 * (cH / cW) * MK_RATIO);+}+export function phoneWSmall(cW: number, cH: number) {+ return phoneW(cW, cH, 0.66);+}+export function tabletPW(cW: number, cH: number, clamp = 0.80) {+ return Math.min(clamp, 0.72 * (cH / cW) * TAB_P_RATIO);+}+export function tabletLW(cW: number, cH: number, clamp = 0.62) {+ return Math.min(clamp, 0.75 * (cH / cW) * TAB_L_RATIO);+}+export function ipadW(cW: number, cH: number, clamp = 0.75) {+ return Math.min(clamp, 0.72 * (cH / cW) * IPAD_RATIO);+}+// Clamped low so a 16:9 device clears the 0.28-height caption block on a 16:9 canvas.+export function tvW(cW: number, cH: number, clamp = 0.58) {+ return Math.min(clamp, 0.72 * (cH / cW) * TV_RATIO);+}+export function watchW(cW: number, cH: number, clamp = 0.52) {+ return Math.min(clamp, 0.72 * (cH / cW) * WATCH_RATIO);+}+// Height-bound on the wide canvas: the head unit must clear the caption block.+export function carPlayW(cW: number, cH: number, clamp = 0.86) {+ return Math.min(clamp, 0.58 * (cH / cW) * CARPLAY_RATIO);+}+// 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) {+ return Math.min(clamp, 0.58 * (cH / cW) * MAC_RATIO);+}++// ---------- Themes ----------+export const DEFAULT_THEME_ID: ThemeId = "clean-light";++export const DEFAULT_SCREENSHOT_FONT_ID: ScreenshotFontId = "template-default";++// Family used for a font imported through the toolbar. The matching @font-face+// is injected into <head> by the editor (see screenshot-editor.tsx), so it sits+// in document.styleSheets where html-to-image can embed it into exports.+export const IMPORTED_FONT_FAMILY = "ImportedScreenshotFont";++export const SCREENSHOT_FONTS: Record<ScreenshotFontId, { name: string; family: string }> = {+ // Inherit the editor's Inter (next/font in app/layout.tsx), which is what the+ // canvas rendered before fonts were selectable, so existing decks don't shift.+ "template-default": { name: "Inter (default)", family: "inherit" },+ "system-sans": {+ name: "System Sans",+ family: 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',+ },+ "template-serif": { name: "Georgia", family: "Georgia, 'Times New Roman', serif" },+ // Named system fonts ship with macOS; elsewhere they fall back to the listed+ // alternatives, so export on the machine whose fonts you designed with.+ "avenir-next": { name: "Avenir Next", family: '"Avenir Next", Avenir, sans-serif' },+ "helvetica-neue": { name: "Helvetica Neue", family: '"Helvetica Neue", Helvetica, Arial, sans-serif' },+ "futura": { name: "Futura", family: "Futura, 'Trebuchet MS', sans-serif" },+ "baskerville": { name: "Baskerville", family: "Baskerville, 'Baskerville Old Face', Georgia, serif" },+ "palatino": { name: "Palatino", family: "Palatino, 'Palatino Linotype', 'Book Antiqua', serif" },+ "optima": { name: "Optima", family: "Optima, Candara, 'Segoe UI', sans-serif" },+ "american-typewriter": { name: "American Typewriter", family: '"American Typewriter", "Courier New", serif' },+ // Only offered once a font has been imported; the name shown comes from the file.+ "self-hosted": { name: "Imported font", family: `"${IMPORTED_FONT_FAMILY}", sans-serif` },+};++export const THEMES: Record<string, Theme> = {+ "codync-halftone": {+ id: "codync-halftone",+ name: "Codync Halftone",+ bg: "#000000",+ bgAlt: "#FFFFFF",+ fg: "#FFFFFF",+ fgAlt: "#000000",+ accent: "#9A9A9A",+ accentAlt: "#6E6E6E",+ muted: "#8A8A8A",+ halftone: true,+ },+ "clean-light": {+ id: "clean-light",+ name: "Clean Light",+ bg: "#F6F1EA",+ bgAlt: "#171717",+ fg: "#171717",+ fgAlt: "#F6F1EA",+ accent: "#5B7CFA",+ muted: "#6B7280",+ },+ "dark-bold": {+ id: "dark-bold",+ name: "Dark Bold",+ bg: "#0B1020",+ bgAlt: "#F8FAFC",+ fg: "#F8FAFC",+ fgAlt: "#0B1020",+ accent: "#8B5CF6",+ muted: "#94A3B8",+ },+ "warm-editorial": {+ id: "warm-editorial",+ name: "Warm Editorial",+ bg: "#F7E8DA",+ bgAlt: "#2B1D17",+ fg: "#2B1D17",+ fgAlt: "#F7E8DA",+ accent: "#D97706",+ muted: "#7C5A47",+ },+ "ocean-fresh": {+ id: "ocean-fresh",+ name: "Ocean Fresh",+ bg: "#E0F2FE",+ bgAlt: "#0C4A6E",+ fg: "#0C4A6E",+ fgAlt: "#E0F2FE",+ accent: "#0284C7",+ muted: "#475569",+ },+ "bloom-roast": {+ id: "bloom-roast",+ name: "Bloom Roast",+ bg: "#F2ECE2",+ bgAlt: "#24352F",+ fg: "#1D2420",+ fgAlt: "#FFF7EA",+ accent: "#B8794A",+ muted: "#65736B",+ },+ // Named style presets. Flat palettes for the basic renderer; the deep spec in+ // style-prompts/<id>.md still drives fonts, backgrounds, and decoration.+ "hand-drawn-editorial-tasks": {+ id: "hand-drawn-editorial-tasks",+ name: "Hand-Drawn Editorial",+ bg: "#F5EFDF",+ bgAlt: "#1B2336",+ fg: "#1B2336",+ fgAlt: "#F5EFDF",+ accent: "#B53A24",+ accentAlt: "#F26A50",+ muted: "#5A6275",+ },+ "retro-rubberhose-mascot": {+ id: "retro-rubberhose-mascot",+ name: "Retro Rubberhose",+ bg: "#F4E6CC",+ bgAlt: "#5C3A1E",+ fg: "#2A2118",+ fgAlt: "#F4E6CC",+ accent: "#B23A2A",+ accentAlt: "#F2BB46",+ muted: "#6E5236",+ },+ "moody-curated-dating": {+ id: "moody-curated-dating",+ name: "Moody Curated",+ bg: "#1F1C1A",+ bgAlt: "#F4EBDD",+ fg: "#F4EBDD",+ fgAlt: "#1F1C1A",+ accent: "#E8B97A",+ accentAlt: "#7A4F2A",+ muted: "#B8AFA2",+ },+ "paper-sticker-skeuomorphic": {+ id: "paper-sticker-skeuomorphic",+ name: "Paper Sticker",+ bg: "#F8F0E2",+ bgAlt: "#8FBE7C",+ fg: "#1F2A44",+ fgAlt: "#1F2A44",+ accent: "#2B6CB0",+ accentAlt: "#1E3F7A",+ muted: "#6B6457",+ },+ "dreamy-pastel-couples": {+ id: "dreamy-pastel-couples",+ name: "Dreamy Pastel",+ bg: "#F5E0F0",+ bgAlt: "#1B2240",+ fg: "#1B2240",+ fgAlt: "#F5E0F0",+ accent: "#5B3FC8",+ accentAlt: "#C9B6F2",+ muted: "#5E5A7A",+ },+ "glossy-3d-kbeauty-creator": {+ id: "glossy-3d-kbeauty-creator",+ name: "Glossy 3D K-Beauty",+ bg: "#3B266B",+ bgAlt: "#F4EEFB",+ fg: "#FFFFFF",+ fgAlt: "#3B266B",+ accent: "#FBE254",+ accentAlt: "#7B3FD0",+ muted: "#C9B8E8",+ },+ "liquid-glass-aurora": {+ id: "liquid-glass-aurora",+ name: "Liquid Glass Aurora",+ bg: "#F4F1FB",+ bgAlt: "#1B1730",+ fg: "#16131F",+ fgAlt: "#F4F1FB",+ accent: "#4A2FC0",+ accentAlt: "#B9A8FF",+ muted: "#4A4660",+ },+ "swiss-grid-bold": {+ id: "swiss-grid-bold",+ name: "Swiss Grid Bold",+ bg: "#F2F1EC",+ bgAlt: "#0E0E0C",+ fg: "#0E0E0C",+ fgAlt: "#F2F1EC",+ accent: "#C23B00",+ accentAlt: "#FF4F00",+ muted: "#5E5D57",+ },+ "neon-athletic-night": {+ id: "neon-athletic-night",+ name: "Neon Athletic Night",+ bg: "#0A0B0D",+ bgAlt: "#D4FF3A",+ fg: "#F4F5F0",+ fgAlt: "#0A0B0D",+ accent: "#D4FF3A",+ accentAlt: "#0A0B0D",+ muted: "#A3A8AF",+ },+ "magazine-cover-editorial": {+ id: "magazine-cover-editorial",+ name: "Magazine Cover",+ bg: "#F1EBE1",+ bgAlt: "#7A2320",+ fg: "#1A1714",+ fgAlt: "#F6EFE3",+ accent: "#7A2320",+ accentAlt: "#F1D9C9",+ muted: "#4A423A",+ },+ "candy-pop-social": {+ id: "candy-pop-social",+ name: "Candy Pop Social",+ bg: "#C6F135",+ bgAlt: "#2B44F0",+ fg: "#16121F",+ fgAlt: "#FFFFFF",+ accent: "#2B44F0",+ accentAlt: "#FFE23D",+ muted: "#4A3F5C",+ },+ "soft-clay-wellness": {+ id: "soft-clay-wellness",+ name: "Soft Clay Wellness",+ bg: "#EFE7DA",+ bgAlt: "#3A2B3A",+ fg: "#3A2E27",+ fgAlt: "#F3EBDD",+ accent: "#9A4B31",+ accentAlt: "#E6A585",+ muted: "#6E5A4C",+ },+ "midnight-glow-pro": {+ id: "midnight-glow-pro",+ name: "Midnight Glow Pro",+ bg: "#07080B",+ bgAlt: "#F4F5F8",+ fg: "#F4F5F8",+ fgAlt: "#0B0C12",+ accent: "#B3AFFF",+ accentAlt: "#3B38C8",+ muted: "#B4B9C6",+ },+ "risograph-zine": {+ id: "risograph-zine",+ name: "Risograph Zine",+ bg: "#F4F0E6",+ bgAlt: "#321871",+ fg: "#3255A4",+ fgAlt: "#F4F0E6",+ accent: "#C8006A",+ accentAlt: "#FF8FD0",+ muted: "#5E4E7A",+ },+ "bento-keynote-grid": {+ id: "bento-keynote-grid",+ name: "Bento Keynote",+ bg: "#F5F5F7",+ bgAlt: "#1D1D1F",+ fg: "#1D1D1F",+ fgAlt: "#F5F5F7",+ accent: "#B4441C",+ accentAlt: "#FF9F6B",+ muted: "#5E5E63",+ },+ "toybox-primary": {+ id: "toybox-primary",+ name: "Toybox Primary",+ bg: "#FFF6E6",+ bgAlt: "#3FA9F5",+ fg: "#1F1A4D",+ fgAlt: "#1F1A4D",+ accent: "#6236D9",+ accentAlt: "#1F1A4D",+ muted: "#5B5480",+ },+ "quiet-japandi": {+ id: "quiet-japandi",+ name: "Quiet Japandi",+ bg: "#F3F0EA",+ bgAlt: "#1E1D1B",+ fg: "#1E1D1B",+ fgAlt: "#F3F0EA",+ accent: "#C8321E",+ accentAlt: "#E8836F",+ muted: "#4E4B46",+ },+ "vintage-travel-poster": {+ id: "vintage-travel-poster",+ name: "Vintage Travel Poster",+ bg: "#4B2E4F",+ bgAlt: "#F1E4C8",+ fg: "#F1E4C8",+ fgAlt: "#1C1A17",+ accent: "#E8B04A",+ accentAlt: "#A8401C",+ muted: "#D8C6A6",+ },+};++export function themeById(themeId: string | undefined): Theme {+ return THEMES[themeId || ""] || THEMES[DEFAULT_THEME_ID];+}++export function hasTheme(themeId: string | undefined): boolean {+ return !!themeId && !!THEMES[themeId];+}++export const STORAGE_KEY = "app-store-screenshots:project:v1";+export const PROJECT_SCHEMA_VERSION = 2;++// 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"],+ macos: ["mac"],+ android: ["android", "android-7", "android-10", "feature-graphic"],+};++export const DEVICE_LABEL: Record<Device, string> = {+ iphone: "iPhone",+ ipad: "iPad",+ tvos: "Apple TV",+ watchos: "Apple Watch",+ carplay: "CarPlay (iPhone slot)",+ mac: "Mac",+ android: "Android Phone",+ "android-7": 'Android 7" Tablet',+ "android-10": 'Android 10" Tablet',+ "feature-graphic": "Feature Graphic",+};++// Friendly labels for slide layouts (used in dropdowns)+export const LAYOUT_LABEL: Record<SlideLayout, string> = {+ hero: "Hero",+ "device-bottom": "Device bottom",+ "device-top": "Device top",+ "two-devices": "Two devices",+ "no-device": "No device",+ "split-landscape": "Split (landscape)",+ "feature-graphic": "Feature graphic",+};++// Short description shown under each layout name+export const LAYOUT_HINT: Record<SlideLayout, string> = {+ hero: "Headline above, device at bottom",+ "device-bottom": "Headline top, device anchored below",+ "device-top": "Flipped — device on top",+ "two-devices": "Layered back + front phones",+ "no-device": "Big standalone headline",+ "split-landscape": "Caption left, device right",+ "feature-graphic": "1024×500 Play Store banner",+};diff --git a/marketing/app-store-screenshots/src/lib/contrast.ts b/marketing/app-store-screenshots/src/lib/contrast.tsnew file mode 100644index 00000000..d0252b0e--- /dev/null+++ b/marketing/app-store-screenshots/src/lib/contrast.ts@@ -0,0 +1,74 @@+import type { Slide, Theme } from "./types";++// WCAG 2 contrast helpers used to keep caption text readable when a slide+// uses a custom background colour instead of one of its theme's backgrounds.++const DARK_TEXT = "#0B0B0F";+const LIGHT_TEXT = "#FFFFFF";+// Headlines are large, bold display text, but labels are small; aim for the+// body-text ratio so both stay legible after App Store downscaling.+const TEXT_CONTRAST = 4.5;+// The accent label may be a little softer before we swap it for the text colour.+const ACCENT_CONTRAST = 3;++function parseHex(hex: string): [number, number, number] | null {+ const m = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(hex.trim());+ if (!m) return null;+ const h = m[1].length === 3 ? m[1].split("").map((c) => c + c).join("") : m[1];+ const n = parseInt(h, 16);+ return [(n >> 16) & 0xff, (n >> 8) & 0xff, n & 0xff];+}++export function relativeLuminance(hex: string): number | null {+ const rgb = parseHex(hex);+ if (!rgb) return null;+ const [r, g, b] = rgb.map((v) => {+ const c = v / 255;+ return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;+ });+ return 0.2126 * r + 0.7152 * g + 0.0722 * b;+}++export function contrastRatio(a: string, b: string): number {+ const la = relativeLuminance(a);+ const lb = relativeLuminance(b);+ if (la === null || lb === null) return 21;+ const [hi, lo] = la > lb ? [la, lb] : [lb, la];+ return (hi + 0.05) / (lo + 0.05);+}++function firstReadable(bg: string, candidates: (string | undefined)[], min: number) {+ return candidates.find((c): c is string => !!c && contrastRatio(c, bg) >= min);+}++export type SlideColors = {+ /** Headline and default text-element colour. */+ fg: string;+ /** Uppercase label colour. */+ accent: string;+ /** True when the slide background is dark (drives subtle text shadows). */+ dark: boolean;+};++/**+ * Text colours for a slide. Theme backgrounds use the theme's own colours.+ * A custom background keeps the theme colours when they're readable on it and+ * otherwise switches to the theme's other text colour, then to near-black or+ * white, whichever contrasts more. Colours a user picked explicitly on a text+ * element are never passed through here.+ */+export function slideColors(theme: Theme, slide: Pick<Slide, "inverted" | "backgroundColor">): SlideColors {+ const inverted = !!slide.inverted;+ const themeFg = inverted ? theme.fgAlt : theme.fg;+ const themeAccent = inverted ? theme.accentAlt ?? theme.accent : theme.accent;+ const bg = slide.backgroundColor;+ if (!bg || relativeLuminance(bg) === null) {+ return { fg: themeFg, accent: themeAccent, dark: inverted };+ }+ const dark = (relativeLuminance(bg) ?? 1) < 0.18;+ const fallback = contrastRatio(DARK_TEXT, bg) >= contrastRatio(LIGHT_TEXT, bg) ? DARK_TEXT : LIGHT_TEXT;+ const fg = firstReadable(bg, [themeFg, inverted ? theme.fg : theme.fgAlt], TEXT_CONTRAST) ?? fallback;+ const accent =+ firstReadable(bg, [themeAccent, inverted ? theme.accent : theme.accentAlt], ACCENT_CONTRAST) ?? fg;+ return { fg, accent, dark };+}diff --git a/marketing/app-store-screenshots/src/lib/copy-ideas.ts b/marketing/app-store-screenshots/src/lib/copy-ideas.tsnew file mode 100644index 00000000..19b39781--- /dev/null+++ b/marketing/app-store-screenshots/src/lib/copy-ideas.ts@@ -0,0 +1,74 @@+// Headline formulas surfaced in the inspector's "Copy ideas" menu. Picking one+// drops the formula into the headline for the active locale; the bracketed+// words are placeholders the user replaces. The fuller library (category+// banks, deck arcs, localization notes) lives in the skill's copy-ideas.md.++export type CopyIdea = {+ formula: string; // inserted into the headline; "\n" is an intentional break+ example: string; // shown under the formula so the pattern is obvious+};++export type CopyIdeaSlot = {+ id: string;+ name: string;+ label: string; // suggested eyebrow label for this slot+ ideas: CopyIdea[];+};++export const COPY_IDEA_SLOTS: CopyIdeaSlot[] = [+ {+ id: "hero",+ name: "Hero",+ label: "MEET [APP]",+ ideas: [+ { formula: "[Outcome],\nwithout [pain].", example: "Great coffee, without the guesswork." },+ { formula: "Your [noun],\n[benefit].", example: "Your money, finally clear." },+ { formula: "[Verb] [noun].\n[Verb] [noun].", example: "Track habits. Keep streaks." },+ { formula: "Every [noun],\n[outcome].", example: "Every workout, counted." },+ { formula: "Meet your new\n[role].", example: "Meet your new sleep coach." },+ ],+ },+ {+ id: "differentiator",+ name: "Differentiator",+ label: "ONLY ON [APP]",+ ideas: [+ { formula: "Only [app]\n[does the unique thing].", example: "Only Bloom knows when beans peak." },+ { formula: "No [pain].\nJust [outcome].", example: "No ads. Just progress." },+ { formula: "Built for\n[specific person].", example: "Built for people who read slowly." },+ { formula: "[Verb] it once.\n[Outcome] forever.", example: "Scan it once. Tracked forever." },+ ],+ },+ {+ id: "feature",+ name: "Feature",+ label: "FEATURE 01",+ ideas: [+ { formula: "[Verb] [noun]\nin [time].", example: "Log a meal in 3 seconds." },+ { formula: "Your [noun],\nsorted.", example: "Your shelf, sorted by freshness." },+ { formula: "Never [pain]\nagain.", example: "Never miss a refill again." },+ { formula: "From [before]\nto [after].", example: "From receipt to budget in one tap." },+ { formula: "Right on your\n[surface].", example: "Right on your lock screen." },+ ],+ },+ {+ id: "proof",+ name: "Proof",+ label: "LOVED BY [GROUP]",+ ideas: [+ { formula: "[Number] [people]\n[verb] [app].", example: "40,000 runners train with Stride." },+ { formula: "Loved by\n[specific group].", example: "Loved by home baristas." },+ { formula: "Private\nby design.", example: "Your data stays on device." },+ ],+ },+ {+ id: "closer",+ name: "Closer",+ label: "AND MORE",+ ideas: [+ { formula: "And so\nmuch more.", example: "Pair with feature pills or a wordlist." },+ { formula: "Made for people\nwho [care about X].", example: "Made for people who care about the details." },+ { formula: "Your first [unit]\nstarts today.", example: "Your first week starts today." },+ ],+ },+];diff --git a/marketing/app-store-screenshots/src/lib/defaults.ts b/marketing/app-store-screenshots/src/lib/defaults.tsnew file mode 100644index 00000000..0e50a1a3--- /dev/null+++ b/marketing/app-store-screenshots/src/lib/defaults.ts@@ -0,0 +1,186 @@+import { DEFAULT_LOCALE } from "./locale";+import { DEFAULT_SCREENSHOT_FONT_ID, DEFAULT_THEME_ID, PLATFORM_DEVICES, PROJECT_SCHEMA_VERSION } from "./constants";+import type { Device, Platform, ProjectState, Slide } from "./types";++let _id = 0;+export const nid = () => `s_${Date.now().toString(36)}_${(_id++).toString(36)}`;++const en = (s: string) => ({ [DEFAULT_LOCALE]: s });++function makeStarterSlides(): Slide[] {+ return [+ {+ id: nid(),+ layout: "hero",+ label: en("MEET YOUR APP"),+ headline: en("Sell one\nidea per slide."),+ screenshot: "",+ },+ {+ id: nid(),+ layout: "device-bottom",+ label: en("FEATURE 01"),+ headline: en("Your headline\nlives here."),+ screenshot: "",+ },+ {+ id: nid(),+ layout: "two-devices",+ label: en("FEATURE 02"),+ headline: en("Show two\nscreens at once."),+ screenshot: "",+ screenshotSecondary: "",+ },+ {+ id: nid(),+ layout: "device-top",+ label: en("FEATURE 03"),+ headline: en("Flip the contrast\nfor visual rhythm."),+ screenshot: "",+ inverted: true,+ },+ {+ id: nid(),+ layout: "no-device",+ label: en("MORE"),+ headline: en("And so\nmuch more."),+ screenshot: "",+ },+ ];+}++function ipadStarter(): Slide[] {+ return [+ {+ id: nid(),+ layout: "hero",+ label: en("MEET YOUR APP"),+ headline: en("Made for\nthe big screen."),+ screenshot: "",+ },+ {+ id: nid(),+ layout: "device-bottom",+ label: en("FEATURE 01"),+ headline: en("Built for\nfocus."),+ screenshot: "",+ },+ {+ id: nid(),+ layout: "device-top",+ label: en("FEATURE 02"),+ headline: en("Always within reach."),+ screenshot: "",+ inverted: true,+ },+ ];+}++function tvStarter(): Slide[] {+ return [+ { id: nid(), layout: "hero", label: en("MEET YOUR APP"), headline: en("Made for\nthe living room."), 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 },+ { id: nid(), layout: "no-device", label: en("MORE"), headline: en("And so\nmuch more."), screenshot: "" },+ ];+}++// Short headlines: the watch canvas is only 422 px wide.+function watchStarter(): Slide[] {+ return [+ { id: nid(), layout: "hero", label: en("MEET YOUR APP"), headline: en("On your\nwrist."), screenshot: "" },+ { id: nid(), layout: "device-bottom", label: en("FEATURE 01"), headline: en("One glance.\nDone."), screenshot: "" },+ { id: nid(), layout: "device-top", label: en("FEATURE 02"), headline: en("Always\nwith you."), screenshot: "", inverted: true },+ ];+}++function carplayStarter(): Slide[] {+ return [+ { id: nid(), layout: "split-landscape", label: en("CARPLAY"), headline: en("Eyes on\nthe road."), screenshot: "" },+ { id: nid(), layout: "device-bottom", label: en("FEATURE 01"), headline: en("Everything, one tap away."), screenshot: "" },+ { id: nid(), layout: "device-top", label: en("FEATURE 02"), headline: en("Made for every drive."), screenshot: "", inverted: true },+ ];+}++function tabletStarter(kind: "7" | "10"): Slide[] {+ return [+ {+ id: nid(),+ layout: "hero",+ label: en("MEET YOUR APP"),+ headline: en(kind === "7" ? "Pocket-sized\npower." : "Made for\nthe big screen."),+ screenshot: "",+ },+ {+ id: nid(),+ layout: "split-landscape",+ label: en("FEATURE 01"),+ headline: en("Wide canvas,\nbigger ideas."),+ screenshot: "",+ },+ ];+}++// Mac is contained like the TV, so "hero" and "device-bottom" would look alike;+// the split and two-window slides give the wide canvas its rhythm instead.+function macStarter(): Slide[] {+ return [+ { id: nid(), layout: "hero", label: en("MEET YOUR APP"), headline: en("Made for\nyour Mac."), screenshot: "" },+ { id: nid(), layout: "split-landscape", label: en("FEATURE 01"), headline: en("Everything in\none window."), screenshot: "" },+ { id: nid(), layout: "device-top", label: en("FEATURE 02"), headline: en("One shortcut away."), screenshot: "", inverted: true },+ { id: nid(), layout: "two-devices", label: en("FEATURE 03"), headline: en("Work across windows."), screenshot: "", screenshotSecondary: "" },+ { id: nid(), layout: "no-device", label: en("MORE"), headline: en("And so\nmuch more."), screenshot: "" },+ ];+}++function fgStarter(): Slide[] {+ return [+ {+ id: nid(),+ layout: "feature-graphic",+ label: {},+ headline: en("Your tagline goes here."),+ screenshot: "",+ },+ ];+}++export const DEFAULT_PROJECT: ProjectState = {+ schemaVersion: PROJECT_SCHEMA_VERSION,+ appName: "My App",+ themeId: DEFAULT_THEME_ID,+ fontId: DEFAULT_SCREENSHOT_FONT_ID,+ connectedCanvas: true,+ locales: [DEFAULT_LOCALE],+ locale: DEFAULT_LOCALE,+ device: "iphone",+ orientation: "portrait",+ appIcon: "",+ slidesByDevice: {+ iphone: makeStarterSlides(),+ android: makeStarterSlides(),+ ipad: ipadStarter(),+ tvos: tvStarter(),+ watchos: watchStarter(),+ carplay: carplayStarter(),+ mac: macStarter(),+ "android-7": tabletStarter("7"),+ "android-10": tabletStarter("10"),+ "feature-graphic": fgStarter(),+ },+};++export function newSlide(layout: Slide["layout"] = "device-bottom"): Slide {+ return {+ id: nid(),+ layout,+ label: en("NEW"),+ headline: en("Edit this\nheadline."),+ screenshot: "",+ };+}++export function detectPlatform(device: Device): Platform {+ const platforms = Object.keys(PLATFORM_DEVICES) as Platform[];+ return platforms.find((p) => PLATFORM_DEVICES[p].includes(device)) ?? "ios";+}diff --git a/marketing/app-store-screenshots/src/lib/elements.ts b/marketing/app-store-screenshots/src/lib/elements.tsnew file mode 100644index 00000000..4e71d15c--- /dev/null+++ b/marketing/app-store-screenshots/src/lib/elements.ts@@ -0,0 +1,38 @@+import type { BuiltInElementId, ElementId, ImageElementId, TextElementId } from "./types";++export const BUILT_IN_ELEMENT_IDS: BuiltInElementId[] = [+ "caption",+ "device",+ "deviceSecondary",+];++export const TEXT_ELEMENT_PREFIX = "text:";+export const IMAGE_ELEMENT_PREFIX = "image:";++export function isBuiltInElementId(id: ElementId | string): id is BuiltInElementId {+ return (BUILT_IN_ELEMENT_IDS as string[]).includes(id);+}++export function isTextElementId(id: ElementId | string | null | undefined): id is TextElementId {+ return typeof id === "string" && id.startsWith(TEXT_ELEMENT_PREFIX);+}++export function isImageElementId(id: ElementId | string | null | undefined): id is ImageElementId {+ return typeof id === "string" && id.startsWith(IMAGE_ELEMENT_PREFIX);+}++export function toTextElementId(id: string): TextElementId {+ return `${TEXT_ELEMENT_PREFIX}${id}` as TextElementId;+}++export function toImageElementId(id: string): ImageElementId {+ return `${IMAGE_ELEMENT_PREFIX}${id}` as ImageElementId;+}++export function textElementKey(id: TextElementId | ElementId): string {+ return isTextElementId(id) ? id.slice(TEXT_ELEMENT_PREFIX.length) : id;+}++export function imageElementKey(id: ImageElementId | ElementId): string {+ return isImageElementId(id) ? id.slice(IMAGE_ELEMENT_PREFIX.length) : id;+}diff --git a/marketing/app-store-screenshots/src/lib/export-assets.ts b/marketing/app-store-screenshots/src/lib/export-assets.tsnew file mode 100644index 00000000..9486079d--- /dev/null+++ b/marketing/app-store-screenshots/src/lib/export-assets.ts@@ -0,0 +1,25 @@+import { resolveScreenshot } from "./locale";+import type { ProjectState } from "./types";++/** Only assets used by the deck being exported; inactive decks may be unfinished. */+export function exportAssetPaths(state: ProjectState): string[] {+ const paths = new Set<string>();+ const add = (path: string | undefined) => { if (path) paths.add(path); };+ for (const slide of state.slidesByDevice[state.device] || []) {+ if (state.device === "feature-graphic" || slide.layout === "feature-graphic") {+ add(state.appIcon);+ continue;+ }+ if (slide.layout !== "no-device" || slide.transforms?.device || slide.transforms?.deviceSecondary) {+ if (state.device === "iphone") add("/mockup.png");+ for (const locale of state.locales) {+ add(resolveScreenshot(slide.screenshot, locale));+ if (slide.layout === "two-devices" || slide.transforms?.deviceSecondary) {+ add(resolveScreenshot(slide.screenshotSecondary, locale));+ }+ }+ }+ for (const image of slide.imageElements || []) add(image.src);+ }+ return [...paths];+}diff --git a/marketing/app-store-screenshots/src/lib/export-render.ts b/marketing/app-store-screenshots/src/lib/export-render.tsnew file mode 100644index 00000000..0abd5a3b--- /dev/null+++ b/marketing/app-store-screenshots/src/lib/export-render.ts@@ -0,0 +1,218 @@+"use client";+// Rasterises one export slide to PNG.+//+// WHY THIS IS NOT JUST `toPng(node)`+// ----------------------------------+// html-to-image serialises the node into an SVG <foreignObject>, loads that SVG+// as an image and draws it to a canvas exactly once. WebKit (Safari, and any+// WebKit-based browser) decodes the <img> data URLs *nested inside* an SVG+// image asynchronously, kicked off by the first paint. That single draw can+// therefore capture the headline, background and CSS device frame while every+// screenshot is still blank, with no error. Whether it wins the race depends on+// image size and machine load, so a different slide failed on each export and a+// 4K render could fail where 1080p passed. Chrome paints nested data URLs on the+// first draw, which is why the bug looked intermittent.+//+// THE FIX+// -------+// 1. Embed only the images inside the captured slide. A connected deck renders+// every screen side by side; embedding all of them made each SVG N× larger.+// 2. Render a baseline with every image blanked, so we know what each image's+// region looks like when the image is missing.+// 3. Draw the real SVG repeatedly until every visible image region differs from+// that baseline and two consecutive draws are identical. Only then export.+// If an image never shows up within the timeout, report it instead of+// silently shipping a blank device.+import { toSvg } from "html-to-image";+import { encodeCanvasPng } from "./png-encode";++const SETTLE_POLL_MS = 50;+const SETTLE_TIMEOUT_MS = 8000;+const FINGERPRINT_SIZE = 12;+const BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";+const SVG_PREFIX = "data:image/svg+xml;charset=utf-8,";++type Box = { x: number; y: number; w: number; h: number };++export type RenderedSlide = {+ /** Draw the settled slide at the given export size as opaque 24-bit PNG bytes. */+ toPng: (w: number, h: number) => Promise<Uint8Array>;+ /** Visible images that never appeared in the render. 0 when all is well. */+ missingImages: number;+};++const nextFrame = () => new Promise<void>((resolve) => requestAnimationFrame(() => resolve()));+const sleep = (ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms));++function loadImage(src: string): Promise<HTMLImageElement> {+ return new Promise((resolve, reject) => {+ const image = new Image();+ image.onload = () => {+ image.decode().then(+ () => resolve(image),+ () => resolve(image),+ );+ };+ image.onerror = () => reject(new Error("Couldn't load the rendered slide"));+ image.src = src;+ });+}++function intersects(a: DOMRect, b: DOMRect) {+ return a.right > b.left && a.left < b.right && a.bottom > b.top && a.top < b.bottom;+}++// Same SVG with every <img> pointed at a transparent pixel: what each image+// region looks like when that image failed to paint.+function blankImages(svg: string) {+ if (!svg.startsWith(SVG_PREFIX)) return null;+ const markup = decodeURIComponent(svg.slice(SVG_PREFIX.length));+ const blanked = markup.replace(/(<img\b[^>]*?\bsrc=")[^"]*(")/g, `$1${BLANK_GIF}$2`);+ return SVG_PREFIX + encodeURIComponent(blanked);+}++function createContext(width: number, height: number, readBack = false) {+ const canvas = document.createElement("canvas");+ canvas.width = width;+ canvas.height = height;+ const ctx = canvas.getContext("2d", readBack ? { willReadFrequently: true } : undefined);+ if (!ctx) throw new Error("Canvas 2D context unavailable");+ return { canvas, ctx };+}++// Downsampled pixels of each box: cheap to compare, sensitive to "is it there".+function fingerprint(source: HTMLCanvasElement, boxes: Box[], scratch: CanvasRenderingContext2D) {+ return boxes.map((b) => {+ scratch.clearRect(0, 0, FINGERPRINT_SIZE, FINGERPRINT_SIZE);+ scratch.drawImage(source, b.x, b.y, b.w, b.h, 0, 0, FINGERPRINT_SIZE, FINGERPRINT_SIZE);+ return scratch.getImageData(0, 0, FINGERPRINT_SIZE, FINGERPRINT_SIZE).data.join(",");+ });+}++// Does the image have visible pixels in its inner 60% ("opaque-center"), only+// nearer its edges ("edges-only"), or none at all ("empty")? Sampled from the+// decoded image itself at fingerprint resolution.+function alphaCoverage(+ image: HTMLImageElement,+ scratch: CanvasRenderingContext2D,+): "opaque-center" | "edges-only" | "empty" {+ const w = image.naturalWidth;+ const h = image.naturalHeight;+ if (!w || !h) return "opaque-center";+ const hasAlpha = (sx: number, sy: number, sw: number, sh: number) => {+ scratch.clearRect(0, 0, FINGERPRINT_SIZE, FINGERPRINT_SIZE);+ scratch.drawImage(image, sx, sy, sw, sh, 0, 0, FINGERPRINT_SIZE, FINGERPRINT_SIZE);+ const data = scratch.getImageData(0, 0, FINGERPRINT_SIZE, FINGERPRINT_SIZE).data;+ for (let i = 3; i < data.length; i += 4) if (data[i] > 8) return true;+ return false;+ };+ try {+ if (hasAlpha(w * 0.2, h * 0.2, w * 0.6, h * 0.6)) return "opaque-center";+ return hasAlpha(0, 0, w, h) ? "edges-only" : "empty";+ } catch {+ // Unreadable (e.g. tainted) images keep the original inner-box check.+ return "opaque-center";+ }+}++export async function renderSlide(+ el: HTMLElement,+ width: number,+ height: number,+ backgroundColor = "#ffffff",+): Promise<RenderedSlide> {+ const root = el.getBoundingClientRect();+ const sx = width / (root.width || width);+ const sy = height / (root.height || height);+ const isVisible = (node: Element) => intersects(node.getBoundingClientRect(), root);++ const visible = Array.from(el.querySelectorAll("img")).filter(+ (image) => !!image.getAttribute("src") && isVisible(image),+ );+ await Promise.all(visible.map((image) => image.decode().catch(() => undefined)));++ const { ctx: scratch } = createContext(FINGERPRINT_SIZE, FINGERPRINT_SIZE, true);++ // Inner 60% of each visible image, in canvas pixels. The inset keeps bezels,+ // rounded corners and overlapping frames out of the comparison. An image+ // whose own centre is see-through (the iPhone mockup around an empty screen,+ // a ring-shaped logo overlay) would look "missing" there even when painted,+ // so those are checked over their full box instead, as are frames marked+ // data-export-check="full" whose middle is covered by the screen layer.+ // Images with no visible pixels at all are skipped.+ const boxes: Box[] = visible+ .map((image) => {+ const coverage = alphaCoverage(image, scratch);+ if (coverage === "empty") return null;+ const inset = coverage === "opaque-center" && image.dataset.exportCheck !== "full" ? 0.2 : 0;+ const r = image.getBoundingClientRect();+ const left = Math.max(r.left, root.left);+ const top = Math.max(r.top, root.top);+ const w = (Math.min(r.right, root.right) - left) * sx;+ const h = (Math.min(r.bottom, root.bottom) - top) * sy;+ return {+ x: (left - root.left) * sx + w * inset,+ y: (top - root.top) * sy + h * inset,+ w: w * (1 - inset * 2),+ h: h * (1 - inset * 2),+ };+ })+ .filter((b): b is Box => !!b && b.w >= 2 && b.h >= 2);++ const svg = await toSvg(el, {+ width,+ height,+ cacheBust: false,+ backgroundColor,+ filter: (node) => !(node instanceof HTMLImageElement) || isVisible(node),+ });++ const { canvas, ctx } = createContext(width, height);+ const draw = (image: HTMLImageElement) => {+ ctx.fillStyle = backgroundColor;+ ctx.fillRect(0, 0, width, height);+ ctx.drawImage(image, 0, 0, width, height);+ };++ let missingImages = 0;+ const blankSvg = boxes.length > 0 ? blankImages(svg) : null;+ if (blankSvg) {+ draw(await loadImage(blankSvg));+ const baseline = fingerprint(canvas, boxes, scratch);+ const image = await loadImage(svg);+ let prev: string[] | null = null;+ let painted: boolean[] = boxes.map(() => false);+ const deadline = performance.now() + SETTLE_TIMEOUT_MS;+ for (;;) {+ draw(image);+ const cur = fingerprint(canvas, boxes, scratch);+ painted = cur.map((fp, i) => fp !== baseline[i]);+ const stable = prev !== null && cur.every((fp, i) => fp === prev![i]);+ if ((stable && painted.every(Boolean)) || performance.now() > deadline) break;+ prev = cur;+ await nextFrame();+ await sleep(SETTLE_POLL_MS);+ }+ missingImages = painted.filter((p) => !p).length;+ } else {+ draw(await loadImage(svg));+ }++ return {+ missingImages,+ toPng: (w, h) => {+ if (w === width && h === height) return encodeCanvasPng(canvas);+ const { canvas: out, ctx: octx } = createContext(w, h);+ octx.imageSmoothingEnabled = true;+ octx.imageSmoothingQuality = "high";+ // Cover, not stretch: some slots differ from the canvas aspect by a few+ // percent (Apple Watch 422×514 → 312×390), and stretching would squash+ // the device frame. Cover trims the same few pixels off the edges instead.+ const scale = Math.max(w / width, h / height);+ const dw = width * scale;+ const dh = height * scale;+ octx.drawImage(canvas, (w - dw) / 2, (h - dh) / 2, dw, dh);+ return encodeCanvasPng(out);+ },+ };+}diff --git a/marketing/app-store-screenshots/src/lib/image-cache.ts b/marketing/app-store-screenshots/src/lib/image-cache.tsnew file mode 100644index 00000000..dd0022fa--- /dev/null+++ b/marketing/app-store-screenshots/src/lib/image-cache.ts@@ -0,0 +1,69 @@+"use client";+// Pre-loads images as base64 data URIs so html-to-image exports without+// non-deterministic image fetch races. Always use img(path) in render.++const cache = new Map<string, string>();+const failed = new Set<string>();+const pending = new Map<string, Promise<void>>();++async function fetchAsDataUrl(path: string): Promise<string | null> {+ try {+ const resp = await fetch(path, { signal: AbortSignal.timeout(10000) });+ if (!resp.ok) return null;+ const blob = await resp.blob();+ const data = await new Promise<string>((resolve, reject) => {+ const reader = new FileReader();+ reader.onloadend = () => resolve(reader.result as string);+ reader.onerror = reject;+ reader.readAsDataURL(blob);+ });+ // A successful HTTP response may still be an HTML error page or corrupt+ // image. Catch that before export silently substitutes an empty device.+ const image = new Image();+ image.src = data;+ await image.decode();+ return data;+ } catch {+ return null;+ }+}++export async function preloadImages(+ paths: string[],+ options: { retryFailed?: boolean } = {},+): Promise<void> {+ await Promise.all(+ paths+ .filter(Boolean)+ .filter((p) => !cache.has(p) && (options.retryFailed || !failed.has(p)))+ .map((p) => {+ const existing = pending.get(p);+ if (existing) return existing;+ const task = fetchAsDataUrl(p).then((data) => {+ // 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); }+ else failed.add(p);+ }).finally(() => pending.delete(p));+ pending.set(p, task);+ return task;+ }),+ );+}++export function img(path: string | undefined): string {+ if (!path) return "";+ if (path.startsWith("data:")) return path;+ if (failed.has(path)) return "";+ return cache.get(path) || path;+}++export function setImage(path: string, dataUrl: string) {+ cache.set(path, dataUrl);+ failed.delete(path);+}++export function didFail(path: string | undefined): boolean {+ if (!path) return false;+ return failed.has(path);+}diff --git a/marketing/app-store-screenshots/src/lib/locale.ts b/marketing/app-store-screenshots/src/lib/locale.tsnew file mode 100644index 00000000..a316a077--- /dev/null+++ b/marketing/app-store-screenshots/src/lib/locale.ts@@ -0,0 +1,52 @@+import type { LocalizedText } from "./types";++export const DEFAULT_LOCALE = "en";++// Read the value for `locale` from a localized field. Falls back to en, then to+// the first locale that has a non-empty value, then to empty string. Used by+// the canvas/preview/thumb so switching to a locale the user hasn't filled in+// shows the source copy instead of blanks.+export function pickText(field: LocalizedText | undefined, locale: string): string {+ if (!field) return "";+ const direct = field[locale];+ if (direct && direct.length) return direct;+ const en = field[DEFAULT_LOCALE];+ if (en && en.length) return en;+ for (const k of Object.keys(field)) {+ const v = field[k];+ if (v && v.length) return v;+ }+ return "";+}++// Replace `{locale}` placeholders in a screenshot path. Data URLs and empty+// strings pass through unchanged.+export function resolveScreenshot(path: string | undefined, locale: string): string {+ if (!path) return "";+ if (path.startsWith("data:")) return path;+ if (!path.includes("{locale}")) return path;+ return path.replace(/\{locale\}/g, locale);+}++// Convert legacy `string` headline/label fields to the per-locale shape. Safe+// to call on already-migrated data.+export function coerceLocalized(value: unknown): LocalizedText {+ if (typeof value === "string") return { [DEFAULT_LOCALE]: value };+ if (value && typeof value === "object" && !Array.isArray(value)) {+ return Object.fromEntries(Object.entries(value).filter(([, text]) => typeof text === "string"));+ }+ return {};+}++// Set or clear the value for `locale` on a localized field. Empty values delete+// the key so the persisted JSON stays free of "" placeholders.+export function writeLocalized(+ field: LocalizedText | undefined,+ locale: string,+ value: string,+): LocalizedText {+ const next: LocalizedText = { ...(field || {}) };+ if (value.length === 0) delete next[locale];+ else next[locale] = value;+ return next;+}diff --git a/marketing/app-store-screenshots/src/lib/png-encode.ts b/marketing/app-store-screenshots/src/lib/png-encode.tsnew file mode 100644index 00000000..d389aed5--- /dev/null+++ b/marketing/app-store-screenshots/src/lib/png-encode.ts@@ -0,0 +1,85 @@+"use client";+// Canvas → 24-bit RGB PNG bytes (see png-rgb.ts for why not toDataURL).+// Encoding a full-size export is ~100ms of filtering and deflate, so it runs+// on a small worker pool: exports keep rendering the next screen meanwhile.+// Without workers, or if one fails, the same encoder runs inline.+import { encodeRgbPixels } from "./png-rgb";++type Job = {+ worker: Worker;+ pixels: Uint8ClampedArray;+ width: number;+ height: number;+ resolve: (png: Uint8Array) => void;+ reject: (error: unknown) => void;+ timeout: ReturnType<typeof setTimeout>;+};+type Result = { id: number; png?: Uint8Array; error?: string };++let pool: Worker[] | null = null;+let nextWorker = 0;+let nextId = 0;+const jobs = new Map<number, Job>();++function encodeInline(job: Job) {+ clearTimeout(job.timeout);+ encodeRgbPixels(job.pixels, job.width, job.height).then(job.resolve, job.reject);+}++function retireWorker(worker: Worker) {+ worker.terminate();+ pool = (pool || []).filter((w) => w !== worker);+ for (const [id, job] of jobs) {+ if (job.worker !== worker) continue;+ jobs.delete(id);+ encodeInline(job);+ }+}++function workers(): Worker[] {+ if (pool) return pool;+ pool = [];+ try {+ const size = Math.max(1, Math.min(4, (navigator.hardwareConcurrency || 2) - 1));+ for (let i = 0; i < size; i++) {+ const worker = new Worker(new URL("./png-worker.ts", import.meta.url));+ worker.onmessage = ({ data }: MessageEvent<Result>) => {+ const job = jobs.get(data.id);+ if (!job) return;+ jobs.delete(data.id);+ clearTimeout(job.timeout);+ if (data.png) job.resolve(data.png);+ else encodeInline(job);+ };+ // A worker that fails to load or crashes leaves the pool, and its jobs+ // finish inline instead of leaving the export waiting forever.+ worker.onerror = (event) => {+ event.preventDefault();+ retireWorker(worker);+ };+ worker.onmessageerror = () => retireWorker(worker);+ pool.push(worker);+ }+ } catch {+ // Keep any workers that did start; an empty pool means inline encoding.+ }+ return pool;+}++export function encodeCanvasPng(canvas: HTMLCanvasElement): Promise<Uint8Array> {+ const ctx = canvas.getContext("2d");+ if (!ctx) return Promise.reject(new Error("Canvas 2D context unavailable"));+ const { width, height } = canvas;+ const pixels = ctx.getImageData(0, 0, width, height).data;+ const available = workers();+ if (!available.length) return encodeRgbPixels(pixels, width, height);+ const id = nextId++;+ const worker = available[nextWorker++ % available.length];+ return new Promise((resolve, reject) => {+ const timeout = setTimeout(() => retireWorker(worker), 15000);+ jobs.set(id, { worker, pixels, width, height, resolve, reject, timeout });+ // Copied, not transferred: the pixels stay here for the inline fallback.+ try { worker.postMessage({ id, pixels, width, height }); }+ catch { retireWorker(worker); }+ });+}diff --git a/marketing/app-store-screenshots/src/lib/png-rgb.ts b/marketing/app-store-screenshots/src/lib/png-rgb.tsnew file mode 100644index 00000000..693c61fa--- /dev/null+++ b/marketing/app-store-screenshots/src/lib/png-rgb.ts@@ -0,0 +1,158 @@+// Encodes RGBA pixels as an opaque 24-bit RGB PNG. No DOM access, so it runs+// in the export worker (png-worker.ts) as well as on the main thread.+//+// canvas.toDataURL("image/png") always writes RGBA (colour type 6), even when+// every pixel is opaque. Google Play requires screenshots and the feature+// graphic to be "JPEG or 24-bit PNG (no alpha)", and RGB is also the safe+// choice for App Store Connect, so exports are re-encoded here without the+// alpha channel. Compression uses the browser's native zlib (CompressionStream+// "deflate"), with the standard per-row filter heuristic to keep files small.++const SIGNATURE = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a];++const CRC_TABLE = (() => {+ const table = new Uint32Array(256);+ for (let n = 0; n < 256; n++) {+ let c = n;+ for (let k = 0; k < 8; k++) c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;+ table[n] = c >>> 0;+ }+ return table;+})();++function crc32(bytes: Uint8Array, start: number, end: number) {+ let c = 0xffffffff;+ for (let i = start; i < end; i++) c = CRC_TABLE[(c ^ bytes[i]) & 0xff] ^ (c >>> 8);+ return (c ^ 0xffffffff) >>> 0;+}++function chunk(type: string, data: Uint8Array) {+ const out = new Uint8Array(12 + data.length);+ const view = new DataView(out.buffer);+ view.setUint32(0, data.length);+ for (let i = 0; i < 4; i++) out[4 + i] = type.charCodeAt(i);+ out.set(data, 8);+ view.setUint32(8 + data.length, crc32(out, 4, 8 + data.length));+ return out;+}++// Writes one filtered scanline into `row` and returns its sum-of-absolute-+// values score, giving up once it reaches `limit`. `cur` and `prev` carry+// BPP leading zero bytes so the left neighbour never needs a bounds check.+// One loop per filter keeps the per-byte work branch-free; exports encode+// tens of millions of bytes.+const BPP = 3;++function applyFilter(type: number, cur: Uint8Array, prev: Uint8Array, row: Uint8Array, stride: number, limit: number) {+ let score = 0;+ let v = 0;+ switch (type) {+ case 0:+ for (let i = 0; i < stride && score < limit; i++) {+ v = cur[i + BPP];+ row[i] = v;+ score += v < 128 ? v : 256 - v;+ }+ break;+ case 1:+ for (let i = 0; i < stride && score < limit; i++) {+ v = (cur[i + BPP] - cur[i]) & 0xff;+ row[i] = v;+ score += v < 128 ? v : 256 - v;+ }+ break;+ case 2:+ for (let i = 0; i < stride && score < limit; i++) {+ v = (cur[i + BPP] - prev[i + BPP]) & 0xff;+ row[i] = v;+ score += v < 128 ? v : 256 - v;+ }+ break;+ case 3:+ for (let i = 0; i < stride && score < limit; i++) {+ v = (cur[i + BPP] - ((cur[i] + prev[i + BPP]) >> 1)) & 0xff;+ row[i] = v;+ score += v < 128 ? v : 256 - v;+ }+ break;+ default:+ for (let i = 0; i < stride && score < limit; i++) {+ const a = cur[i];+ const b = prev[i + BPP];+ const c = prev[i];+ const p = a + b - c;+ const pa = p > a ? p - a : a - p;+ const pb = p > b ? p - b : b - p;+ const pc = p > c ? p - c : c - p;+ v = (cur[i + BPP] - (pa <= pb && pa <= pc ? a : pb <= pc ? b : c)) & 0xff;+ row[i] = v;+ score += v < 128 ? v : 256 - v;+ }+ }+ return score;+}++// Filtered scanlines: each row is one filter-type byte plus the filtered RGB+// bytes, picking the filter with the smallest sum of absolute values.+function filterRows(rgba: Uint8ClampedArray, width: number, height: number): Uint8Array<ArrayBuffer> {+ const stride = width * BPP;+ const out = new Uint8Array((stride + 1) * height);+ let prev = new Uint8Array(stride + BPP);+ let cur = new Uint8Array(stride + BPP);+ const candidates = Array.from({ length: 5 }, () => new Uint8Array(stride));+ for (let y = 0; y < height; y++) {+ for (let x = 0, s = y * width * 4, d = BPP; x < width; x++, s += 4, d += BPP) {+ cur[d] = rgba[s];+ cur[d + 1] = rgba[s + 1];+ cur[d + 2] = rgba[s + 2];+ }+ let best = 0;+ let bestScore = Infinity;+ for (let type = 0; type < 5; type++) {+ const score = applyFilter(type, cur, prev, candidates[type], stride, bestScore);+ // A filter that hit the limit stopped early, but it lost, so the+ // winner's row is always complete.+ if (score < bestScore) {+ bestScore = score;+ best = type;+ }+ }+ const offset = y * (stride + 1);+ out[offset] = best;+ out.set(candidates[best], offset + 1);+ [prev, cur] = [cur, prev];+ }+ return out;+}++async function deflate(data: Uint8Array<ArrayBuffer>) {+ const stream = new Blob([data]).stream().pipeThrough(new CompressionStream("deflate"));+ return new Uint8Array(await new Response(stream).arrayBuffer());+}++export async function encodeRgbPixels(+ pixels: Uint8ClampedArray,+ width: number,+ height: number,+): Promise<Uint8Array<ArrayBuffer>> {+ const header = new Uint8Array(13);+ const view = new DataView(header.buffer);+ view.setUint32(0, width);+ view.setUint32(4, height);+ header[8] = 8; // bit depth+ header[9] = 2; // colour type: truecolour, no alpha++ const parts = [+ new Uint8Array(SIGNATURE),+ chunk("IHDR", header),+ chunk("IDAT", await deflate(filterRows(pixels, width, height))),+ chunk("IEND", new Uint8Array()),+ ];+ const png = new Uint8Array(parts.reduce((n, part) => n + part.length, 0));+ let offset = 0;+ for (const part of parts) {+ png.set(part, offset);+ offset += part.length;+ }+ return png;+}diff --git a/marketing/app-store-screenshots/src/lib/png-worker.ts b/marketing/app-store-screenshots/src/lib/png-worker.tsnew file mode 100644index 00000000..43ae81b0--- /dev/null+++ b/marketing/app-store-screenshots/src/lib/png-worker.ts@@ -0,0 +1,13 @@+// Export encoding worker: RGBA pixels in, 24-bit RGB PNG bytes out.+import { encodeRgbPixels } from "./png-rgb";++type Job = { id: number; pixels: Uint8ClampedArray; width: number; height: number };++self.onmessage = async ({ data }: MessageEvent<Job>) => {+ try {+ const png = await encodeRgbPixels(data.pixels, data.width, data.height);+ self.postMessage({ id: data.id, png }, { transfer: [png.buffer] });+ } catch (error) {+ self.postMessage({ id: data.id, error: error instanceof Error ? error.message : String(error) });+ }+};diff --git a/marketing/app-store-screenshots/src/lib/project-validation.ts b/marketing/app-store-screenshots/src/lib/project-validation.tsnew file mode 100644index 00000000..30bb4a51--- /dev/null+++ b/marketing/app-store-screenshots/src/lib/project-validation.ts@@ -0,0 +1,67 @@+import { DEVICE_LABEL, LAYOUT_LABEL } from "./constants";++const record = (value: unknown): value is Record<string, unknown> =>+ !!value && typeof value === "object" && !Array.isArray(value);++const finite = (value: unknown): value is number => typeof value === "number" && Number.isFinite(value);+const localized = (value: unknown) => value === undefined || typeof value === "string" ||+ (record(value) && Object.values(value).every(text => typeof text === "string"));+const transform = (value: unknown) => record(value) &&+ [value.x, value.y, value.width, value.height].every(finite) &&+ (value.width as number) > 0 && (value.height as number) > 0 &&+ [value.rotation, value.zIndex].every(n => n === undefined || finite(n));++/** 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.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`;+ }+ if (value.device !== undefined && (typeof value.device !== "string" || !Object.hasOwn(DEVICE_LABEL, value.device))) {+ return "Unknown project device";+ }+ if (value.orientation !== undefined && value.orientation !== "portrait" && value.orientation !== "landscape") {+ return "Unknown project orientation";+ }+ if (value.locales !== undefined && (!Array.isArray(value.locales) ||+ value.locales.some(locale => typeof locale !== "string" || !/^[a-zA-Z0-9]+(?:[-_][a-zA-Z0-9]+)*$/.test(locale)) ||+ new Set(value.locales).size !== value.locales.length)) return "locales must be a list of unique locale codes";+ for (const [device, slides] of Object.entries(value.slidesByDevice)) {+ if (!Object.hasOwn(DEVICE_LABEL, device)) return `Unknown deck device: ${device}`;+ if (!Array.isArray(slides)) return `${device} deck must be an array`;+ const ids = new Set<string>();+ for (const slide of slides) {+ if (!record(slide) || typeof slide.id !== "string" || !slide.id.trim() || ids.has(slide.id)) {+ return `${device} screens must have unique non-empty ids`;+ }+ ids.add(slide.id);+ if (typeof slide.layout !== "string" || !Object.hasOwn(LAYOUT_LABEL, slide.layout)) return `${device}: unknown screen layout`;+ for (const key of ["screenshot", "screenshotSecondary"]) {+ if (slide[key] !== undefined && typeof slide[key] !== "string") return `${device}: ${key} must be a string`;+ }+ if (!localized(slide.label) || !localized(slide.headline)) return `${device}: copy must be text or a locale-to-text object`;+ if (slide.inverted !== undefined && typeof slide.inverted !== "boolean") return `${device}: inverted must be a boolean`;+ if (slide.transforms !== undefined && (!record(slide.transforms) || Object.entries(slide.transforms).some(([key, value]) =>+ !["caption", "device", "deviceSecondary"].includes(key) || !transform(value)))) return `${device}: invalid element transform`;+ for (const key of ["textElements", "imageElements"] as const) {+ const elements = slide[key];+ if (elements === undefined) continue;+ if (!Array.isArray(elements)) return `${device}: ${key} must be an array`;+ const elementIds = new Set<string>();+ for (const element of elements) {+ if (!record(element) || typeof element.id !== "string" || !element.id.trim() || elementIds.has(element.id)) {+ return `${device}: ${key} must have unique non-empty ids`;+ }+ elementIds.add(element.id);+ if (!transform(element.transform)) return `${device}: invalid ${key} transform`;+ if (key === "textElements" && (!localized(element.text) ||+ [element.fontSize, element.fontWeight].some(n => n !== undefined && (!finite(n) || n <= 0)))) return `${device}: invalid text element`;+ if (key === "imageElements" && typeof element.src !== "string") return `${device}: image src must be a string`;+ }+ }+ }+ }+ return null;+}diff --git a/marketing/app-store-screenshots/src/lib/request-body.ts b/marketing/app-store-screenshots/src/lib/request-body.tsnew file mode 100644index 00000000..19814013--- /dev/null+++ b/marketing/app-store-screenshots/src/lib/request-body.ts@@ -0,0 +1,39 @@+import { NextResponse } from "next/server";++/** Bound the stream itself: Content-Length is optional and caller-controlled. */+export async function readJsonBody(req: Request, maxBytes: number): Promise<+ { value: unknown; response?: never } | { value?: never; response: NextResponse }+> {+ // The unread remainder is cancelled. Do not advertise a reusable HTTP/1+ // connection that could reset the client's next (otherwise valid) request.+ const tooLarge = () => NextResponse.json({ ok: false, error: "Request body too large" }, { status: 413, headers: { Connection: "close" } });+ if (Number(req.headers.get("content-length")) > maxBytes) return { response: tooLarge() };+ const reader = req.body?.getReader();+ if (!reader) return { response: NextResponse.json({ ok: false, error: "Invalid JSON" }, { status: 400 }) };+ try {+ const chunks: Uint8Array[] = [];+ let length = 0;+ for (;;) {+ const { done, value } = await reader.read();+ if (done) break;+ length += value.byteLength;+ if (length > maxBytes) {+ void reader.cancel().catch(() => undefined);+ return { response: tooLarge() };+ }+ chunks.push(value);+ }+ return { value: JSON.parse(Buffer.concat(chunks).toString("utf8")) };+ } catch {+ return { response: NextResponse.json({ ok: false, error: "Invalid JSON" }, { status: 400 }) };+ } finally {+ reader.releaseLock();+ }+}++export function decodeBase64(value: string): Buffer | null {+ // Buffer.from silently ignores invalid characters and truncated quartets.+ if (!value || value.length % 4 !== 0 || !/^[A-Za-z0-9+/]*={0,2}$/.test(value)) return null;+ const bytes = Buffer.from(value, "base64");+ return bytes.toString("base64") === value ? bytes : null;+}diff --git a/marketing/app-store-screenshots/src/lib/request-guard.ts b/marketing/app-store-screenshots/src/lib/request-guard.tsnew file mode 100644index 00000000..b505c152--- /dev/null+++ b/marketing/app-store-screenshots/src/lib/request-guard.ts@@ -0,0 +1,49 @@+/** Disk writes require JSON and the editor's own origin. Headerless CLI+ * requests remain supported; these checks do not provide network authentication. */+export type GuardFailure = { error: string; status: number };++/**+ * Returns a failure to respond with, or null when the request is allowed.+ * Call at the top of every route handler that writes to disk.+ */+export function rejectCrossSiteWrite(req: Request): GuardFailure | null {+ // 1. Content-Type must be application/json. Not CORS-simple, so a+ // cross-origin caller is forced into a preflight that fails.+ const contentType = req.headers.get("content-type") || "";+ if (contentType.toLowerCase().split(";")[0].trim() !== "application/json") {+ return { error: "Content-Type must be application/json", status: 415 };+ }++ // 2. Another local app (including a different port) is a different origin.+ const origin = req.headers.get("origin");+ // Next can canonicalize req.url to localhost even when the browser used+ // 127.0.0.1 or a LAN address. Host is the browser's actual request authority.+ const target = new URL(req.url);+ target.host = req.headers.get("host") || target.host;+ if (origin && origin !== target.origin) {+ return { error: "Cross-origin write rejected", status: 403 };+ }++ // 3. Sec-Fetch-Site, when present, must not be cross-site.+ const site = req.headers.get("sec-fetch-site");+ if (site && site !== "same-origin" && site !== "none") {+ return { error: "Cross-site write rejected", status: 403 };+ }++ return null;+}++/** Magic-byte sniff. Returns the real type, or null if it is neither. */+export function sniffImageType(bytes: Buffer): "image/png" | "image/jpeg" | null {+ if (+ bytes.length >= 8 &&+ bytes[0] === 0x89 && bytes[1] === 0x50 && bytes[2] === 0x4e && bytes[3] === 0x47 &&+ bytes[4] === 0x0d && bytes[5] === 0x0a && bytes[6] === 0x1a && bytes[7] === 0x0a+ ) {+ return "image/png";+ }+ if (bytes.length >= 3 && bytes[0] === 0xff && bytes[1] === 0xd8 && bytes[2] === 0xff) {+ return "image/jpeg";+ }+ return null;+}diff --git a/marketing/app-store-screenshots/src/lib/serve-asset.ts b/marketing/app-store-screenshots/src/lib/serve-asset.tsnew file mode 100644index 00000000..908ae57b--- /dev/null+++ b/marketing/app-store-screenshots/src/lib/serve-asset.ts@@ -0,0 +1,21 @@+import { promises as fs } from "node:fs";+import path from "node:path";+import { NextResponse } from "next/server";++/** Next's production public-file index excludes uploads created after startup. */+export async function serveAsset(directory: string, filename: string, types: Record<string, string>) {+ const match = /^[a-f0-9]{16}\.([a-z0-9]+)$/.exec(filename);+ if (!match || !Object.hasOwn(types, match[1])) return new NextResponse(null, { status: 404 });+ try {+ const bytes = await fs.readFile(path.join(process.cwd(), "public", directory, filename));+ return new NextResponse(new Uint8Array(bytes), { headers: {+ "Content-Type": types[match[1]],+ "Content-Length": String(bytes.length),+ "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: "Asset could not be read" }, { status: 500 });+ }+}diff --git a/marketing/app-store-screenshots/src/lib/storage.ts b/marketing/app-store-screenshots/src/lib/storage.tsnew file mode 100644index 00000000..64127dcd--- /dev/null+++ b/marketing/app-store-screenshots/src/lib/storage.ts@@ -0,0 +1,414 @@+"use client";+import { useCallback, useEffect, useRef, useState } from "react";+import { DEFAULT_SCREENSHOT_FONT_ID, PROJECT_SCHEMA_VERSION, SCREENSHOT_FONTS, STORAGE_KEY } from "./constants";+import { cleanHexColor } from "./clean-hex-color";+import { cleanImportedFont } from "./clean-imported-font";+import { DEFAULT_PROJECT } from "./defaults";+import { coerceLocalized } from "./locale";+import { projectValidationError } from "./project-validation";+import { cleanTypography } from "./typography";+import type { Device, ElementTransform, ImageElement, ProjectState, ScreenshotFontId, Slide, TextElement } from "./types";++const HISTORY_LIMIT = 50;+// Coalesce rapid edits (typing, slider drags) into a single undo step.+const COALESCE_MS = 500;+// Debounce file/localStorage writes — frequent enough to feel instant, infrequent enough not to thrash disk.+const SAVE_DEBOUNCE_MS = 600;++function cleanTransform(value: unknown): ElementTransform | undefined {+ if (!value || typeof value !== "object") return undefined;+ const raw = value as Partial<ElementTransform>;+ const required = [raw.x, raw.y, raw.width, raw.height];+ if (!required.every((n) => typeof n === "number" && Number.isFinite(n))) return undefined;+ return {+ x: raw.x!,+ y: raw.y!,+ width: Math.max(1, raw.width!),+ height: Math.max(1, raw.height!),+ ...(typeof raw.rotation === "number" && Number.isFinite(raw.rotation)+ ? { rotation: raw.rotation }+ : {}),+ ...(typeof raw.zIndex === "number" && Number.isFinite(raw.zIndex)+ ? { zIndex: raw.zIndex }+ : {}),+ };+}++function cleanTextElement(value: unknown): TextElement | undefined {+ if (!value || typeof value !== "object") return undefined;+ const raw = value as Partial<TextElement>;+ if (typeof raw.id !== "string" || !raw.id.trim()) return undefined;+ const transform = cleanTransform(raw.transform);+ if (!transform) return undefined;+ return {+ id: raw.id,+ text: coerceLocalized(raw.text as unknown),+ transform,+ ...(typeof raw.fontSize === "number" && Number.isFinite(raw.fontSize)+ ? { fontSize: raw.fontSize }+ : {}),+ ...(typeof raw.fontWeight === "number" && Number.isFinite(raw.fontWeight)+ ? { fontWeight: raw.fontWeight }+ : {}),+ ...(typeof raw.color === "string" ? { color: raw.color } : {}),+ ...(raw.align === "left" || raw.align === "center" || raw.align === "right"+ ? { align: raw.align }+ : {}),+ };+}++function cleanImageElement(value: unknown): ImageElement | undefined {+ if (!value || typeof value !== "object") return undefined;+ const raw = value as Partial<ImageElement>;+ if (typeof raw.id !== "string" || !raw.id.trim() || typeof raw.src !== "string") return undefined;+ const transform = cleanTransform(raw.transform);+ if (!transform) return undefined;+ return {+ id: raw.id,+ src: raw.src,+ transform,+ ...(raw.fit === "cover" || raw.fit === "contain" ? { fit: raw.fit } : {}),+ ...(raw.fade &&+ typeof raw.fade === "object" &&+ ["top", "bottom", "left", "right"].includes(raw.fade.edge as string) &&+ typeof raw.fade.amount === "number" &&+ Number.isFinite(raw.fade.amount)+ ? {+ fade: {+ edge: raw.fade.edge,+ amount: Math.max(0, Math.min(100, raw.fade.amount)),+ },+ }+ : {}),+ };+}++// Early builds had a "Classic Serif" that rendered exactly like Georgia.+const LEGACY_FONT_IDS: Record<string, ScreenshotFontId> = { "classic-serif": "template-serif" };++function cleanFontId(value: unknown, hasImportedFont: boolean): ScreenshotFontId {+ if (typeof value !== "string") return DEFAULT_SCREENSHOT_FONT_ID;+ const id = LEGACY_FONT_IDS[value] ?? value;+ if (!Object.prototype.hasOwnProperty.call(SCREENSHOT_FONTS, id)) return DEFAULT_SCREENSHOT_FONT_ID;+ // "Imported font" without a file behind it would render the fallback.+ if (id === "self-hosted" && !hasImportedFont) return DEFAULT_SCREENSHOT_FONT_ID;+ return id as ScreenshotFontId;+}++// Migrate older projects into the current schema while keeping legacy decks+// visually stable until they explicitly opt into connected canvas.+function migrateSlide(slide: Slide): Slide {+ const backgroundColor = cleanHexColor(slide.backgroundColor);+ const transforms = slide.transforms+ ? Object.fromEntries(+ Object.entries(slide.transforms)+ .map(([id, transform]) => [id, cleanTransform(transform)])+ .filter((entry): entry is [string, ElementTransform] => !!entry[1]),+ )+ : undefined;+ const textElements = Array.isArray(slide.textElements)+ ? slide.textElements.map(cleanTextElement).filter((t): t is TextElement => !!t)+ : undefined;+ const imageElements = Array.isArray(slide.imageElements)+ ? slide.imageElements.map(cleanImageElement).filter((image): image is ImageElement => !!image)+ : undefined;++ return {+ ...slide,+ label: coerceLocalized(slide.label as unknown),+ headline: coerceLocalized(slide.headline as unknown),+ typography: cleanTypography(slide.typography),+ ...(backgroundColor ? { backgroundColor } : { backgroundColor: undefined }),+ ...(transforms && Object.keys(transforms).length > 0 ? { transforms } : { transforms: undefined }),+ ...(textElements && textElements.length > 0 ? { textElements } : { textElements: undefined }),+ ...(imageElements && imageElements.length > 0 ? { imageElements } : { imageElements: undefined }),+ };+}++function mergeWithDefaults(parsed: Partial<ProjectState>): ProjectState {+ const validationError = projectValidationError(parsed);+ if (validationError) throw new Error(validationError);+ const connectedCanvas =+ typeof parsed.connectedCanvas === "boolean"+ ? parsed.connectedCanvas+ : false;+ const themeId =+ typeof parsed.themeId === "string" && parsed.themeId.trim()+ ? parsed.themeId+ : DEFAULT_PROJECT.themeId;+ const importedFont = cleanImportedFont(parsed.importedFont);+ const fontId = cleanFontId(parsed.fontId, !!importedFont);+ const slidesByDevice = parsed.slidesByDevice+ ? Object.fromEntries(+ Object.entries(parsed.slidesByDevice).map(([device, slides]) => [+ device,+ Array.isArray(slides)+ ? slides.map((slide) => {+ const migrated = migrateSlide(slide as Slide);+ // The Play Store banner deck only has one layout. Normalising+ // here (not while editing) keeps it out of undo history.+ return device === "feature-graphic" && migrated.layout !== "feature-graphic"+ ? { ...migrated, layout: "feature-graphic" as const, transforms: undefined, screenshotSecondary: undefined }+ : migrated;+ })+ : [],+ ]),+ )+ : {};+ const merged: ProjectState = {+ ...DEFAULT_PROJECT,+ ...parsed,+ schemaVersion: PROJECT_SCHEMA_VERSION,+ themeId,+ fontId,+ ...(importedFont ? { importedFont } : { importedFont: undefined }),+ connectedCanvas,+ slidesByDevice: {+ ...DEFAULT_PROJECT.slidesByDevice,+ ...slidesByDevice,+ } as ProjectState["slidesByDevice"],+ };+ // 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) {+ merged.locales = [...DEFAULT_PROJECT.locales];+ }+ if (!merged.locales.includes(merged.locale)) {+ merged.locale = merged.locales[0];+ }+ return merged;+}++function loadFromLocalStorage(): ProjectState | null {+ if (typeof window === "undefined") return null;+ try {+ const raw = window.localStorage.getItem(STORAGE_KEY);+ if (!raw) return null;+ return mergeWithDefaults(JSON.parse(raw) as Partial<ProjectState>);+ } catch {+ return null;+ }+}++async function loadFromFile(): Promise<+ { ok: true; state: ProjectState | null; revision: string | null } | { ok: false; error: string }+> {+ if (typeof window === "undefined") return { ok: false, error: "Window is not available" };+ try {+ const resp = await fetch("/api/project", { cache: "no-store", signal: AbortSignal.timeout(15000) });+ const json = (await resp.json()) as { ok: boolean; state: Partial<ProjectState> | null; error?: string };+ if (!resp.ok || !json.ok) return { ok: false, error: json.error || `HTTP ${resp.status}` };+ const revision = resp.headers.get("etag");+ if (!json.state) return { ok: true, state: null, revision };+ return { ok: true, state: mergeWithDefaults(json.state), revision };+ } catch (error) {+ return { ok: false, error: error instanceof Error ? error.message : "Project file could not be loaded" };+ }+}++function saveToLocalStorage(state: ProjectState): { ok: true } | { ok: false; error: string } {+ if (typeof window === "undefined") return { ok: true };+ try {+ window.localStorage.setItem(STORAGE_KEY, JSON.stringify(state));+ return { ok: true };+ } catch (e) {+ const msg = e instanceof Error ? e.message : String(e);+ return { ok: false, error: msg };+ }+}++async function saveToFile(state: ProjectState, revision: string | null): Promise<{ ok: true; revision: string | null } | { ok: false; error: string }> {+ try {+ const resp = await fetch("/api/project", {+ method: "POST",+ headers: { "content-type": "application/json", ...(revision ? { "if-match": revision } : {}) },+ body: JSON.stringify(state),+ signal: AbortSignal.timeout(15000),+ });+ const json = (await resp.json()) as { ok: boolean; error?: string };+ if (!resp.ok || !json.ok) return { ok: false, error: json.error || `HTTP ${resp.status}` };+ return { ok: true, revision: resp.headers.get("etag") };+ } catch (e) {+ return { ok: false, error: e instanceof Error ? e.message : String(e) };+ }+}++type Updater = ProjectState | ((prev: ProjectState) => ProjectState);++function applyUpdater(updater: Updater, prev: ProjectState): ProjectState {+ return typeof updater === "function" ? updater(prev) : updater;+}++export function useProject() {+ const [state, _setState] = useState<ProjectState>(DEFAULT_PROJECT);+ const [hydrated, setHydrated] = useState(false);+ const [fileReady, setFileReady] = useState(false);+ const [savedAt, setSavedAt] = useState<number | null>(null);+ const [saveError, setSaveError] = useState<string | null>(null);+ const timer = useRef<ReturnType<typeof setTimeout> | null>(null);+ const stateRef = useRef(state);+ const saveQueue = useRef(Promise.resolve());+ const saveRevision = useRef(0);+ const fileRevision = useRef<string | null>(null);+ const unsaved = useRef(false);+ const [retry, setRetry] = useState(0);++ // Run updates once, outside React render/updater replay. Async callbacks also+ // see the latest state before React has committed the next render.+ const commit = useCallback((next: ProjectState) => {+ stateRef.current = next;+ _setState(next);+ }, []);++ // History stacks live in refs — they don't drive any rendered UI, so+ // mutating them never needs to re-render.+ const pastRef = useRef<ProjectState[]>([]);+ const futureRef = useRef<ProjectState[]>([]);+ const lastPushAt = useRef(0);++ // Hydrate: prefer file (git-tracked) → localStorage (cache) → defaults.+ // localStorage is consulted first for instant paint, then file overwrites if present.+ useEffect(() => {+ let cancelled = false;+ const cached = loadFromLocalStorage();+ if (cached) commit(cached);++ void (async () => {+ const fromFile = await loadFromFile();+ if (cancelled) return;+ if (fromFile.ok) {+ fileRevision.current = fromFile.revision;+ if (fromFile.state) {+ commit(fromFile.state);+ } else {+ commit(DEFAULT_PROJECT);+ }+ setFileReady(true);+ } else {+ setFileReady(false);+ setSaveError(fromFile.error);+ }+ pastRef.current = [];+ futureRef.current = [];+ lastPushAt.current = 0;+ setHydrated(true);+ })();++ return () => {+ cancelled = true;+ };+ }, [commit]);++ // A refresh inside the debounce window must not silently discard edits.+ useEffect(() => {+ const warn = (event: BeforeUnloadEvent) => {+ if (!unsaved.current) return;+ event.preventDefault();+ event.returnValue = "";+ };+ window.addEventListener("beforeunload", warn);+ return () => window.removeEventListener("beforeunload", warn);+ }, []);++ // Debounced autosave to BOTH localStorage (fast, offline) and file (git-trackable).+ useEffect(() => {+ if (!hydrated || !fileReady) return;+ if (timer.current) clearTimeout(timer.current);+ const revision = ++saveRevision.current;+ setSavedAt(null);+ timer.current = setTimeout(() => {+ const localResult = saveToLocalStorage(state);+ // Serialize requests so a slow older write cannot overwrite a newer edit.+ saveQueue.current = saveQueue.current.then(async () => {+ if (revision !== saveRevision.current) return;+ const fileResult = await saveToFile(state, fileRevision.current);+ // Advance even if another edit arrived while this request was in flight.+ if (fileResult.ok) fileRevision.current = fileResult.revision;+ if (revision !== saveRevision.current) return;+ if (!fileResult.ok) {+ setSaveError(`File save failed: ${fileResult.error}`);+ } else {+ unsaved.current = false;+ setSavedAt(Date.now());+ setSaveError(localResult.ok ? null : localResult.error);+ }+ });+ }, SAVE_DEBOUNCE_MS);+ return () => {+ if (timer.current) clearTimeout(timer.current);+ };+ }, [state, hydrated, fileReady, retry]);++ // `history: false` is for navigation (device, orientation, locale): it isn't+ // an edit, so it neither takes an undo step nor clears redo. Undo still+ // restores the snapshot's device, which takes you to the deck the undone+ // edit was made on.+ const setState = useCallback((updater: Updater, options?: { history?: boolean }) => {+ const prev = stateRef.current;+ const next = applyUpdater(updater, prev);+ if (next === prev) return;+ unsaved.current = true;+ if (options?.history === false) {+ // Navigation is a boundary: edits to another deck must not coalesce.+ lastPushAt.current = 0;+ } else {+ const now = Date.now();+ if (now - lastPushAt.current > COALESCE_MS) {+ pastRef.current.push(prev);+ if (pastRef.current.length > HISTORY_LIMIT) pastRef.current.shift();+ }+ futureRef.current.length = 0;+ lastPushAt.current = now;+ }+ commit(next);+ }, [commit]);++ const undo = useCallback(() => {+ const prev = pastRef.current.pop();+ if (prev === undefined) return;+ futureRef.current.push(stateRef.current);+ unsaved.current = true;+ lastPushAt.current = 0;+ commit(prev);+ }, [commit]);++ const redo = useCallback(() => {+ const next = futureRef.current.pop();+ if (next === undefined) return;+ pastRef.current.push(stateRef.current);+ unsaved.current = true;+ lastPushAt.current = 0;+ commit(next);+ }, [commit]);++ // "Reset all devices" resets the decks only. App name, theme, font, icon and+ // especially `locales` (which has no editor UI) are project settings.+ const reset = useCallback(() => {+ setState((prev) => ({ ...prev, slidesByDevice: DEFAULT_PROJECT.slidesByDevice }));+ }, [setState]);++ const resetDevice = useCallback((device: Device) => {+ setState((prev) => ({+ ...prev,+ slidesByDevice: {+ ...prev.slidesByDevice,+ [device]: DEFAULT_PROJECT.slidesByDevice[device],+ },+ }));+ }, [setState]);++ return {+ state,+ setState,+ hydrated,+ savedAt,+ saveError,+ retrySave: fileReady ? () => setRetry((value) => value + 1) : undefined,+ reset,+ resetDevice,+ undo,+ redo,+ canUndo: pastRef.current.length > 0,+ canRedo: futureRef.current.length > 0,+ };+}diff --git a/marketing/app-store-screenshots/src/lib/types.ts b/marketing/app-store-screenshots/src/lib/types.tsnew file mode 100644index 00000000..6591c604--- /dev/null+++ b/marketing/app-store-screenshots/src/lib/types.ts@@ -0,0 +1,176 @@+export type Device =+ | "iphone"+ | "ipad"+ | "tvos"+ | "watchos"+ | "carplay"+ | "mac"+ | "android"+ | "android-7"+ | "android-10"+ | "feature-graphic";++export type Orientation = "portrait" | "landscape";++export type Platform = "ios" | "macos" | "android";++// Layouts the editor can render. Vary across slides for visual rhythm.+export type SlideLayout =+ | "hero" // centered device, headline above+ | "device-bottom" // headline top, device bottom-center+ | "device-top" // device top, headline bottom (contrast)+ | "two-devices" // back + front phones, headline above+ | "no-device" // big headline + decorative blob, no device+ | "split-landscape" // landscape tablets + Mac: caption left + device right+ | "feature-graphic"; // 1024×500 banner with icon + name + tagline++// Per-element rect in canvas pixel space. Optional rotation in degrees and zIndex.+export type ElementTransform = {+ x: number;+ y: number;+ width: number;+ height: number;+ rotation?: number;+ zIndex?: number;+};++export type BuiltInElementId = "caption" | "device" | "deviceSecondary";+export type TextElementId = `text:${string}`;+export type ImageElementId = `image:${string}`;+export type ElementId = BuiltInElementId | TextElementId | ImageElementId;++export type SelectedElement = {+ slideId: string;+ elementId: ElementId;+};++// Per-locale text keyed by locale code (e.g. "en", "de"). A locale is absent+// if the user hasn't typed anything for it; renderers fall back to en (see+// lib/locale.ts). The set of locales a project targets lives on+// ProjectState.locales.+export type LocalizedText = Partial<Record<string, string>>;++export type TextElement = {+ id: string;+ text: LocalizedText;+ transform: ElementTransform;+ fontSize?: number;+ fontWeight?: number;+ color?: string;+ align?: "left" | "center" | "right";+};++export type SlideTypography = {+ /** Uppercase label above the headline (default 1). */+ labelScale?: number;+ /** Main headline, or feature-graphic tagline (default 1). */+ headlineScale?: number;+ /** Feature graphic app name only (default 1). */+ appNameScale?: number;+};++export type ImageElement = {+ id: string;+ src: string;+ transform: ElementTransform;+ fit?: "cover" | "contain";+ fade?: {+ edge: "top" | "bottom" | "left" | "right";+ amount: number;+ };+};++export type Slide = {+ id: string;+ layout: SlideLayout;+ label: LocalizedText; // tiny uppercase caption above headline, per locale+ headline: LocalizedText; // multi-line; newlines are intentional, per locale+ screenshot: string; // path under /screenshots/ — may contain {locale}+ screenshotSecondary?: string; // for two-devices layout — may contain {locale}+ inverted?: boolean; // dark background variant+ /** Optional relative font-size scales for built-in caption text. */+ typography?: SlideTypography;+ backgroundColor?: string; // per-slide hex color override+ // Per-element overrides; when present, replaces layout default placement.+ transforms?: Partial<Record<BuiltInElementId, ElementTransform>>;+ textElements?: TextElement[];+ imageElements?: ImageElement[];+};++export type ThemeId =+ | "clean-light"+ | "dark-bold"+ | "warm-editorial"+ | "ocean-fresh"+ | "bloom-roast"+ // One preset per named style in style-prompts/ (same id as the slug).+ | "hand-drawn-editorial-tasks"+ | "retro-rubberhose-mascot"+ | "moody-curated-dating"+ | "paper-sticker-skeuomorphic"+ | "dreamy-pastel-couples"+ | "glossy-3d-kbeauty-creator"+ | "liquid-glass-aurora"+ | "swiss-grid-bold"+ | "neon-athletic-night"+ | "magazine-cover-editorial"+ | "candy-pop-social"+ | "soft-clay-wellness"+ | "midnight-glow-pro"+ | "risograph-zine"+ | "bento-keynote-grid"+ | "toybox-primary"+ | "quiet-japandi"+ | "vintage-travel-poster";++export type ScreenshotFontId =+ | "template-default"+ | "template-serif"+ | "system-sans"+ | "avenir-next"+ | "helvetica-neue"+ | "american-typewriter"+ | "baskerville"+ | "optima"+ | "palatino"+ | "futura"+ | "self-hosted";++export type ImportedFont = {+ src: string;+ format: "woff2" | "woff" | "truetype" | "opentype";+ /** Display name, taken from the uploaded file name. */+ name?: string;+};++export type Theme = {+ id: string;+ name: string;+ bg: string; // primary background+ bgAlt: string; // inverted background+ fg: string; // text on bg+ fgAlt: string; // text on bgAlt+ accent: string; // label color on bg, decorative blobs+ accentAlt?: string; // label color on bgAlt; defaults to accent+ muted: string;+ halftone?: boolean; // dot-matrix field instead of blurred blobs+};++export type ProjectState = {+ schemaVersion?: number;+ appName: string;+ themeId: string;+ fontId?: ScreenshotFontId;+ importedFont?: ImportedFont;+ // v1 projects render as isolated screens until the user opts into connected crops.+ connectedCanvas: boolean;+ // Locales this project targets. Drives the toolbar dropdown and bulk export.+ // Single-locale projects ship as ["en"] and hide the locale UI.+ locales: string[];+ locale: string;+ device: Device;+ orientation: Orientation;+ // Per-device slide decks so platform switching preserves work+ slidesByDevice: Record<Device, Slide[]>;+ appIcon?: string; // path under /public (e.g. /app-icon.png)+};diff --git a/marketing/app-store-screenshots/src/lib/typography.ts b/marketing/app-store-screenshots/src/lib/typography.tsnew file mode 100644index 00000000..590bed8f--- /dev/null+++ b/marketing/app-store-screenshots/src/lib/typography.ts@@ -0,0 +1,49 @@+import type { Slide, SlideTypography } from "./types";++/** Relative scale on layout default font sizes (1 = default). */+export const FONT_SCALE_MIN = 0.5;+export const FONT_SCALE_MAX = 2;+export const FONT_SCALE_DEFAULT = 1;++export function clampFontScale(value: number | undefined): number {+ if (typeof value !== "number" || !Number.isFinite(value)) return FONT_SCALE_DEFAULT;+ return Math.min(FONT_SCALE_MAX, Math.max(FONT_SCALE_MIN, value));+}++export function slideFontScales(slide: Slide) {+ return {+ labelScale: clampFontScale(slide.typography?.labelScale),+ headlineScale: clampFontScale(slide.typography?.headlineScale),+ appNameScale: clampFontScale(slide.typography?.appNameScale),+ };+}++/** Persist only non-default scales so JSON stays tidy. Values are clamped+ * first, so invalid or out-of-range input from a loaded project never ends up+ * stored as a no-op `1` or outside the slider range. */+export function cleanTypography(raw: SlideTypography | undefined): SlideTypography | undefined {+ if (!raw || typeof raw !== "object") return undefined;+ const out: SlideTypography = {};+ for (const key of ["labelScale", "headlineScale", "appNameScale"] as const) {+ const value = clampFontScale(raw[key]);+ if (value !== FONT_SCALE_DEFAULT) out[key] = value;+ }+ return Object.keys(out).length > 0 ? out : undefined;+}++/** Font size a free text element renders at when it has no explicit+ * `fontSize`. Shared by the canvas and the inspector so the Size control+ * always shows what is actually drawn. */+export function defaultTextElementFontSize(cW: number, cH: number): number {+ return Math.round(Math.min(cW, cH) * 0.06);+}++/** Sensible Size control range for free text elements, relative to the canvas+ * (a 422px watch face and a 3840px TV frame need very different ranges). */+export function textElementFontSizeRange(cW: number, cH: number) {+ const unit = Math.min(cW, cH);+ return {+ min: Math.max(8, Math.round(unit * 0.015)),+ max: Math.round(unit * 0.3),+ };+}diff --git a/marketing/app-store-screenshots/src/lib/utils.ts b/marketing/app-store-screenshots/src/lib/utils.tsnew file mode 100644index 00000000..a5ef1935--- /dev/null+++ b/marketing/app-store-screenshots/src/lib/utils.ts@@ -0,0 +1,6 @@+import { clsx, type ClassValue } from "clsx";+import { twMerge } from "tailwind-merge";++export function cn(...inputs: ClassValue[]) {+ return twMerge(clsx(inputs));+}diff --git a/marketing/app-store-screenshots/src/lib/write-asset.ts b/marketing/app-store-screenshots/src/lib/write-asset.tsnew file mode 100644index 00000000..7b59e3bf--- /dev/null+++ b/marketing/app-store-screenshots/src/lib/write-asset.ts@@ -0,0 +1,13 @@+import { randomUUID } from "node:crypto";+import { promises as fs } from "node:fs";++/** A concurrent upload/GET must never see a partially written asset. */+export async function writeAsset(filename: string, bytes: Buffer) {+ const temporary = `${filename}.${randomUUID()}.tmp`;+ try {+ await fs.writeFile(temporary, bytes);+ await fs.rename(temporary, filename);+ } finally {+ await fs.unlink(temporary).catch(() => undefined);+ }+}diff --git a/marketing/app-store-screenshots/tailwind.config.ts b/marketing/app-store-screenshots/tailwind.config.tsnew file mode 100644index 00000000..7fc6933b--- /dev/null+++ b/marketing/app-store-screenshots/tailwind.config.ts@@ -0,0 +1,67 @@+import type { Config } from "tailwindcss";++const config: Config = {+ darkMode: ["class"],+ content: ["./src/**/*.{ts,tsx}"],+ theme: {+ container: { center: true, padding: "2rem", screens: { "2xl": "1400px" } },+ extend: {+ colors: {+ border: "hsl(var(--border))",+ input: "hsl(var(--input))",+ ring: "hsl(var(--ring))",+ background: "hsl(var(--background))",+ foreground: "hsl(var(--foreground))",+ primary: {+ DEFAULT: "hsl(var(--primary))",+ foreground: "hsl(var(--primary-foreground))",+ },+ secondary: {+ DEFAULT: "hsl(var(--secondary))",+ foreground: "hsl(var(--secondary-foreground))",+ },+ destructive: {+ DEFAULT: "hsl(var(--destructive))",+ foreground: "hsl(var(--destructive-foreground))",+ },+ muted: {+ DEFAULT: "hsl(var(--muted))",+ foreground: "hsl(var(--muted-foreground))",+ },+ accent: {+ DEFAULT: "hsl(var(--accent))",+ foreground: "hsl(var(--accent-foreground))",+ },+ popover: {+ DEFAULT: "hsl(var(--popover))",+ foreground: "hsl(var(--popover-foreground))",+ },+ card: {+ DEFAULT: "hsl(var(--card))",+ foreground: "hsl(var(--card-foreground))",+ },+ },+ borderRadius: {+ lg: "var(--radius)",+ md: "calc(var(--radius) - 2px)",+ sm: "calc(var(--radius) - 4px)",+ },+ keyframes: {+ "accordion-down": {+ from: { height: "0" },+ to: { height: "var(--radix-accordion-content-height)" },+ },+ "accordion-up": {+ from: { height: "var(--radix-accordion-content-height)" },+ to: { height: "0" },+ },+ },+ animation: {+ "accordion-down": "accordion-down 0.2s ease-out",+ "accordion-up": "accordion-up 0.2s ease-out",+ },+ },+ },+ plugins: [require("tailwindcss-animate")],+};+export default config;diff --git a/marketing/app-store-screenshots/tsconfig.json b/marketing/app-store-screenshots/tsconfig.jsonnew file mode 100644index 00000000..d3b92a0b--- /dev/null+++ b/marketing/app-store-screenshots/tsconfig.json@@ -0,0 +1,21 @@+{+ "compilerOptions": {+ "target": "ES2022",+ "lib": ["dom", "dom.iterable", "esnext"],+ "allowJs": true,+ "skipLibCheck": true,+ "strict": true,+ "noEmit": true,+ "esModuleInterop": true,+ "module": "esnext",+ "moduleResolution": "bundler",+ "resolveJsonModule": true,+ "isolatedModules": true,+ "jsx": "react-jsx",+ "incremental": true,+ "plugins": [{ "name": "next" }],+ "paths": { "@/*": ["./src/*"] }+ },+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", ".next/dev/types/**/*.ts"],+ "exclude": ["node_modules"]+}