# Extension Plan: Canva Interop (Import MVP Projects into Canva) ## CI-0. Interop requirements lock - CI-0.1 Define “Canva-compatible export” modes - CI-0.1.1 Mode A (manual): user downloads `.pptx` / `.pdf` and uploads to Canva - CI-0.1.2 Mode B (direct): “Send to Canva” via Canva Connect Design Import API ([canva.dev](https://www.canva.dev/docs/connect/api-reference/design-imports/)) - CI-0.2 Set primary export target - CI-0.2.1 Primary: **PPTX** - CI-0.2.2 Secondary: **PDF** - CI-0.3 Define supported MVP element set for “editable-in-Canva” guarantee - CI-0.3.1 Text (single box, no path text) - CI-0.3.2 Shapes (rect/roundrect/ellipse/line) - CI-0.3.3 Images (placed + cropped) - CI-0.3.4 Groups (flatten to children for export unless grouping supported) - CI-0.3.5 Background (solid color or image) - CI-0.4 Define “flattening policy” (auto-rasterize unsupported features) - CI-0.4.1 Effects: blur, complex shadows, blend modes → rasterize element - CI-0.4.2 Gradients/pattern fills → rasterize element (unless verified editable) - CI-0.4.3 Masks/frames → rasterize masked result - CI-0.5 Create a fixed “Canva Import Compatibility Test Pack” document - CI-0.5.1 1 page: text styling matrix - CI-0.5.2 1 page: shapes matrix - CI-0.5.3 1 page: images + crop matrix - CI-0.5.4 1 page: layering + transparency matrix - CI-0.5.5 1 page: mixed stress test (50+ objects) ## CI-1. “Export for Canva” UX + preflight - CI-1.1 Add Export entry point - CI-1.1.1 Top bar: **Export → Export for Canva** - CI-1.1.2 Options: **PPTX (recommended)**, **PDF** - CI-1.2 Add export settings panel - CI-1.2.1 Pages: current page / all pages - CI-1.2.2 Scale: 1x / 2x - CI-1.2.3 Text handling: “Keep text editable” (default on) - CI-1.2.4 Fallback: “Rasterize text” (toggle) - CI-1.2.5 Flattening: “Auto-flatten unsupported features” (default on) - CI-1.2.6 Font substitution policy: “Use Canva-safe fonts” (toggle) - CI-1.3 Implement export preflight scanner (runs before file generation) - CI-1.3.1 Traverse document model and collect unsupported features, fonts, images, counts - CI-1.3.2 Preflight report: editable list, flattened list (ids), layout warnings - CI-1.3.3 Controls: Continue / Cancel / “Export with more flattening” - CI-1.4 Export delivery options - CI-1.4.1 Download file - CI-1.4.2 (Optional, if CI-5 enabled) Send to Canva ## CI-2. PPTX export engine (primary) - CI-2.1 Package `packages/export-pptx` - `exportPptx(doc, options) -> Uint8Array` - `preflightPptx(doc) -> Report` - `mapFonts(fonts) -> FontMap` - CI-2.2 Geometry/units - Choose DPI (e.g., 96); helpers `pxToIn/pxToPt/pxToEmu` - Slide sizing: presets → layout; custom sizes supported - Rotation around center; bbox matches selection - CI-2.3 Element mapping - Background: solid or image as base layer - Shapes: rect/roundrect/ellipse/line; stroke/fill; opacity else flatten - Text: textbox, map font/size/color/align/lineHeight; warn letterSpacing; rotation ok - Images: embed bytes; native crop if supported else bake; opacity else bake - Groups: flatten to children with composed transforms - Z-order: ascending z; background first - CI-2.4 Font strategy - Canva-safe font list; fallback map; warn missing fonts; option to rasterize all text - CI-2.5 QA - Unit tests: conversions, transforms, z-order - Golden exports from CI-0.5 pack (property assertions) - Manual Canva import checklist; target ≥95% editable (excluding intentional flatten) ## CI-3. PDF export engine (secondary) - CI-3.1 Package `packages/export-pdf` - `exportPdf(doc, options) -> Uint8Array` - `preflightPdf(doc) -> Report` - CI-3.2 Rendering strategies (flagged) - Vector-first: draw shapes/text/images directly - Browser-rendered: headless print of HTML/SVG/canvas - CI-3.3 Multi-page sizing: per-page PDFs, exact dims, optional bleed/trim - CI-3.4 Canva editability checklist: keep text vector, flatten risky constructs, warn - CI-3.5 QA: run CI-0.5 pack; verify editability on Canva import ## CI-4. Compatibility mode + mapping rules - CI-4.1 Document-level “Canva Compatibility Mode” - Disable/flag unsupported effects; enforce safe fonts/solid fills; auto-flatten - CI-4.2 Element-level rules (must have tests) - Text: single-style runs; letter spacing/shadows flatten or warn - Shapes: solid fills; normalize unsupported strokes; gradients flatten - Images: native crop or bake; masks flatten - Transforms: rotation ok; skew flatten - Blending: per-element opacity if supported; blend modes flatten - CI-4.3 Import fidelity score - Score from preflight (% editable, % flattened, font subs); gate releases on threshold ## CI-5. Direct “Send to Canva” (optional) - CI-5.1 Canva app + OAuth (scope `design:content:write`) - CI-5.2 Backend endpoints: `POST /canva/import/start`, `GET /canva/import/status` - CI-5.3 Call Canva Design Import API (`POST /rest/v1/imports`, job polling) - CI-5.4 Frontend flow: Export modal “Send to Canva”, progress states, “Open in Canva”, persist doc↔design id ## CI-6. Release checklist (interop) - Docs: best-practices + supported vs flattened list - Regression: CI-0.5 pack exports on every release; invariants checked - Telemetry: export success/fail by format, preflight warnings, (if CI-5) import job latency/success