Skip to content

Canvix — Free & open-source graphic design tool. A community-built Canva alternative with a drag-and-drop editor, templates, shapes, text, images & one-click export. Works on desktop, tablet & mobile.

feat(v0.7.0): fast & free forever — rendering performance, 60-template premium collection, free-forever promise

Ashiq Hussain Mir93a8504fd85b
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 17967d8..6cba1bd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,74 @@
All notable changes to Canvix will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
+## [0.7.0] — 2026-10-28
+
+The "Fast & Free Forever" release: the canvas rendering hot path is rebuilt
+(structural sharing, memoized nodes, O(1) history), the template library
+nearly triples to 60 — and the project formally commits to staying
+**100% free forever**: no subscriptions, no paywalls, no locked features.
+
+### Rendering performance
+- **Structural sharing in the editor store** (`src/store/editor-store.ts`) —
+ every mutation (typing, slider drags, align/flip, group/ungroup, remote
+ `applyRemoteOp`, MCP live edits) now performs immutable updates that give
+ new identities *only* to the touched page/elements; untouched objects keep
+ their references. The old code deep-cloned the whole `pages` tree via
+ `structuredClone` on every keystroke. Result: a live edit re-renders exactly
+ one `ElementNode` instead of every node on the canvas.
+- **O(1) undo/redo history** — since pages are never mutated in place any
+ more, history snapshots are plain references (Immer-style structural
+ sharing, zero dependencies). `pushHistory` no longer clones the document;
+ a 60-entry history of a large design costs a fraction of the old memory.
+- **Memoized canvas nodes** (`element-node.tsx`) — `ElementNode` no longer
+ subscribes to the entire editor store (it reads actions at event time via
+ `getState()`), is wrapped in `React.memo`, gets a stable node-ref callback,
+ and `CanvasStage` passes stable handler props — selection changes, panel
+ toggles, collaborator cursors and remote typing no longer re-render any
+ shape they don't affect.
+- **Split Konva layers** (`CanvasStage.tsx`) — interaction chrome (transformer,
+ snap guides, manual ruler guides, marquee, freehand draft) moved to a second
+ `<Layer>`: dragging with snapping active repaints only the overlay canvas,
+ and content edits never repaint the chrome.
+- **Snap-guide equality guard** — `handleDragMoveNode` compares guide sets by
+ value and skips `setGuides` when nothing visibly changed (previously every
+ mousemove created a fresh array and re-rendered the tree).
+- **Shared image cache** (`use-loaded-image.ts`) — module-level cache keyed by
+ URL with in-flight dedup, negative caching of failures and a bounded
+ ~300-entry eviction. Images decode once per URL instead of once per mount.
+- **`perfectDrawEnabled: false`** on element nodes — skips Konva's hit-canvas
+ "perfect draw" pass during drag/transform.
+- **Lazy template thumbnails** (`TemplatesPanel.tsx`) — preview stages mount
+ via `IntersectionObserver` with a 300 px pre-roll; cards are memoized. The
+ 60-template panel only pays canvas cost for visible cards.
+- **Regression-locked** — new `src/store/editor-store.test.ts` (5 tests)
+ asserts the identity invariants: patched-only new identities, untouched
+ pages/elements keep references, history shares structure, snapshots never
+ mutate in place, remote ops preserve untouched pages.
+
+### Premium template collection — all free (21 → 60)
+- 39 new templates across every category, each with real copy, considered
+ typography and Canva-grade layouts: **social** (flash-sale story, minimal
+ quote, trattoria special, open house, bootcamp, webinar announcement,
+ podcast cover, birthday story, wanderlust story, LinkedIn banner),
+ **presentation** (pitch deck noir 2-pager, quarterly report, webinar 101,
+ course welcome, product roadmap timeline, meet the team),
+ **print** (neon gig poster, charity gala flyer, artisan cafe menu, spa
+ voucher, open-house yard sign, luxe dark card, wedding thank-you, tear-off
+ coupon), **document** (project proposal, community newsletter, ebook cover,
+ tech whitepaper, press release, meeting agenda, studio invoice, case
+ study), **thumbnail** (gaming, tutorial, podcast episode, unboxing) and
+ **logo** (orbit tech, bloom cafe, apex fitness).
+- `TemplateDef.badge` ('premium' | 'new') is a **quality label only** — the
+ templates panel shows a "Premium collection · free forever" section and
+ premium chips on cards; nothing is ever gated.
+- DB re-seeded (60 templates upserted by slug).
+
+### Free forever — formalized
+- README gains a "Free forever — the promise" section: every feature, every
+ template, every export is free; no Pro tier, no trials, no watermarks,
+ ever. This is a project principle, not a launch promotion.
+
## [0.6.1] — 2026-10-28
Hardening & hygiene release: closes a real SSRF bypass in the MCP image
diff --git a/README.md b/README.md
index 26382f4..2caa925 100644
--- a/README.md
+++ b/README.md
@@ -23,13 +23,76 @@ Free & open-source graphic design tool — a community-built [Canva](https://can
## ✨ What is Canvix?
Canvix is a browser-based design tool that lets anyone create social media posts,
-presentations, posters, logos and thumbnails — with a drag-and-drop editor, a template
-library and one-click export. It runs entirely on your own infrastructure, stores designs
+presentations, posters, logos and thumbnails — with a drag-and-drop editor, a
+60-template library and one-click export. It runs entirely on your own infrastructure, stores designs
in your own database, and exports files locally in your browser. No accounts, no
watermarks, no paywalls.
+## 🆓 Free forever — the promise
+
+**Every feature in Canvix is free, and it stays free. Forever.** There is no
+Pro tier, no subscription, no trial countdown, no watermark ransom, no
+"premium" element you can drag but not drop. The whole point of this project
+is a design tool that never asks you for a credit card:
+
+- All **60 templates** — including the entire premium collection — are free
+- All **exports** (PNG, JPG, SVG, PDF, video) are free and unwatermarked
+- All **AI features** (magic edit, magic write, background removal, translate)
+ run against your own API keys, so there is nothing for us to meter
+- **Self-hosting** is first-class: your server, your database, your rules
+- The license is **MIT** — you can even fork it and build a business on it
+
+If anyone ever asks you to pay for Canvix, you are being scammed: the source
+is right here.
+
## 🎨 Features
+### v0.7.0 — Fast & Free Forever: rendering performance & the premium template collection
+
+- **Rendering performance** — the canvas was rebuilt around three classic
+ hot-path killers, and every one is gone:
+ - **Structural sharing in the editor store** — every mutation now builds
+ only the pages/elements it actually touches; untouched objects keep their
+ identity. A keystroke, a slider drag or a remote/AI live edit re-renders
+ exactly **one** canvas node instead of the whole scene, and deep-cloning
+ the entire document per edit is history
+ - **O(1) undo/redo** — history snapshots now share structure with live state
+ (like Immer, without Immer): pushing history is a reference copy, and a
+ 60-step history of a large design costs a fraction of the old memory
+ - **Memoized canvas nodes** — `ElementNode` no longer subscribes to the whole
+ store (it reads actions at event time via `getState()`), is wrapped in
+ `React.memo`, and receives stable callbacks — so selection changes, panel
+ toggles and remote cursors don't re-render a single shape
+ - **Split Konva layers** — interaction chrome (transformer, snap guides,
+ marquee, ruler guides, draw preview) moved to its own `<canvas>` layer:
+ dragging an element no longer repaints the chrome, and guide updates no
+ longer repaint the artwork
+ - **Snap-guide equality guard** — identical guide sets don't trigger a React
+ render; snapping during drag only redraws when something visibly changed
+ - **Shared image cache** — images decode once per URL and are reused across
+ pages, thumbnails and duplicated nodes (with in-flight dedup and a bounded
+ 300-entry LRU)
+ - **`perfectDrawEnabled: false`** on element nodes — skips Konva's
+ hit-canvas perfection pass during drag/transform for a big interactive win
+ - **Lazy template thumbnails** — preview stages mount via
+ IntersectionObserver (300 px pre-roll), so scrolling the 60-template
+ library stays smooth; only visible cards own a canvas
+ - Locked in by tests: `src/store/editor-store.test.ts` asserts the identity
+ guarantees (untouched pages/elements keep references, history shares
+ structure, snapshots are never mutated in place)
+- **The premium template collection — all free** — 39 new templates (21 → 60),
+ every one designed to Canva-grade quality and every one unlocked:
+ social (flash sale story, trattoria, open house, bootcamp, webinar, podcast
+ cover, birthday story, wanderlust, LinkedIn banner, minimal quote),
+ presentations (pitch deck noir, quarterly report, webinar deck, course
+ welcome, roadmap, meet-the-team), print (neon gig poster, charity gala,
+ artisan menu, spa voucher, yard sign, luxe card, wedding thank-you, coupon),
+ documents (proposal, newsletter, ebook cover, whitepaper, press release,
+ meeting agenda, studio invoice, case study), thumbnails (gaming, tutorial,
+ podcast episode, unboxing) and logos (orbit, bloom, apex). The templates
+ panel gets a "Premium collection · free forever" section — premium is a
+ quality label here, never a paywall
+
### v0.6.0 — the Agent Edition: MCP, tables, frames, curved text & embeds
- **MCP server (Model Context Protocol)** — Canvix becomes an **agent-native design platform**:
@@ -477,6 +540,7 @@ tool descriptions so agents pick the right format.
- [x] Magic Suite: AI image editing, Magic Resize, Translate, PostgreSQL *(v0.4.0)*
- [x] Magic Layers, real-time collaboration, comments, animations, SVG & video export, AI Assistant 2.0 *(v0.5.0)*
- [x] MCP server (20 agent tools), tables, frames, curved text, embed cards *(v0.6.0)*
+- [x] Rendering performance (structural sharing, memoized nodes, O(1) undo) & the 60-template premium collection, free forever *(v0.7.0)*
- [ ] Accounts & per-design ownership (identity layer groundwork shipped in v0.5)
- [ ] Yjs-grade offline merge for collaboration
- [ ] Audio/video elements & Beat Sync
diff --git a/package.json b/package.json
index 993964f..980f58d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "canvix",
- "version": "0.6.1",
+ "version": "0.7.0",
"private": false,
"description": "Canvix — free & open-source graphic design tool. A community-built Canva alternative.",
"scripts": {
diff --git a/src/components/editor/canvas/CanvasStage.tsx b/src/components/editor/canvas/CanvasStage.tsx
index 4315294..4daa348 100644
--- a/src/components/editor/canvas/CanvasStage.tsx
+++ b/src/components/editor/canvas/CanvasStage.tsx
@@ -62,6 +62,8 @@ export default function CanvasStage() {
const [containerSize, setContainerSize] = useState({ w: 0, h: 0 })
const [pan, setPan] = useState({ x: 0, y: 0 })
const [guides, setGuides] = useState<GuideLine[]>([])
+ /** v0.7: mirror of `guides` for cheap equality checks during drag */
+ const guidesRef = useRef<GuideLine[]>([])
const [editingTextId, setEditingTextId] = useState<string | null>(null)
/** v0.6: table cell being edited via the overlay ({ id, row, col }) */
const [editingCell, setEditingCell] = useState<{ id: string; row: number; col: number } | null>(null)
@@ -246,7 +248,23 @@ export default function CanvasStage() {
node.x(node.x() + dx)
node.y(node.y() + dy)
}
- setGuides(g)
+ // v0.7: only re-render when the visible guides actually changed — a new
+ // array with identical values used to re-render the whole canvas per frame.
+ const prev = guidesRef.current
+ const same =
+ prev.length === g.length &&
+ prev.every((pg, i) => pg.axis === g[i].axis && pg.position === g[i].position)
+ if (!same) {
+ guidesRef.current = g
+ setGuides(g)
+ }
+ }, [])
+
+ // v0.7: stable callback passed to the memoized ElementNodes — an inline
+ // closure here would defeat React.memo on every canvas re-render.
+ const handleDragEndNode = useCallback(() => {
+ guidesRef.current = []
+ setGuides([])
}, [])
// ── text editing ───────────────────────────────────────────
@@ -714,12 +732,19 @@ export default function CanvasStage() {
interactive={interactive}
registerNode={registerNode}
onDragMoveNode={handleDragMoveNode}
- onDragEndNode={() => setGuides([])}
+ onDragEndNode={handleDragEndNode}
onDoubleClick={startEditText}
hiding={editingTextId === el.id}
hideCell={editingCell && editingCell.id === el.id ? { row: editingCell.row, col: editingCell.col } : null}
/>
))}
+ </Group>
+ </Layer>
+ {/* v0.7 rendering performance: interaction chrome lives in its own
+ layer (its own <canvas>) — guide/marquee/transformer updates no
+ longer re-draw the content layer, and vice versa. */}
+ <Layer>
+ <Group x={pan.x} y={pan.y} scaleX={zoom} scaleY={zoom}>
<Transformer
ref={trRef}
keepRatio
diff --git a/src/components/editor/canvas/element-node.tsx b/src/components/editor/canvas/element-node.tsx
index 3c975b4..51cff28 100644
--- a/src/components/editor/canvas/element-node.tsx
+++ b/src/components/editor/canvas/element-node.tsx
@@ -1,7 +1,7 @@
'use client'
import Konva from 'konva'
-import { useCallback, useEffect, useRef } from 'react'
+import { memo, useCallback, useEffect, useMemo, useRef } from 'react'
import { Ellipse, Group, Image as KonvaImage, Line, Path, Rect, Star, Text } from 'react-konva'
import type { KonvaEventObject } from 'konva/lib/Node'
import type {
@@ -126,14 +126,20 @@ function ImageNode({ el, common }: { el: ImageElement; common: Record<string, un
)
}
-export function ElementNode({ element: el, interactive, hiding, hideCell, registerNode, onDragMoveNode, onDragEndNode, onDoubleClick, nested }: ElementNodeProps) {
- const store = useEditorStore()
+function ElementNodeImpl({ element: el, interactive, hiding, hideCell, registerNode, onDragMoveNode, onDragEndNode, onDoubleClick, nested }: ElementNodeProps) {
+ // v0.7 rendering performance: this component no longer subscribes to the
+ // editor store. Store actions are read at event time via getState(), and
+ // the component is memoized (see bottom of file) — it re-renders only when
+ // its own element changes identity. Combined with structural sharing in
+ // the store, a keystroke or remote live edit re-renders exactly ONE node
+ // instead of the whole canvas.
// ── shared interaction handlers ────────────────────────────
const handleClick = (e: KonvaEventObject<MouseEvent | TouchEvent>) => {
if (!interactive) return
e.cancelBubble = true
const additive = !!e.evt && 'shiftKey' in e.evt && (e.evt as MouseEvent).shiftKey
+ const store = useEditorStore.getState()
if (additive) {
store.selectToggle(el.id)
} else {
@@ -143,6 +149,7 @@ export function ElementNode({ element: el, interactive, hiding, hideCell, regist
const handleDragStart = () => {
if (!interactive) return
+ const store = useEditorStore.getState()
store.pushHistory()
store.setSelection([el.id])
}
@@ -155,6 +162,7 @@ export function ElementNode({ element: el, interactive, hiding, hideCell, regist
const handleDragEnd = (node: Konva.Node) => {
if (!interactive) return
+ const store = useEditorStore.getState()
if (el.type === 'group') {
// bake drag delta into children so ungroup restores the moved positions
const g = el as GroupElement
@@ -176,12 +184,14 @@ export function ElementNode({ element: el, interactive, hiding, hideCell, regist
const handleTransformStart = () => {
if (!interactive) return
+ const store = useEditorStore.getState()
store.pushHistory()
store.setSelection([el.id])
}
const handleTransformEnd = (node: Konva.Node) => {
if (!interactive) return
+ const store = useEditorStore.getState()
const sx = Math.abs(node.scaleX())
const sy = Math.abs(node.scaleY())
// restore flip sign for images (transformer resets scale)
@@ -277,6 +287,12 @@ export function ElementNode({ element: el, interactive, hiding, hideCell, regist
store.updateElementsLive([el.id], patch)
}
+ // stable node ref (avoids re-register churn on every render)
+ const setNodeRef = useCallback(
+ (node: Konva.Node | null) => registerNode?.(el.id, node),
+ [registerNode, el.id]
+ )
+
const common = {
id: el.id,
name: 'cv-element',
@@ -286,6 +302,9 @@ export function ElementNode({ element: el, interactive, hiding, hideCell, regist
opacity: el.opacity,
visible: el.visible && !hiding,
draggable: interactive && !el.locked,
+ // v0.7: skip Konva's "perfect draw" hit-canvas pass — big win while
+ // dragging/transforming, no visible change for our node types.
+ perfectDrawEnabled: false,
onClick: handleClick,
onTap: handleClick,
onDragStart: handleDragStart,
@@ -298,7 +317,7 @@ export function ElementNode({ element: el, interactive, hiding, hideCell, regist
onTransformEnd: (e: KonvaEventObject<Event>) => handleTransformEnd(e.target),
onDblClick: () => interactive && onDoubleClick?.(el.id),
onDblTap: () => interactive && onDoubleClick?.(el.id),
- ref: (node: Konva.Node | null) => registerNode?.(el.id, node),
+ ref: setNodeRef,
...shadowProps(el),
}
@@ -512,8 +531,15 @@ export function ElementNode({ element: el, interactive, hiding, hideCell, regist
}
}
+/**
+ * v0.7 rendering performance: memoized canvas element node. With structural
+ * sharing in the editor store, untouched elements keep referential identity,
+ * so a mutation re-renders only the nodes whose elements actually changed.
+ */
+export const ElementNode = memo(ElementNodeImpl)
+
/** non-interactive renderer used inside thumbnails / previews */
-export function PreviewElements({ elements }: { elements: AnyElement[] }) {
+export const PreviewElements = memo(function PreviewElements({ elements }: { elements: AnyElement[] }) {
const reg = useCallback(() => undefined, [])
return (
<Group listening={false}>
@@ -522,4 +548,4 @@ export function PreviewElements({ elements }: { elements: AnyElement[] }) {
))}
</Group>
)
-}
+})
diff --git a/src/components/editor/canvas/use-loaded-image.ts b/src/components/editor/canvas/use-loaded-image.ts
index 619c8e6..1b53051 100644
--- a/src/components/editor/canvas/use-loaded-image.ts
+++ b/src/components/editor/canvas/use-loaded-image.ts
@@ -2,18 +2,77 @@
import { useEffect, useState } from 'react'
-/** Loads an HTMLImageElement for use inside Konva. Supports dataURLs and CORS-friendly URLs. */
+// ── v0.7 rendering performance: shared image cache ────────────
+// Module-level cache so images decode once per URL, no matter how many
+// nodes mount/unmount them (page switching, thumbnails, duplicated images).
+// In-flight loads are deduplicated; failures are remembered (negative cache)
+// so a broken URL can't re-trigger a request loop on every render.
+
+interface CacheEntry {
+ image: HTMLImageElement | null
+ ready: boolean
+ listeners: Set<(image: HTMLImageElement | null) => void>
+}
+
+const cache = new Map<string, CacheEntry>()
+
+function load(src: string): CacheEntry {
+ let entry = cache.get(src)
+ if (entry) return entry
+ entry = { image: null, ready: false, listeners: new Set() }
+ cache.set(src, entry)
+
+ const img = new window.Image()
+ img.crossOrigin = 'anonymous'
+ const settle = (image: HTMLImageElement | null) => {
+ const e = cache.get(src)
+ if (!e) return
+ e.image = image
+ e.ready = true
+ for (const fn of e.listeners) fn(image)
+ e.listeners.clear()
+ // keep at most ~300 decoded images; drop the oldest entries
+ if (cache.size > 300) {
+ const oldest = cache.keys().next().value
+ if (oldest !== undefined && oldest !== src) cache.delete(oldest)
+ }
+ }
+ img.onload = () => settle(img)
+ img.onerror = () => settle(null)
+ img.src = src
+ return entry
+}
+
+/** Loads an HTMLImageElement for use inside Konva. Supports dataURLs and
+ * CORS-friendly URLs. Results are cached per URL across the whole app. */
export function useLoadedImage(src?: string): HTMLImageElement | null {
- const [loaded, setLoaded] = useState<{ src: string; image: HTMLImageElement } | null>(null)
+ const [image, setImage] = useState<HTMLImageElement | null>(() => {
+ if (!src) return null
+ const entry = cache.get(src)
+ return entry?.ready ? entry.image : null
+ })
useEffect(() => {
- if (!src) return
- const img = new window.Image()
- img.crossOrigin = 'anonymous'
- img.onload = () => setLoaded({ src, image: img })
- img.onerror = () => setLoaded(null)
- img.src = src
+ if (!src) {
+ setImage(null)
+ return
+ }
+ const entry = load(src)
+ if (entry.ready) {
+ setImage(entry.image)
+ return
+ }
+ // still loading — subscribe
+ let alive = true
+ const listener = (img: HTMLImageElement | null) => {
+ if (alive) setImage(img)
+ }
+ entry.listeners.add(listener)
+ return () => {
+ alive = false
+ entry.listeners.delete(listener)
+ }
}, [src])
- return loaded && loaded.src === src ? loaded.image : null
+ return image
}
diff --git a/src/components/editor/panels/TemplatesPanel.tsx b/src/components/editor/panels/TemplatesPanel.tsx
index 1e201e5..922b715 100644
--- a/src/components/editor/panels/TemplatesPanel.tsx
+++ b/src/components/editor/panels/TemplatesPanel.tsx
@@ -1,7 +1,7 @@
'use client'
-import { useEffect, useMemo, useState } from 'react'
-import { Search, Sparkles, Clock, X, Check } from 'lucide-react'
+import { memo, useEffect, useMemo, useRef, useState } from 'react'
+import { Search, Sparkles, Clock, X, Check, Gem, BadgeCheck } from 'lucide-react'
import { TEMPLATES, type TemplateDef } from '@/lib/templates'
import { useEditorStore } from '@/store/editor-store'
import { DesignPreview } from '@/components/design-preview'
@@ -34,6 +34,8 @@ export function TemplatesPanel() {
)
const recommended = useMemo(() => TEMPLATES.slice(0, 4), [])
+ const premiumList = useMemo(() => list.filter((t) => t.badge === 'premium'), [list])
+ const hasPremiumSection = !query && category === 'all'
const designHasContent = pages.some((p) => p.elements.length > 0)
@@ -45,7 +47,13 @@ export function TemplatesPanel() {
return (
<div className="flex flex-col h-full bg-[#16181D] text-[#EDEEF2]">
<div className="px-4 pt-4 pb-3 border-b border-white/[0.07] shrink-0">
- <h3 className="font-bold text-sm">Templates</h3>
+ <div className="flex items-center justify-between">
+ <h3 className="font-bold text-sm">Templates</h3>
+ {/* v0.7: the promise — every template, free forever */}
+ <span className="flex items-center gap-1 text-[10px] font-bold text-[#00E5A0] bg-[#00E5A0]/10 border border-[#00E5A0]/25 rounded-full px-2 py-0.5">
+ <BadgeCheck size={11} /> 100% free forever
+ </span>
+ </div>
<div className="flex items-center gap-2 h-9 rounded-lg bg-white/[0.06] border border-white/10 px-2.5 mt-2.5">
<Search size={13} className="text-white/40 shrink-0" />
<input
@@ -84,7 +92,7 @@ export function TemplatesPanel() {
<div key={i} className="cv-skeleton aspect-[4/5] w-full" />
))}
</div>
- ) : !query && category === 'all' ? (
+ ) : hasPremiumSection ? (
<>
<SectionLabel icon={<Sparkles size={11} />}>Recommended for you</SectionLabel>
<div className="grid grid-cols-2 gap-3 mb-5">
@@ -92,9 +100,21 @@ export function TemplatesPanel() {
<TemplateCard key={t.slug} t={t} onApply={() => use(t)} onPreview={() => setPreview(t)} />
))}
</div>
+ {premiumList.length > 0 && (
+ <>
+ <SectionLabel icon={<Gem size={11} />}>
+ Premium collection <span className="text-[#00E5A0] normal-case font-semibold tracking-normal">· free forever</span>
+ </SectionLabel>
+ <div className="grid grid-cols-2 gap-3 mb-5">
+ {premiumList.map((t) => (
+ <TemplateCard key={t.slug} t={t} onApply={() => use(t)} onPreview={() => setPreview(t)} />
+ ))}
+ </div>
+ </>
+ )}
<SectionLabel icon={<Clock size={11} />}>All templates</SectionLabel>
<div className="grid grid-cols-2 gap-3">
- {list.slice(4).map((t) => (
+ {list.filter((t) => !t.badge).slice(4).map((t) => (
<TemplateCard key={t.slug} t={t} onApply={() => use(t)} onPreview={() => setPreview(t)} />
))}
</div>
@@ -116,7 +136,14 @@ export function TemplatesPanel() {
<div className="fixed inset-0 z-[75] bg-black/60 backdrop-blur-[2px]" onClick={() => setPreview(null)} />
<div className="fixed z-[76] left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[min(520px,92vw)] rounded-2xl bg-[#16181D] border border-white/12 shadow-2xl p-4">
<div className="flex items-center justify-between mb-3">
- <span className="text-sm font-bold text-white truncate">{preview.name}</span>
+ <div className="flex items-center gap-2">
+ <span className="text-sm font-bold text-white truncate">{preview.name}</span>
+ {preview.badge === 'premium' && (
+ <span className="flex items-center gap-1 text-[10px] font-bold text-[#F5C518] bg-[#F5C518]/10 border border-[#F5C518]/25 rounded-full px-2 py-0.5 shrink-0">
+ <Gem size={10} /> Premium · Free
+ </span>
+ )}
+ </div>
<button className="text-white/60 hover:text-white" onClick={() => setPreview(null)} aria-label="Close preview">
<X size={16} />
</button>
@@ -140,7 +167,44 @@ export function TemplatesPanel() {
)
}
-function TemplateCard({ t, onApply, onPreview }: { t: TemplateDef; onApply: () => void; onPreview: () => void }) {
+/**
+ * v0.7 rendering performance: preview thumbnails mount their Konva stage only
+ * when scrolled near the viewport (IntersectionObserver). With a 60+ template
+ * library this keeps the panel scroll buttery and the DOM light — only the
+ * visible cards pay the canvas cost.
+ */
+const LazyPreview = memo(function LazyPreview({ page, width, height }: { page: import('@/lib/types').PageData; width: number; height: number }) {
+ const ref = useRef<HTMLDivElement>(null)
+ const [visible, setVisible] = useState(false)
+
+ useEffect(() => {
+ const el = ref.current
+ if (!el || visible) return
+ if (typeof IntersectionObserver === 'undefined') {
+ setVisible(true)
+ return
+ }
+ const io = new IntersectionObserver(
+ (entries) => {
+ if (entries.some((e) => e.isIntersecting)) {
+ setVisible(true)
+ io.disconnect()
+ }
+ },
+ { rootMargin: '300px 0px' }
+ )
+ io.observe(el)
+ return () => io.disconnect()
+ }, [visible])
+
+ return (
+ <div ref={ref} className="w-full h-full">
+ {visible ? <DesignPreview page={page} width={width} height={height} /> : null}
+ </div>
+ )
+})
+
+const TemplateCard = memo(function TemplateCard({ t, onApply, onPreview }: { t: TemplateDef; onApply: () => void; onPreview: () => void }) {
return (
<div
className="group relative text-left rounded-lg overflow-hidden border border-white/10 hover:border-[#7630D7] transition-all"
@@ -148,9 +212,15 @@ function TemplateCard({ t, onApply, onPreview }: { t: TemplateDef; onApply: () =
>
<button className="block w-full" onClick={onPreview} aria-label={`Preview ${t.name}`}>
<div className="bg-[#0F1015]" style={{ aspectRatio: `${t.width} / ${t.height}` }}>
- <DesignPreview page={t.pages[0]} width={t.width} height={t.height} />
+ <LazyPreview page={t.pages[0]} width={t.width} height={t.height} />
</div>
</button>
+ {/* v0.7: premium quality badge — a label, never a paywall */}
+ {t.badge === 'premium' && (
+ <span className="absolute top-1.5 left-1.5 flex items-center gap-1 text-[9px] font-bold text-[#F5C518] bg-black/70 backdrop-blur-sm border border-[#F5C518]/30 rounded-full px-1.5 py-0.5 pointer-events-none">
+ <Gem size={9} /> PREMIUM
+ </span>
+ )}
<div className="px-2 py-1.5 text-[11px] font-medium truncate bg-[#16181D] text-white/80 flex items-center justify-between">
<span className="truncate">{t.name}</span>
</div>
@@ -165,7 +235,7 @@ function TemplateCard({ t, onApply, onPreview }: { t: TemplateDef; onApply: () =
</div>
</div>
)
-}
+})
function SectionLabel({ icon, children }: { icon: React.ReactNode; children: React.ReactNode }) {
return (
diff --git a/src/lib/templates.ts b/src/lib/templates.ts
index fc7d81d..90c6f56 100644
--- a/src/lib/templates.ts
+++ b/src/lib/templates.ts
@@ -20,6 +20,9 @@ export interface TemplateDef {
width: number
height: number
accent: string
+ /** v0.7: premium library expansion — every template stays 100% free,
+ * the badge is a quality label only (never a paywall). */
+ badge?: 'premium' | 'new'
pages: PageData[]
}
@@ -644,6 +647,1159 @@ export const TEMPLATES: TemplateDef[] = [
},
],
},
+
+ // ══════════════════════════════════════════════════════════════
+ // v0.7 PREMIUM LIBRARY EXPANSION — 39 new templates, all 100% free.
+ // "premium" is a quality label only: every template, element and export
+ // in Canvix is free forever. No subscriptions, no locked content, ever.
+ // ══════════════════════════════════════════════════════════════
+
+ // ── Premium · Social media ─────────────────────────────────
+ {
+ slug: 'flash-sale-story',
+ name: 'Flash Sale Story',
+ category: 'social',
+ width: 1080,
+ height: 1920,
+ accent: '#FF3D71',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'solid', color: '#12121A' },
+ elements: [
+ sh('rect', { x: 0, y: 0, width: 1080, height: 14, fill: '#FF3D71' }),
+ sh('rect', { x: 0, y: 1906, width: 1080, height: 14, fill: '#00E5A0' }),
+ tx({ x: 60, y: 300, width: 960, height: 120, text: '48 HOURS ONLY', fontFamily: 'Inter', bold: true, fontSize: 52, letterSpacing: 6, fill: '#00E5A0', align: 'center' }),
+ tx({ x: 60, y: 470, width: 960, height: 260, text: 'FLASH', fontFamily: 'Anton', fontSize: 230, fill: '#FFFFFF', align: 'center' }),
+ tx({ x: 60, y: 720, width: 960, height: 260, text: 'SALE', fontFamily: 'Anton', fontSize: 230, fill: '#FF3D71', align: 'center' }),
+ sh('rect', { x: 290, y: 1060, width: 500, height: 130, fill: '#FF3D71', cornerRadius: 65, rotation: -2 }),
+ tx({ x: 310, y: 1100, width: 460, height: 70, text: 'UP TO 70% OFF', fontFamily: 'Poppins', bold: true, fontSize: 48, fill: '#FFFFFF', align: 'center' }),
+ tx({ x: 90, y: 1320, width: 900, height: 90, text: 'Everything must go — no code needed', fontFamily: 'Caveat', bold: true, fontSize: 56, fill: '#B9BCCB', align: 'center' }),
+ gr('bolt', { x: 90, y: 250, width: 110, height: 110, fill: '#00E5A0' }),
+ gr('bolt', { x: 880, y: 1560, width: 110, height: 110, fill: '#FF3D71' }),
+ tx({ x: 60, y: 1750, width: 960, height: 60, text: 'SWIPE UP BEFORE IT\u2019S GONE', fontFamily: 'Inter', bold: true, fontSize: 34, letterSpacing: 4, fill: '#FFFFFF', align: 'center' }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'minimal-quote-post',
+ name: 'Minimal Quote Post',
+ category: 'social',
+ width: 1080,
+ height: 1080,
+ accent: '#E8DCC8',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'solid', color: '#F7F3EC' },
+ elements: [
+ sh('rect', { x: 70, y: 70, width: 940, height: 940, stroke: '#C9B99B', strokeWidth: 2, fill: 'transparent', cornerRadius: 4 }),
+ tx({ x: 140, y: 240, width: 800, height: 90, text: 'LESS', fontFamily: 'Cormorant Garamond', fontSize: 110, letterSpacing: 16, fill: '#2B2B2B', align: 'center' }),
+ tx({ x: 140, y: 390, width: 800, height: 90, text: 'BUT', fontFamily: 'Cormorant Garamond', italic: true, fontSize: 110, letterSpacing: 16, fill: '#A38352', align: 'center' }),
+ tx({ x: 140, y: 540, width: 800, height: 90, text: 'BETTER', fontFamily: 'Cormorant Garamond', fontSize: 110, letterSpacing: 16, fill: '#2B2B2B', align: 'center' }),
+ ln({ x: 460, y: 720, width: 160, height: 0, stroke: '#A38352', strokeWidth: 3 }),
+ tx({ x: 190, y: 790, width: 700, height: 60, text: 'quality over quantity, always', fontFamily: 'Caveat', fontSize: 44, fill: '#8A8A8A', align: 'center' }),
+ tx({ x: 190, y: 880, width: 700, height: 40, text: '@canvix', fontFamily: 'Inter', bold: true, fontSize: 24, letterSpacing: 4, fill: '#C9B99B', align: 'center' }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'restaurant-pasta',
+ name: 'Trattoria Special',
+ category: 'social',
+ width: 1080,
+ height: 1350,
+ accent: '#7B2D26',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'solid', color: '#241512' },
+ elements: [
+ sh('rect', { x: 60, y: 60, width: 960, height: 1230, stroke: '#C9A227', strokeWidth: 3, fill: 'transparent' }),
+ tx({ x: 120, y: 150, width: 840, height: 60, text: 'TRATTORIA ROMA · EST. 1987', fontFamily: 'Inter', bold: true, fontSize: 26, letterSpacing: 5, fill: '#C9A227', align: 'center' }),
+ tx({ x: 120, y: 300, width: 840, height: 130, text: 'Nonna\u2019s', fontFamily: 'Playfair Display', italic: true, fontSize: 120, fill: '#F5EBDD', align: 'center' }),
+ tx({ x: 120, y: 450, width: 840, height: 130, text: 'Tagliatelle', fontFamily: 'Playfair Display', fontSize: 120, fill: '#F5EBDD', align: 'center' }),
+ ln({ x: 420, y: 640, width: 240, height: 0, stroke: '#C9A227', strokeWidth: 4 }),
+ tx({ x: 170, y: 700, width: 740, height: 140, text: 'Hand-rolled daily, simmered for six hours in San Marzano tomato. This week only at family recipe prices.', fontFamily: 'Cormorant Garamond', fontSize: 40, lineHeight: 1.5, fill: '#D8C7B2', align: 'center' }),
+ sh('rect', { x: 330, y: 940, width: 420, height: 110, fill: '#7B2D26', cornerRadius: 8 }),
+ tx({ x: 350, y: 972, width: 380, height: 60, text: 'TUESDAY \u00b7 $12', fontFamily: 'Poppins', bold: true, fontSize: 40, fill: '#F5EBDD', align: 'center' }),
+ st('\ud83c\udf5d', { x: 460, y: 1100, width: 160, height: 160, fontSize: 130 }),
+ tx({ x: 120, y: 1240, width: 840, height: 40, text: 'RESERVE \u00b7 TRATTORIAROMA.COM', fontFamily: 'Inter', bold: true, fontSize: 20, letterSpacing: 4, fill: '#C9A227', align: 'center' }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'real-estate-open',
+ name: 'Open House Post',
+ category: 'social',
+ width: 1080,
+ height: 1350,
+ accent: '#0E2A47',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'gradient', from: '#0E2A47', to: '#1C4E85', angle: 160 },
+ elements: [
+ sh('rect', { x: 60, y: 90, width: 960, height: 640, fill: '#F7F5F0', cornerRadius: 12 }),
+ sh('path', { x: 260, y: 200, width: 560, height: 420, pathData: GRAPHICS.find((g) => g.id === 'hexagon')?.path ?? '', fill: '#DDE7F1' }),
+ sh('rect', { x: 320, y: 430, width: 200, height: 240, fill: '#0E2A47', cornerRadius: 4 }),
+ sh('triangle', { x: 290, y: 330, width: 260, height: 120, fill: '#1C4E85' }),
+ sh('rect', { x: 560, y: 430, width: 200, height: 240, fill: '#0E2A47', cornerRadius: 4 }),
+ sh('triangle', { x: 530, y: 330, width: 260, height: 120, fill: '#1C4E85' }),
+ sh('ellipse', { x: 700, y: 160, width: 180, height: 180, fill: '#F2C94C' }),
+ tx({ x: 60, y: 800, width: 960, height: 90, text: 'OPEN HOUSE', fontFamily: 'Archivo', bold: true, fontSize: 84, letterSpacing: 2, fill: '#FFFFFF', align: 'center' }),
+ tx({ x: 60, y: 910, width: 960, height: 70, text: 'Saturday 11 AM \u2013 3 PM', fontFamily: 'Playfair Display', italic: true, fontSize: 52, fill: '#F2C94C', align: 'center' }),
+ ln({ x: 440, y: 1030, width: 200, height: 0, stroke: '#F2C94C', strokeWidth: 3 }),
+ tx({ x: 110, y: 1080, width: 860, height: 120, text: '42 Maplewood Lane \u00b7 4 bed \u00b7 3 bath \u00b7 $1,150,000', fontFamily: 'Inter', fontSize: 34, lineHeight: 1.6, fill: '#E8EEF5', align: 'center' }),
+ tx({ x: 60, y: 1230, width: 960, height: 50, text: 'SARAH CHEN \u00b7 (555) 014-2288 \u00b7 LICENSED BROKER', fontFamily: 'Inter', bold: true, fontSize: 24, letterSpacing: 2, fill: '#B9CCDF', align: 'center' }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'fitness-bootcamp',
+ name: 'Bootcamp Challenge',
+ category: 'social',
+ width: 1080,
+ height: 1350,
+ accent: '#E63946',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'solid', color: '#111114' },
+ elements: [
+ sh('rect', { x: -120, y: 900, width: 1320, height: 600, fill: '#E63946', rotation: -6 }),
+ tx({ x: 60, y: 140, width: 960, height: 70, text: 'IRON CLAD GYM PRESENTS', fontFamily: 'Archivo', bold: true, fontSize: 30, letterSpacing: 6, fill: '#E63946', align: 'center' }),
+ tx({ x: 60, y: 260, width: 960, height: 240, text: '30-DAY', fontFamily: 'Anton', fontSize: 200, fill: '#FFFFFF', align: 'center' }),
+ tx({ x: 60, y: 500, width: 960, height: 240, text: 'SHRED', fontFamily: 'Anton', fontSize: 200, fill: '#E63946', align: 'center' }),
+ tx({ x: 60, y: 790, width: 960, height: 80, text: 'transform your body in four weeks', fontFamily: 'Inter', fontSize: 36, fill: '#C7C7CF', align: 'center' }),
+ tx({ x: 60, y: 1010, width: 960, height: 100, text: '\u2022 daily 45-min sessions\n\u2022 nutrition plan included \u2022 coach support', fontFamily: 'Poppins', bold: true, fontSize: 34, lineHeight: 1.7, fill: '#FFFFFF', align: 'center' }),
+ sh('rect', { x: 340, y: 1180, width: 400, height: 110, fill: '#FFFFFF', cornerRadius: 55 }),
+ tx({ x: 360, y: 1213, width: 360, height: 60, text: 'JOIN NOW \u2014 $49', fontFamily: 'Archivo', bold: true, fontSize: 40, fill: '#111114', align: 'center' }),
+ gr('bolt', { x: 90, y: 90, width: 90, height: 90, fill: '#E63946' }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'webinar-announce',
+ name: 'Webinar Announcement',
+ category: 'social',
+ width: 1200,
+ height: 630,
+ accent: '#5B4BFF',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'gradient', from: '#2B2150', to: '#5B4BFF', angle: 120 },
+ elements: [
+ sh('ellipse', { x: 880, y: -160, width: 520, height: 520, fill: '#00D4C8', opacity: 0.35 }),
+ sh('ellipse', { x: 1020, y: 330, width: 360, height: 360, fill: '#FF6B9D', opacity: 0.3 }),
+ tx({ x: 70, y: 90, width: 700, height: 50, text: 'FREE LIVE WEBINAR \u00b7 SEAT 300', fontFamily: 'Inter', bold: true, fontSize: 24, letterSpacing: 4, fill: '#00D4C8', align: 'left' }),
+ tx({ x: 70, y: 170, width: 760, height: 120, text: 'Design Systems', fontFamily: 'Archivo', bold: true, fontSize: 84, fill: '#FFFFFF', align: 'left' }),
+ tx({ x: 70, y: 300, width: 760, height: 120, text: 'that Scale', fontFamily: 'Archivo', bold: true, fontSize: 84, fill: '#FFD166', align: 'left' }),
+ tx({ x: 70, y: 440, width: 720, height: 90, text: 'Learn how small teams ship consistent UI at enterprise scale.', fontFamily: 'Inter', fontSize: 30, lineHeight: 1.5, fill: '#D9D6FF', align: 'left' }),
+ sh('rect', { x: 70, y: 540, width: 330, height: 56, fill: '#00D4C8', cornerRadius: 28 }),
+ tx({ x: 90, y: 556, width: 290, height: 40, text: 'SAVE MY SEAT', fontFamily: 'Poppins', bold: true, fontSize: 26, fill: '#12121A', align: 'center' }),
+ tx({ x: 440, y: 552, width: 400, height: 40, text: 'THU \u00b7 OCT 30 \u00b7 6 PM CET', fontFamily: 'Inter', bold: true, fontSize: 22, fill: '#FFFFFF', align: 'left' }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'podcast-cover-art',
+ name: 'Podcast Cover',
+ category: 'social',
+ width: 1400,
+ height: 1400,
+ accent: '#FF6B35',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'solid', color: '#1A1E2E' },
+ elements: [
+ sh('ellipse', { x: -180, y: 900, width: 720, height: 720, fill: '#FF6B35', opacity: 0.25 }),
+ sh('ellipse', { x: 900, y: -200, width: 640, height: 640, fill: '#4ECDC4', opacity: 0.2 }),
+ tx({ x: 100, y: 380, width: 1200, height: 90, text: 'THE FUTURE OF', fontFamily: 'Space Grotesk', bold: true, fontSize: 64, letterSpacing: 8, fill: '#4ECDC4', align: 'center' }),
+ tx({ x: 100, y: 520, width: 1200, height: 280, text: 'MAKERS', fontFamily: 'Anton', fontSize: 260, fill: '#FFFFFF', align: 'center' }),
+ sh('rect', { x: 350, y: 850, width: 700, height: 100, fill: '#FF6B35', cornerRadius: 50, rotation: 2 }),
+ tx({ x: 370, y: 875, width: 660, height: 60, text: 'NEW EPISODES EVERY FRIDAY', fontFamily: 'Poppins', bold: true, fontSize: 36, fill: '#1A1E2E', align: 'center' }),
+ st('\ud83c\udfa7', { x: 610, y: 1030, width: 180, height: 180, fontSize: 140 }),
+ tx({ x: 100, y: 1250, width: 1200, height: 50, text: 'SPOTIFY \u00b7 APPLE \u00b7 YOUTUBE', fontFamily: 'Inter', bold: true, fontSize: 28, letterSpacing: 6, fill: '#8891B0', align: 'center' }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'birthday-bash-story',
+ name: 'Birthday Bash Story',
+ category: 'social',
+ width: 1080,
+ height: 1920,
+ accent: '#FF8FB1',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'gradient', from: '#FFD1E3', to: '#FF8FB1', angle: 150 },
+ elements: [
+ sh('ellipse', { x: -140, y: -160, width: 480, height: 480, fill: '#FFFFFF', opacity: 0.4 }),
+ sh('ellipse', { x: 780, y: 1560, width: 420, height: 420, fill: '#FFFFFF', opacity: 0.4 }),
+ tx({ x: 60, y: 380, width: 960, height: 120, text: 'YOU\u2019RE INVITED', fontFamily: 'Caveat', bold: true, fontSize: 96, fill: '#7A2E4A', align: 'center' }),
+ tx({ x: 60, y: 580, width: 960, height: 300, text: 'BIRTHDAY', fontFamily: 'Anton', fontSize: 220, fill: '#FFFFFF', align: 'center' }),
+ tx({ x: 60, y: 880, width: 960, height: 300, text: 'BASH!', fontFamily: 'Anton', fontSize: 220, fill: '#7A2E4A', align: 'center' }),
+ sh('rect', { x: 240, y: 1250, width: 600, height: 120, fill: '#FFFFFF', cornerRadius: 60, rotation: -2 }),
+ tx({ x: 260, y: 1285, width: 560, height: 70, text: 'SAT \u00b7 7 PM \u00b7 MY PLACE', fontFamily: 'Poppins', bold: true, fontSize: 44, fill: '#7A2E4A', align: 'center' }),
+ st('\ud83c\udf89', { x: 120, y: 1050, width: 200, height: 200, fontSize: 160 }),
+ st('\ud83c\udf82', { x: 760, y: 1600, width: 200, height: 200, fontSize: 160 }),
+ gr('sparkle', { x: 850, y: 300, width: 150, height: 150, fill: '#FFFFFF' }),
+ tx({ x: 60, y: 1700, width: 960, height: 60, text: 'cake, karaoke & chaos guaranteed', fontFamily: 'Caveat', fontSize: 52, fill: '#7A2E4A', align: 'center' }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'travel-guide-story',
+ name: 'Wanderlust Story',
+ category: 'social',
+ width: 1080,
+ height: 1920,
+ accent: '#0FA3B1',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'gradient', from: '#0FA3B1', to: '#0D5C63', angle: 170 },
+ elements: [
+ sh('ellipse', { x: 140, y: 240, width: 800, height: 800, stroke: '#FFFFFF', strokeWidth: 3, fill: 'transparent', opacity: 0.6 }),
+ sh('ellipse', { x: 240, y: 340, width: 600, height: 600, stroke: '#FFD166', strokeWidth: 3, fill: 'transparent', opacity: 0.8 }),
+ tx({ x: 60, y: 620, width: 960, height: 300, text: 'ICELAND', fontFamily: 'Bebas Neue', fontSize: 230, fill: '#FFFFFF', align: 'center' }),
+ tx({ x: 60, y: 930, width: 960, height: 90, text: 'the land of fire & ice', fontFamily: 'Cormorant Garamond', italic: true, fontSize: 72, fill: '#FFD166', align: 'center' }),
+ ln({ x: 400, y: 1110, width: 280, height: 0, stroke: '#FFFFFF', strokeWidth: 4 }),
+ tx({ x: 110, y: 1180, width: 860, height: 200, text: 'A 7-day ring-road itinerary: waterfalls, black beaches, hot springs and the northern lights.', fontFamily: 'Inter', fontSize: 36, lineHeight: 1.6, fill: '#E6F4F4', align: 'center' }),
+ sh('rect', { x: 300, y: 1470, width: 480, height: 110, fill: '#FFD166', cornerRadius: 55 }),
+ tx({ x: 320, y: 1503, width: 440, height: 60, text: 'READ THE GUIDE', fontFamily: 'Poppins', bold: true, fontSize: 38, fill: '#0D5C63', align: 'center' }),
+ st('\u2708\ufe0f', { x: 100, y: 1560, width: 160, height: 160, fontSize: 120 }),
+ tx({ x: 60, y: 1720, width: 960, height: 50, text: '#wanderlust #traveldiaries', fontFamily: 'Inter', bold: true, fontSize: 28, letterSpacing: 3, fill: '#BFE3E3', align: 'center' }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'linkedin-pro-banner',
+ name: 'LinkedIn Pro Banner',
+ category: 'social',
+ width: 1584,
+ height: 396,
+ accent: '#0A66C2',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'gradient', from: '#0B1F3A', to: '#0A66C2', angle: 110 },
+ elements: [
+ sh('rect', { x: 0, y: 0, width: 24, height: 396, fill: '#FFD166' }),
+ sh('ellipse', { x: 1250, y: -120, width: 520, height: 520, fill: '#FFFFFF', opacity: 0.08 }),
+ sh('ellipse', { x: 1380, y: 180, width: 340, height: 340, fill: '#FFD166', opacity: 0.18 }),
+ tx({ x: 90, y: 90, width: 900, height: 80, text: 'MAYA PATEL', fontFamily: 'Archivo', bold: true, fontSize: 62, fill: '#FFFFFF', align: 'left', letterSpacing: 2 }),
+ tx({ x: 92, y: 185, width: 900, height: 60, text: 'Senior Product Designer \u00b7 Design Systems Lead', fontFamily: 'Inter', fontSize: 32, fill: '#FFD166', align: 'left' }),
+ ln({ x: 92, y: 275, width: 120, height: 0, stroke: '#FFD166', strokeWidth: 4 }),
+ tx({ x: 92, y: 300, width: 860, height: 60, text: 'Building accessible UI at scale \u00b7 Speaker \u00b7 Mentor', fontFamily: 'Inter', fontSize: 26, fill: '#D6E4F0', align: 'left' }),
+ gr('hexagon', { x: 1310, y: 120, width: 160, height: 160, fill: 'transparent', stroke: '#FFFFFF', strokeWidth: 4 }),
+ ],
+ },
+ ],
+ },
+
+ // ── Premium · Presentation ─────────────────────────────────
+ {
+ slug: 'pitch-deck-noir',
+ name: 'Pitch Deck Noir',
+ category: 'presentation',
+ width: 1920,
+ height: 1080,
+ accent: '#8B5CF6',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'solid', color: '#0D0D12' },
+ elements: [
+ sh('ellipse', { x: 1420, y: -220, width: 720, height: 720, fill: '#8B5CF6', opacity: 0.22 }),
+ sh('ellipse', { x: 1600, y: 620, width: 520, height: 520, fill: '#22D3EE', opacity: 0.14 }),
+ tx({ x: 120, y: 260, width: 400, height: 50, text: 'SERIES A \u00b7 2026', fontFamily: 'Space Grotesk', bold: true, fontSize: 28, letterSpacing: 6, fill: '#22D3EE', align: 'left' }),
+ tx({ x: 120, y: 350, width: 1200, height: 200, text: 'CLOUDPEAK', fontFamily: 'Archivo', bold: true, fontSize: 150, fill: '#FFFFFF', align: 'left', letterSpacing: 3 }),
+ tx({ x: 124, y: 570, width: 1100, height: 90, text: 'Infrastructure that scales before you do', fontFamily: 'Inter', fontSize: 48, fill: '#A5A3C0', align: 'left' }),
+ ln({ x: 124, y: 720, width: 140, height: 0, stroke: '#8B5CF6', strokeWidth: 6 }),
+ tx({ x: 124, y: 760, width: 900, height: 60, text: 'Alex Mercer, CEO \u00b7 [email protected]', fontFamily: 'DM Mono', fontSize: 26, fill: '#6E6C8A', align: 'left' }),
+ sh('rect', { x: 124, y: 880, width: 210, height: 56, fill: 'transparent', stroke: '#8B5CF6', strokeWidth: 2, cornerRadius: 28 }),
+ tx({ x: 134, y: 896, width: 190, height: 40, text: 'CONFIDENTIAL', fontFamily: 'Inter', bold: true, fontSize: 20, letterSpacing: 2, fill: '#8B5CF6', align: 'center' }),
+ ],
+ },
+ {
+ id: 'p2',
+ background: { type: 'solid', color: '#0D0D12' },
+ elements: [
+ tx({ x: 120, y: 120, width: 400, height: 50, text: 'THE PROBLEM', fontFamily: 'Space Grotesk', bold: true, fontSize: 26, letterSpacing: 5, fill: '#22D3EE', align: 'left' }),
+ tx({ x: 120, y: 200, width: 1400, height: 130, text: 'Scaling is still manual', fontFamily: 'Archivo', bold: true, fontSize: 92, fill: '#FFFFFF', align: 'left' }),
+ tx({ x: 120, y: 400, width: 620, height: 250, text: 'Teams waste 11 hours a week babysitting deployments, tuning autoscalers and rewriting the same infrastructure code.', fontFamily: 'Inter', fontSize: 36, lineHeight: 1.6, fill: '#A5A3C0', align: 'left' }),
+ sh('rect', { x: 960, y: 380, width: 6, height: 340, fill: '#8B5CF6' }),
+ tx({ x: 1040, y: 400, width: 700, height: 90, text: '\u201cWe ship 4x slower than we build.\u201d', fontFamily: 'Playfair Display', italic: true, fontSize: 44, fill: '#E6E4F6', align: 'left' }),
+ tx({ x: 1040, y: 540, width: 700, height: 50, text: '\u2014 Staff Engineer, Fortune 500', fontFamily: 'Inter', fontSize: 26, fill: '#6E6C8A', align: 'left' }),
+ tx({ x: 1040, y: 630, width: 760, height: 60, text: '82% of outages trace back to config drift', fontFamily: 'Inter', bold: true, fontSize: 28, fill: '#22D3EE', align: 'left' }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'quarterly-report-deck',
+ name: 'Quarterly Report',
+ category: 'presentation',
+ width: 1920,
+ height: 1080,
+ accent: '#0F6B5C',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'solid', color: '#F6F7F5' },
+ elements: [
+ sh('rect', { x: 0, y: 0, width: 1920, height: 12, fill: '#0F6B5C' }),
+ tx({ x: 120, y: 180, width: 900, height: 60, text: 'NORTHWIND ANALYTICS \u00b7 Q3 2026', fontFamily: 'Inter', bold: true, fontSize: 28, letterSpacing: 5, fill: '#0F6B5C', align: 'left' }),
+ tx({ x: 120, y: 280, width: 1300, height: 160, text: 'Quarter in Review', fontFamily: 'Playfair Display', fontSize: 110, fill: '#1A2E2A', align: 'left' }),
+ ln({ x: 124, y: 480, width: 160, height: 0, stroke: '#D9A441', strokeWidth: 6 }),
+ tx({ x: 120, y: 530, width: 1000, height: 70, text: 'Growth, retention and what comes next', fontFamily: 'Inter', fontSize: 38, fill: '#5C7A72', align: 'left' }),
+ sh('rect', { x: 1240, y: 220, width: 440, height: 440, fill: '#0F6B5C', cornerRadius: 16 }),
+ tx({ x: 1300, y: 300, width: 320, height: 140, text: '+38%', fontFamily: 'Archivo', bold: true, fontSize: 110, fill: '#D9A441', align: 'left' }),
+ tx({ x: 1300, y: 470, width: 320, height: 80, text: 'revenue growth\nyear over year', fontFamily: 'Inter', fontSize: 26, lineHeight: 1.5, fill: '#CFE5DF', align: 'left' }),
+ tx({ x: 120, y: 900, width: 800, height: 50, text: 'Prepared by the Finance Team \u00b7 October 2026', fontFamily: 'Inter', fontSize: 24, fill: '#8AA39B', align: 'left' }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'webinar-101-deck',
+ name: 'Webinar 101 Deck',
+ category: 'presentation',
+ width: 1920,
+ height: 1080,
+ accent: '#5B4BFF',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'gradient', from: '#1B1440', to: '#5B4BFF', angle: 130 },
+ elements: [
+ tx({ x: 120, y: 240, width: 900, height: 60, text: 'LIVE WEBINAR \u00b7 60 MINUTES', fontFamily: 'Space Grotesk', bold: true, fontSize: 28, letterSpacing: 5, fill: '#00E5A0', align: 'left' }),
+ tx({ x: 120, y: 330, width: 1300, height: 160, text: 'CSS Grid', fontFamily: 'Archivo', bold: true, fontSize: 140, fill: '#FFFFFF', align: 'left' }),
+ tx({ x: 120, y: 490, width: 1300, height: 160, text: 'Masterclass', fontFamily: 'Archivo', bold: true, fontSize: 140, fill: '#FFD166', align: 'left' }),
+ tx({ x: 124, y: 700, width: 900, height: 80, text: 'From zero to layouts you didn\u2019t think were possible', fontFamily: 'Inter', fontSize: 36, fill: '#D9D6FF', align: 'left' }),
+ sh('rect', { x: 124, y: 840, width: 380, height: 72, fill: '#00E5A0', cornerRadius: 36 }),
+ tx({ x: 144, y: 861, width: 340, height: 50, text: 'REGISTER FREE', fontFamily: 'Poppins', bold: true, fontSize: 30, fill: '#1B1440', align: 'center' }),
+ gr('hexagon', { x: 1450, y: 250, width: 300, height: 300, fill: 'transparent', stroke: '#FFD166', strokeWidth: 5 }),
+ gr('check-circle', { x: 1560, y: 620, width: 200, height: 200, fill: '#00E5A0', opacity: 0.8 }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'course-welcome-deck',
+ name: 'Course Welcome',
+ category: 'presentation',
+ width: 1920,
+ height: 1080,
+ accent: '#E07A5F',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'solid', color: '#FDF6EC' },
+ elements: [
+ sh('ellipse', { x: 1420, y: -180, width: 640, height: 640, fill: '#E07A5F', opacity: 0.18 }),
+ sh('ellipse', { x: -160, y: 700, width: 560, height: 560, fill: '#81B29A', opacity: 0.2 }),
+ tx({ x: 120, y: 250, width: 900, height: 60, text: 'MODULE 01 \u00b7 WELCOME', fontFamily: 'Inter', bold: true, fontSize: 26, letterSpacing: 5, fill: '#E07A5F', align: 'left' }),
+ tx({ x: 120, y: 340, width: 1400, height: 180, text: 'Watercolor', fontFamily: 'Playfair Display', italic: true, fontSize: 130, fill: '#2F2A25', align: 'left' }),
+ tx({ x: 120, y: 530, width: 1400, height: 180, text: 'Foundations', fontFamily: 'Playfair Display', fontSize: 130, fill: '#E07A5F', align: 'left' }),
+ tx({ x: 124, y: 750, width: 950, height: 90, text: 'Six lessons that take you from first brush stroke to a finished landscape', fontFamily: 'Inter', fontSize: 34, lineHeight: 1.5, fill: '#6B6257', align: 'left' }),
+ ln({ x: 124, y: 900, width: 140, height: 0, stroke: '#81B29A', strokeWidth: 6 }),
+ tx({ x: 124, y: 940, width: 800, height: 50, text: 'TAUGHT BY LENA OSA \u00b7 STUDIO ARTIST', fontFamily: 'Inter', bold: true, fontSize: 22, letterSpacing: 3, fill: '#81B29A', align: 'left' }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'roadmap-2027',
+ name: 'Product Roadmap',
+ category: 'presentation',
+ width: 1920,
+ height: 1080,
+ accent: '#3B82F6',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'solid', color: '#0B1220' },
+ elements: [
+ tx({ x: 120, y: 110, width: 900, height: 60, text: 'PUBLIC ROADMAP', fontFamily: 'Space Grotesk', bold: true, fontSize: 26, letterSpacing: 5, fill: '#60A5FA', align: 'left' }),
+ tx({ x: 120, y: 180, width: 1300, height: 120, text: 'Shipping in 2027', fontFamily: 'Archivo', bold: true, fontSize: 92, fill: '#FFFFFF', align: 'left' }),
+ ln({ x: 120, y: 520, width: 1680, height: 0, stroke: '#334155', strokeWidth: 6 }),
+ sh('ellipse', { x: 300, y: 495, width: 50, height: 50, fill: '#3B82F6' }),
+ sh('ellipse', { x: 820, y: 495, width: 50, height: 50, fill: '#8B5CF6' }),
+ sh('ellipse', { x: 1340, y: 495, width: 50, height: 50, fill: '#22D3EE' }),
+ tx({ x: 200, y: 360, width: 260, height: 50, text: 'Q1', fontFamily: 'Space Grotesk', bold: true, fontSize: 40, fill: '#3B82F6', align: 'center' }),
+ tx({ x: 720, y: 360, width: 260, height: 50, text: 'Q2', fontFamily: 'Space Grotesk', bold: true, fontSize: 40, fill: '#8B5CF6', align: 'center' }),
+ tx({ x: 1240, y: 360, width: 260, height: 50, text: 'Q3\u20134', fontFamily: 'Space Grotesk', bold: true, fontSize: 40, fill: '#22D3EE', align: 'center' }),
+ tx({ x: 180, y: 610, width: 300, height: 110, text: 'Real-time\nmultiplayer', fontFamily: 'Inter', bold: true, fontSize: 32, lineHeight: 1.4, fill: '#E2E8F0', align: 'center' }),
+ tx({ x: 700, y: 610, width: 300, height: 110, text: 'Offline mode\n& sync', fontFamily: 'Inter', bold: true, fontSize: 32, lineHeight: 1.4, fill: '#E2E8F0', align: 'center' }),
+ tx({ x: 1220, y: 610, width: 300, height: 110, text: 'Plugin\nmarketplace', fontFamily: 'Inter', bold: true, fontSize: 32, lineHeight: 1.4, fill: '#E2E8F0', align: 'center' }),
+ tx({ x: 180, y: 760, width: 300, height: 130, text: 'Edit together with zero conflicts', fontFamily: 'Inter', fontSize: 24, lineHeight: 1.5, fill: '#94A3B8', align: 'center' }),
+ tx({ x: 700, y: 760, width: 300, height: 130, text: 'Work anywhere, merge later', fontFamily: 'Inter', fontSize: 24, lineHeight: 1.5, fill: '#94A3B8', align: 'center' }),
+ tx({ x: 1220, y: 760, width: 300, height: 130, text: 'Extend Canvix your way', fontFamily: 'Inter', fontSize: 24, lineHeight: 1.5, fill: '#94A3B8', align: 'center' }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'meet-the-team-deck',
+ name: 'Meet the Team',
+ category: 'presentation',
+ width: 1920,
+ height: 1080,
+ accent: '#F25CA2',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'solid', color: '#1A1023' },
+ elements: [
+ tx({ x: 120, y: 130, width: 900, height: 60, text: 'WHO WE ARE', fontFamily: 'Space Grotesk', bold: true, fontSize: 26, letterSpacing: 5, fill: '#F25CA2', align: 'left' }),
+ tx({ x: 120, y: 200, width: 1400, height: 130, text: 'The humans behind it', fontFamily: 'Archivo', bold: true, fontSize: 96, fill: '#FFFFFF', align: 'left' }),
+ sh('rect', { x: 120, y: 430, width: 500, height: 460, fill: '#241833', cornerRadius: 20 }),
+ sh('rect', { x: 710, y: 430, width: 500, height: 460, fill: '#241833', cornerRadius: 20 }),
+ sh('rect', { x: 1300, y: 430, width: 500, height: 460, fill: '#241833', cornerRadius: 20 }),
+ sh('ellipse', { x: 290, y: 480, width: 160, height: 160, fill: '#F25CA2' }),
+ sh('ellipse', { x: 880, y: 480, width: 160, height: 160, fill: '#FFB347' }),
+ sh('ellipse', { x: 1470, y: 480, width: 160, height: 160, fill: '#5EEAD4' }),
+ tx({ x: 170, y: 680, width: 400, height: 60, text: 'Priya Nair', fontFamily: 'Poppins', bold: true, fontSize: 38, fill: '#FFFFFF', align: 'center' }),
+ tx({ x: 170, y: 740, width: 400, height: 50, text: 'Founder & CEO', fontFamily: 'Inter', fontSize: 26, fill: '#F25CA2', align: 'center' }),
+ tx({ x: 760, y: 680, width: 400, height: 60, text: 'Diego Santos', fontFamily: 'Poppins', bold: true, fontSize: 38, fill: '#FFFFFF', align: 'center' }),
+ tx({ x: 760, y: 740, width: 400, height: 50, text: 'Head of Design', fontFamily: 'Inter', fontSize: 26, fill: '#FFB347', align: 'center' }),
+ tx({ x: 1350, y: 680, width: 400, height: 60, text: 'Amara Okafor', fontFamily: 'Poppins', bold: true, fontSize: 38, fill: '#FFFFFF', align: 'center' }),
+ tx({ x: 1350, y: 740, width: 400, height: 50, text: 'Engineering Lead', fontFamily: 'Inter', fontSize: 26, fill: '#5EEAD4', align: 'center' }),
+ tx({ x: 170, y: 810, width: 400, height: 50, text: 'ex-Stripe \u00b7 3 exits', fontFamily: 'Inter', fontSize: 22, fill: '#8B7FA3', align: 'center' }),
+ tx({ x: 760, y: 810, width: 400, height: 50, text: 'Awwwards SOTD \u00d72', fontFamily: 'Inter', fontSize: 22, fill: '#8B7FA3', align: 'center' }),
+ tx({ x: 1350, y: 810, width: 400, height: 50, text: 'ex-Google \u00b7 OSS maintainer', fontFamily: 'Inter', fontSize: 22, fill: '#8B7FA3', align: 'center' }),
+ ],
+ },
+ ],
+ },
+
+ // ── Premium · Print ────────────────────────────────────────
+ {
+ slug: 'gig-poster-neon',
+ name: 'Neon Gig Poster',
+ category: 'print',
+ width: 1240,
+ height: 1754,
+ accent: '#FF2079',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'solid', color: '#0C0C14' },
+ elements: [
+ sh('ellipse', { x: 170, y: 140, width: 900, height: 900, stroke: '#FF2079', strokeWidth: 6, fill: 'transparent', opacity: 0.7 }),
+ sh('ellipse', { x: 320, y: 290, width: 600, height: 600, stroke: '#00F0FF', strokeWidth: 4, fill: 'transparent', opacity: 0.6 }),
+ tx({ x: 70, y: 430, width: 1100, height: 200, text: 'STATIC', fontFamily: 'Anton', fontSize: 170, fill: '#FF2079', align: 'center' }),
+ tx({ x: 70, y: 630, width: 1100, height: 200, text: 'WAVE', fontFamily: 'Anton', fontSize: 170, fill: '#00F0FF', align: 'center' }),
+ tx({ x: 70, y: 900, width: 1100, height: 70, text: 'LIVE AT THE VOID \u00b7 BROOKLYN', fontFamily: 'Space Grotesk', bold: true, fontSize: 40, letterSpacing: 4, fill: '#FFFFFF', align: 'center' }),
+ ln({ x: 420, y: 1030, width: 400, height: 0, stroke: '#FF2079', strokeWidth: 4 }),
+ tx({ x: 70, y: 1090, width: 1100, height: 90, text: 'FRIDAY NOV 21 \u00b7 DOORS 9 PM \u00b7 18+', fontFamily: 'Space Grotesk', bold: true, fontSize: 36, fill: '#B8B8C8', align: 'center' }),
+ tx({ x: 70, y: 1240, width: 1100, height: 70, text: 'with Midnight Circuit + Gloworm', fontFamily: 'Caveat', fontSize: 56, fill: '#00F0FF', align: 'center' }),
+ sh('rect', { x: 420, y: 1400, width: 400, height: 100, fill: '#FF2079', cornerRadius: 6 }),
+ tx({ x: 440, y: 1427, width: 360, height: 60, text: 'TICKETS $25', fontFamily: 'Archivo', bold: true, fontSize: 38, fill: '#0C0C14', align: 'center' }),
+ tx({ x: 70, y: 1620, width: 1100, height: 50, text: 'STATICWAVE.BAND \u00b7 PRESENTED BY NEON NIGHTS', fontFamily: 'Inter', bold: true, fontSize: 20, letterSpacing: 3, fill: '#66667A', align: 'center' }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'charity-fundraiser-flyer',
+ name: 'Charity Fundraiser',
+ category: 'print',
+ width: 1275,
+ height: 1650,
+ accent: '#2A9D8F',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'solid', color: '#FFF9F0' },
+ elements: [
+ sh('rect', { x: 0, y: 0, width: 1275, height: 90, fill: '#2A9D8F' }),
+ tx({ x: 60, y: 30, width: 1155, height: 50, text: 'COMMUNITY FUNDRAISER \u00b7 EVERY DOLLAR COUNTS', fontFamily: 'Inter', bold: true, fontSize: 22, letterSpacing: 3, fill: '#FFFFFF', align: 'center' }),
+ sh('ellipse', { x: 412, y: 170, width: 450, height: 450, fill: '#F4A261', opacity: 0.25 }),
+ gr('heart', { x: 512, y: 270, width: 250, height: 250, fill: '#E76F51' }),
+ tx({ x: 60, y: 680, width: 1155, height: 130, text: 'Gala for the', fontFamily: 'Playfair Display', fontSize: 92, fill: '#264653', align: 'center' }),
+ tx({ x: 60, y: 800, width: 1155, height: 130, text: 'Riverfront Shelter', fontFamily: 'Playfair Display', italic: true, fontSize: 92, fill: '#E76F51', align: 'center' }),
+ ln({ x: 535, y: 990, width: 200, height: 0, stroke: '#2A9D8F', strokeWidth: 5 }),
+ tx({ x: 140, y: 1040, width: 995, height: 130, text: 'An evening of dinner, local music and silent auction \u2014 all proceeds rebuild 40 beds before winter.', fontFamily: 'Inter', fontSize: 34, lineHeight: 1.6, fill: '#5A6B75', align: 'center' }),
+ sh('rect', { x: 385, y: 1230, width: 500, height: 100, fill: '#2A9D8F', cornerRadius: 50 }),
+ tx({ x: 405, y: 1258, width: 460, height: 60, text: 'SAT DEC 5 \u00b7 6 PM \u00b7 $60', fontFamily: 'Poppins', bold: true, fontSize: 34, fill: '#FFFFFF', align: 'center' }),
+ tx({ x: 60, y: 1420, width: 1155, height: 50, text: 'RIVERSIDESHELTER.ORG \u00b7 (555) 018-4400', fontFamily: 'Inter', bold: true, fontSize: 22, letterSpacing: 2, fill: '#8AA39B', align: 'center' }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'artisan-menu',
+ name: 'Artisan Cafe Menu',
+ category: 'print',
+ width: 1240,
+ height: 1754,
+ accent: '#5C4033',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'solid', color: '#F8F4EC' },
+ elements: [
+ sh('rect', { x: 70, y: 70, width: 1100, height: 1614, stroke: '#5C4033', strokeWidth: 3, fill: 'transparent' }),
+ sh('rect', { x: 90, y: 90, width: 1060, height: 1574, stroke: '#C4A484', strokeWidth: 1, fill: 'transparent' }),
+ tx({ x: 170, y: 200, width: 900, height: 110, text: 'THE DAILY', fontFamily: 'Cormorant Garamond', fontSize: 96, letterSpacing: 8, fill: '#5C4033', align: 'center' }),
+ tx({ x: 170, y: 320, width: 900, height: 60, text: 'GRIND \u00b7 SMALL BATCH COFFEE', fontFamily: 'Inter', bold: true, fontSize: 24, letterSpacing: 6, fill: '#A67C52', align: 'center' }),
+ ln({ x: 500, y: 420, width: 240, height: 0, stroke: '#A67C52', strokeWidth: 3 }),
+ tx({ x: 170, y: 500, width: 900, height: 70, text: 'ESPRESSO BAR', fontFamily: 'Cormorant Garamond', bold: true, fontSize: 52, fill: '#5C4033', align: 'center' }),
+ tx({ x: 200, y: 610, width: 420, height: 60, text: 'Espresso', fontFamily: 'Playfair Display', fontSize: 40, fill: '#3E2A20', align: 'left' }),
+ tx({ x: 820, y: 610, width: 220, height: 60, text: '3.5', fontFamily: 'DM Mono', fontSize: 36, fill: '#A67C52', align: 'right' }),
+ ln({ x: 200, y: 685, width: 840, height: 0, stroke: '#E0D4C0', strokeWidth: 2 }),
+ tx({ x: 200, y: 710, width: 420, height: 60, text: 'Flat White', fontFamily: 'Playfair Display', fontSize: 40, fill: '#3E2A20', align: 'left' }),
+ tx({ x: 820, y: 710, width: 220, height: 60, text: '4.5', fontFamily: 'DM Mono', fontSize: 36, fill: '#A67C52', align: 'right' }),
+ ln({ x: 200, y: 785, width: 840, height: 0, stroke: '#E0D4C0', strokeWidth: 2 }),
+ tx({ x: 200, y: 810, width: 420, height: 60, text: 'Honey Latte', fontFamily: 'Playfair Display', fontSize: 40, fill: '#3E2A20', align: 'left' }),
+ tx({ x: 820, y: 810, width: 220, height: 60, text: '5', fontFamily: 'DM Mono', fontSize: 36, fill: '#A67C52', align: 'right' }),
+ ln({ x: 200, y: 885, width: 840, height: 0, stroke: '#E0D4C0', strokeWidth: 2 }),
+ tx({ x: 170, y: 980, width: 900, height: 70, text: 'SEASONAL', fontFamily: 'Cormorant Garamond', bold: true, fontSize: 52, fill: '#5C4033', align: 'center' }),
+ tx({ x: 200, y: 1090, width: 420, height: 60, text: 'Pumpkin Cortado', fontFamily: 'Playfair Display', fontSize: 40, fill: '#3E2A20', align: 'left' }),
+ tx({ x: 820, y: 1090, width: 220, height: 60, text: '5.5', fontFamily: 'DM Mono', fontSize: 36, fill: '#A67C52', align: 'right' }),
+ ln({ x: 200, y: 1165, width: 840, height: 0, stroke: '#E0D4C0', strokeWidth: 2 }),
+ tx({ x: 200, y: 1190, width: 420, height: 60, text: 'Cardamom Cold Brew', fontFamily: 'Playfair Display', fontSize: 40, fill: '#3E2A20', align: 'left' }),
+ tx({ x: 820, y: 1190, width: 220, height: 60, text: '5.5', fontFamily: 'DM Mono', fontSize: 36, fill: '#A67C52', align: 'right' }),
+ st('\u2615', { x: 540, y: 1330, width: 160, height: 160, fontSize: 120 }),
+ tx({ x: 170, y: 1540, width: 900, height: 60, text: '7 AM \u2013 4 PM \u00b7 118 ELM STREET \u00b7 WIFI ON US', fontFamily: 'Inter', bold: true, fontSize: 20, letterSpacing: 3, fill: '#A67C52', align: 'center' }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'spa-voucher',
+ name: 'Spa Gift Voucher',
+ category: 'print',
+ width: 1240,
+ height: 874,
+ accent: '#7FB69B',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'gradient', from: '#EAF4EE', to: '#CDE5D7', angle: 135 },
+ elements: [
+ sh('rect', { x: 60, y: 60, width: 1120, height: 754, fill: '#FFFFFF', cornerRadius: 24 }),
+ sh('ellipse', { x: -120, y: 560, width: 420, height: 420, fill: '#7FB69B', opacity: 0.16 }),
+ sh('ellipse', { x: 960, y: -140, width: 380, height: 380, fill: '#7FB69B', opacity: 0.16 }),
+ tx({ x: 140, y: 150, width: 400, height: 50, text: 'GIFT VOUCHER', fontFamily: 'Inter', bold: true, fontSize: 26, letterSpacing: 6, fill: '#5C8A72', align: 'left' }),
+ tx({ x: 140, y: 230, width: 900, height: 120, text: 'A Day of Calm', fontFamily: 'Playfair Display', italic: true, fontSize: 96, fill: '#2E4A3B', align: 'left' }),
+ tx({ x: 144, y: 390, width: 760, height: 90, text: 'One full spa day \u2014 massage, facial, thermal suite & lunch for two', fontFamily: 'Inter', fontSize: 30, lineHeight: 1.5, fill: '#5C8A72', align: 'left' }),
+ ln({ x: 144, y: 520, width: 140, height: 0, stroke: '#C9A227', strokeWidth: 4 }),
+ tx({ x: 144, y: 560, width: 400, height: 80, text: 'VALUE $180', fontFamily: 'Archivo', bold: true, fontSize: 56, fill: '#2E4A3B', align: 'left' }),
+ tx({ x: 144, y: 680, width: 500, height: 50, text: 'SERENITY SPA \u00b7 VALID 12 MONTHS', fontFamily: 'Inter', bold: true, fontSize: 20, letterSpacing: 3, fill: '#8AA39B', align: 'left' }),
+ sh('rect', { x: 880, y: 560, width: 240, height: 160, fill: '#2E4A3B', cornerRadius: 12 }),
+ tx({ x: 900, y: 590, width: 200, height: 100, text: 'CODE\nCALM-2026', fontFamily: 'DM Mono', fontSize: 26, lineHeight: 1.6, fill: '#CDE5D7', align: 'center' }),
+ gr('check-circle', { x: 940, y: 160, width: 120, height: 120, fill: '#7FB69B' }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'open-house-yard-sign',
+ name: 'Open House Sign',
+ category: 'print',
+ width: 1224,
+ height: 612,
+ accent: '#D62828',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'solid', color: '#FFFFFF' },
+ elements: [
+ sh('rect', { x: 0, y: 0, width: 1224, height: 40, fill: '#D62828' }),
+ sh('rect', { x: 0, y: 572, width: 1224, height: 40, fill: '#003049' }),
+ tx({ x: 40, y: 110, width: 700, height: 200, text: 'OPEN', fontFamily: 'Anton', fontSize: 190, fill: '#D62828', align: 'left' }),
+ tx({ x: 44, y: 330, width: 700, height: 160, text: 'HOUSE', fontFamily: 'Anton', fontSize: 150, fill: '#003049', align: 'left' }),
+ tx({ x: 40, y: 500, width: 800, height: 60, text: 'TODAY \u00b7 1\u20134 PM \u00b7 WELCOME!', fontFamily: 'Poppins', bold: true, fontSize: 40, fill: '#333333', align: 'left' }),
+ sh('rect', { x: 860, y: 90, width: 330, height: 440, fill: '#003049', cornerRadius: 16 }),
+ tx({ x: 880, y: 130, width: 290, height: 90, text: '$649K', fontFamily: 'Archivo', bold: true, fontSize: 72, fill: '#FCBF49', align: 'center' }),
+ ln({ x: 920, y: 250, width: 210, height: 0, stroke: '#FCBF49', strokeWidth: 3 }),
+ tx({ x: 880, y: 280, width: 290, height: 90, text: '3 BED \u00b7 2 BATH\n0.28 ACRES', fontFamily: 'Poppins', bold: true, fontSize: 26, lineHeight: 1.6, fill: '#FFFFFF', align: 'center' }),
+ tx({ x: 880, y: 420, width: 290, height: 80, text: 'ASK FOR\nMARIA \u00b7 555-0177', fontFamily: 'Inter', fontSize: 22, lineHeight: 1.6, fill: '#B8C8D4', align: 'center' }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'dark-luxe-card',
+ name: 'Luxe Dark Card',
+ category: 'print',
+ width: 1050,
+ height: 600,
+ accent: '#C9A227',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'solid', color: '#101014' },
+ elements: [
+ sh('rect', { x: 0, y: 0, width: 1050, height: 600, stroke: '#C9A227', strokeWidth: 2, fill: 'transparent' }),
+ sh('ellipse', { x: 810, y: 180, width: 320, height: 320, stroke: '#C9A227', strokeWidth: 1, fill: 'transparent', opacity: 0.5 }),
+ gr('diamond', { x: 120, y: 90, width: 90, height: 90, fill: '#C9A227' }),
+ tx({ x: 120, y: 230, width: 700, height: 90, text: 'AURELIA VANCE', fontFamily: 'Cormorant Garamond', fontSize: 66, letterSpacing: 4, fill: '#F4EFE4', align: 'left' }),
+ tx({ x: 124, y: 330, width: 700, height: 60, text: 'Jewelry Designer & Goldsmith', fontFamily: 'Inter', fontSize: 26, letterSpacing: 3, fill: '#C9A227', align: 'left' }),
+ ln({ x: 124, y: 420, width: 100, height: 0, stroke: '#C9A227', strokeWidth: 3 }),
+ tx({ x: 124, y: 450, width: 700, height: 110, text: '[email protected] \u00b7 +33 6 55 01 88\naureliavance.co \u00b7 Paris', fontFamily: 'DM Mono', fontSize: 20, lineHeight: 1.8, fill: '#9B9783', align: 'left' }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'wedding-thank-you',
+ name: 'Wedding Thank You',
+ category: 'print',
+ width: 1050,
+ height: 600,
+ accent: '#B76E79',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'solid', color: '#FDF8F5' },
+ elements: [
+ sh('ellipse', { x: -100, y: -120, width: 340, height: 340, fill: '#F2D7D9', opacity: 0.7 }),
+ sh('ellipse', { x: 830, y: 420, width: 320, height: 320, fill: '#F2D7D9', opacity: 0.7 }),
+ gr('heart', { x: 465, y: 70, width: 120, height: 120, fill: '#B76E79' }),
+ tx({ x: 200, y: 220, width: 650, height: 100, text: 'Thank you', fontFamily: 'Cormorant Garamond', italic: true, fontSize: 96, fill: '#6B4A52', align: 'center' }),
+ tx({ x: 150, y: 360, width: 750, height: 110, text: 'for celebrating our day with us. Your love and laughter made it complete.', fontFamily: 'Cormorant Garamond', fontSize: 36, lineHeight: 1.6, fill: '#8A6B72', align: 'center' }),
+ ln({ x: 450, y: 510, width: 150, height: 0, stroke: '#B76E79', strokeWidth: 3 }),
+ tx({ x: 200, y: 530, width: 650, height: 50, text: 'WITH LOVE \u00b7 SOPHIE & MARCO \u00b7 10.10.2026', fontFamily: 'Inter', bold: true, fontSize: 18, letterSpacing: 4, fill: '#B76E79', align: 'center' }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'coupon-tear-off',
+ name: 'Coupon Special',
+ category: 'print',
+ width: 1240,
+ height: 874,
+ accent: '#E63946',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'solid', color: '#FFF8F0' },
+ elements: [
+ sh('rect', { x: 60, y: 60, width: 1120, height: 420, fill: '#E63946', cornerRadius: 20 }),
+ tx({ x: 140, y: 140, width: 700, height: 90, text: 'PIZZA NIGHT', fontFamily: 'Archivo', bold: true, fontSize: 76, fill: '#FFFFFF', align: 'left' }),
+ tx({ x: 144, y: 260, width: 800, height: 80, text: 'Any large pizza + 2 drinks', fontFamily: 'Inter', fontSize: 40, fill: '#FFE5D9', align: 'left' }),
+ ln({ x: 144, y: 370, width: 180, height: 0, stroke: '#FFD166', strokeWidth: 5 }),
+ tx({ x: 144, y: 400, width: 800, height: 60, text: 'DINE-IN OR TAKEAWAY \u00b7 EVERY TUESDAY', fontFamily: 'Inter', bold: true, fontSize: 22, letterSpacing: 2, fill: '#FFD166', align: 'left' }),
+ tx({ x: 860, y: 160, width: 280, height: 200, text: '$9.99', fontFamily: 'Anton', fontSize: 110, fill: '#FFD166', align: 'right' }),
+ ln({ x: 60, y: 540, width: 1120, height: 0, stroke: '#B3541E', strokeWidth: 3, dashed: true }),
+ sh('ellipse', { x: 30, y: 524, width: 36, height: 36, fill: '#FFF8F0' }),
+ sh('ellipse', { x: 1174, y: 524, width: 36, height: 36, fill: '#FFF8F0' }),
+ tx({ x: 100, y: 590, width: 1040, height: 70, text: 'Present this coupon at the counter. One per table, not combinable. Expires Dec 31, 2026.', fontFamily: 'Inter', fontSize: 24, fill: '#8A8A8A', align: 'center' }),
+ sh('rect', { x: 410, y: 690, width: 420, height: 100, fill: '#1D3557', cornerRadius: 10 }),
+ tx({ x: 430, y: 715, width: 380, height: 60, text: 'FIRESTONEPIZZA.COM', fontFamily: 'Poppins', bold: true, fontSize: 28, fill: '#FFFFFF', align: 'center' }),
+ ],
+ },
+ ],
+ },
+
+ // ── Premium · Documents ────────────────────────────────────
+ {
+ slug: 'project-proposal-doc',
+ name: 'Project Proposal',
+ category: 'document',
+ width: 1240,
+ height: 1754,
+ accent: '#1F4E79',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'solid', color: '#FFFFFF' },
+ elements: [
+ sh('rect', { x: 0, y: 0, width: 1240, height: 560, fill: '#1F4E79' }),
+ sh('ellipse', { x: 940, y: -120, width: 420, height: 420, fill: '#2E6DA4', opacity: 0.6 }),
+ tx({ x: 90, y: 180, width: 700, height: 60, text: 'PROPOSAL \u00b7 NOVEMBER 2026', fontFamily: 'Inter', bold: true, fontSize: 24, letterSpacing: 5, fill: '#9DC3E6', align: 'left' }),
+ tx({ x: 90, y: 260, width: 900, height: 130, text: 'Website Redesign', fontFamily: 'Playfair Display', fontSize: 88, fill: '#FFFFFF', align: 'left' }),
+ tx({ x: 90, y: 400, width: 900, height: 70, text: 'for Harborview Dental', fontFamily: 'Playfair Display', italic: true, fontSize: 48, fill: '#9DC3E6', align: 'left' }),
+ tx({ x: 90, y: 680, width: 500, height: 60, text: 'Prepared by', fontFamily: 'Inter', bold: true, fontSize: 24, letterSpacing: 3, fill: '#8A8A8A', align: 'left' }),
+ tx({ x: 90, y: 740, width: 500, height: 60, text: 'Studio Meraki', fontFamily: 'Poppins', bold: true, fontSize: 40, fill: '#1F4E79', align: 'left' }),
+ ln({ x: 90, y: 830, width: 140, height: 0, stroke: '#2E6DA4', strokeWidth: 4 }),
+ tx({ x: 90, y: 870, width: 500, height: 110, text: '[email protected]\n(555) 013-4477 \u00b7 studiomeraki.co', fontFamily: 'Inter', fontSize: 24, lineHeight: 1.7, fill: '#5A5A5A', align: 'left' }),
+ sh('rect', { x: 700, y: 660, width: 450, height: 320, fill: '#F2F7FC', cornerRadius: 14 }),
+ tx({ x: 740, y: 700, width: 370, height: 50, text: 'PROJECT SNAPSHOT', fontFamily: 'Inter', bold: true, fontSize: 20, letterSpacing: 3, fill: '#1F4E79', align: 'left' }),
+ tx({ x: 740, y: 760, width: 370, height: 200, text: 'Timeline \u2014 8 weeks\nBudget \u2014 $18,400\nPages \u2014 12 responsive\nDeliverables \u2014 design + build + CMS', fontFamily: 'Inter', fontSize: 24, lineHeight: 1.9, fill: '#3E3E3E', align: 'left' }),
+ tx({ x: 90, y: 1100, width: 1060, height: 60, text: '01 \u00b7 THE OPPORTUNITY', fontFamily: 'Poppins', bold: true, fontSize: 30, fill: '#1F4E79', align: 'left' }),
+ tx({ x: 90, y: 1180, width: 1060, height: 200, text: 'Harborview\u2019s current site predates mobile browsing: 71% of visitors leave within 15 seconds and online booking is a phone call. A modern, fast, accessible redesign converts those visits into appointments.', fontFamily: 'Inter', fontSize: 26, lineHeight: 1.7, fill: '#4A4A4A', align: 'left' }),
+ tx({ x: 90, y: 1450, width: 1060, height: 60, text: '02 \u00b7 SCOPE OF WORK', fontFamily: 'Poppins', bold: true, fontSize: 30, fill: '#1F4E79', align: 'left' }),
+ tx({ x: 90, y: 1530, width: 1060, height: 160, text: 'Discovery & UX audit \u00b7 wireframes \u00b7 visual design system \u00b7 responsive build \u00b7 CMS training \u00b7 30 days of support', fontFamily: 'Inter', fontSize: 26, lineHeight: 1.7, fill: '#4A4A4A', align: 'left' }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'community-newsletter',
+ name: 'Community Newsletter',
+ category: 'document',
+ width: 1275,
+ height: 1650,
+ accent: '#E07A5F',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'solid', color: '#FDF9F3' },
+ elements: [
+ sh('rect', { x: 0, y: 0, width: 1275, height: 120, fill: '#E07A5F' }),
+ tx({ x: 60, y: 42, width: 900, height: 60, text: 'THE ELM STREET BUGLE', fontFamily: 'Archivo', bold: true, fontSize: 36, letterSpacing: 3, fill: '#FFFFFF', align: 'left' }),
+ tx({ x: 950, y: 52, width: 280, height: 50, text: 'ISSUE 42 \u00b7 NOV \u201926', fontFamily: 'Inter', bold: true, fontSize: 22, fill: '#FDF0E0', align: 'right' }),
+ tx({ x: 60, y: 200, width: 760, height: 120, text: 'What\u2019s new on Elm Street', fontFamily: 'Playfair Display', fontSize: 76, fill: '#3D405B', align: 'left' }),
+ sh('rect', { x: 60, y: 360, width: 740, height: 3, fill: '#E07A5F' }),
+ tx({ x: 60, y: 410, width: 740, height: 60, text: '\ud83c\udf5c NEW BAKERY OPENS SATURDAY', fontFamily: 'Poppins', bold: true, fontSize: 30, fill: '#E07A5F', align: 'left' }),
+ tx({ x: 60, y: 490, width: 740, height: 200, text: 'Marge\u2019s Sourdough takes over the old corner unit. The first 50 customers get a free country loaf \u2014 line up early, the starter is 14 years old and legendary.', fontFamily: 'Inter', fontSize: 25, lineHeight: 1.7, fill: '#4A4A55', align: 'left' }),
+ tx({ x: 60, y: 730, width: 740, height: 60, text: '\ud83d\udea7 SIDEWALK REPAIRS NOV 10\u201314', fontFamily: 'Poppins', bold: true, fontSize: 30, fill: '#E07A5F', align: 'left' }),
+ tx({ x: 60, y: 810, width: 740, height: 200, text: 'The 400 block gets new curbs and trees. Street parking is limited those days \u2014 the farmers market moves to the school lot.', fontFamily: 'Inter', fontSize: 25, lineHeight: 1.7, fill: '#4A4A55', align: 'left' }),
+ tx({ x: 60, y: 1050, width: 740, height: 60, text: '\ud83c\udfa8 MURAL UNVEILING AT THE PARK', fontFamily: 'Poppins', bold: true, fontSize: 30, fill: '#E07A5F', align: 'left' }),
+ tx({ x: 60, y: 1130, width: 740, height: 170, text: 'Local artist Theo Kim painted 30 feet of river history on the underpass. Ribbon cutting Sunday 2 PM, bring the kids.', fontFamily: 'Inter', fontSize: 25, lineHeight: 1.7, fill: '#4A4A55', align: 'left' }),
+ sh('rect', { x: 860, y: 410, width: 360, height: 560, fill: '#3D405B', cornerRadius: 16 }),
+ tx({ x: 900, y: 460, width: 280, height: 60, text: 'MARKET DAY', fontFamily: 'Archivo', bold: true, fontSize: 36, fill: '#F2CC8F', align: 'left' }),
+ ln({ x: 900, y: 540, width: 90, height: 0, stroke: '#E07A5F', strokeWidth: 4 }),
+ tx({ x: 900, y: 580, width: 280, height: 330, text: 'Every Saturday\n8 AM \u2013 1 PM\n\n\u2022 produce\n\u2022 flowers\n\u2022 live music\n\u2022 coffee cart', fontFamily: 'Inter', fontSize: 26, lineHeight: 1.8, fill: '#E8E8F0', align: 'left' }),
+ sh('rect', { x: 60, y: 1400, width: 1160, height: 130, fill: '#F2CC8F', cornerRadius: 14 }),
+ tx({ x: 100, y: 1430, width: 1080, height: 70, text: 'Got news? [email protected] \u00b7 submissions close Fridays at noon', fontFamily: 'Poppins', bold: true, fontSize: 26, fill: '#3D405B', align: 'center' }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'ebook-cover-motivation',
+ name: 'Ebook Cover',
+ category: 'document',
+ width: 1600,
+ height: 2560,
+ accent: '#F77F00',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'gradient', from: '#0B132B', to: '#1C2541', angle: 160 },
+ elements: [
+ sh('ellipse', { x: 200, y: 400, width: 1200, height: 1200, stroke: '#F77F00', strokeWidth: 4, fill: 'transparent', opacity: 0.5 }),
+ sh('ellipse', { x: 380, y: 580, width: 840, height: 840, stroke: '#3A506B', strokeWidth: 3, fill: 'transparent' }),
+ tx({ x: 120, y: 300, width: 1360, height: 80, text: 'A FIELD GUIDE', fontFamily: 'Inter', bold: true, fontSize: 44, letterSpacing: 10, fill: '#5BC0BE', align: 'center' }),
+ tx({ x: 100, y: 1450, width: 1400, height: 300, text: 'DEEP', fontFamily: 'Anton', fontSize: 260, fill: '#FFFFFF', align: 'center' }),
+ tx({ x: 100, y: 1750, width: 1400, height: 300, text: 'WORK', fontFamily: 'Anton', fontSize: 260, fill: '#F77F00', align: 'center' }),
+ ln({ x: 620, y: 2130, width: 360, height: 0, stroke: '#5BC0BE', strokeWidth: 5 }),
+ tx({ x: 200, y: 2200, width: 1200, height: 110, text: 'How to produce more by protecting your attention', fontFamily: 'Cormorant Garamond', italic: true, fontSize: 56, fill: '#C9D6DF', align: 'center' }),
+ tx({ x: 120, y: 2380, width: 1360, height: 60, text: 'JONAS FELD \u00b7 2026', fontFamily: 'Inter', bold: true, fontSize: 32, letterSpacing: 6, fill: '#5BC0BE', align: 'center' }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'whitepaper-tech',
+ name: 'Tech Whitepaper',
+ category: 'document',
+ width: 1240,
+ height: 1754,
+ accent: '#4361EE',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'solid', color: '#F7F8FC' },
+ elements: [
+ sh('rect', { x: 0, y: 0, width: 440, height: 1754, fill: '#4361EE' }),
+ sh('ellipse', { x: -120, y: 1200, width: 500, height: 500, fill: '#3A0CA3', opacity: 0.55 }),
+ sh('ellipse', { x: 60, y: 220, width: 240, height: 240, stroke: '#4CC9F0', strokeWidth: 3, fill: 'transparent' }),
+ tx({ x: 520, y: 240, width: 640, height: 60, text: 'TECHNICAL WHITEPAPER \u00b7 V1.2', fontFamily: 'Inter', bold: true, fontSize: 22, letterSpacing: 3, fill: '#4361EE', align: 'left' }),
+ tx({ x: 520, y: 320, width: 660, height: 260, text: 'Event Sourcing for Modern Apps', fontFamily: 'Space Grotesk', bold: true, fontSize: 72, lineHeight: 1.15, fill: '#16213E', align: 'left' }),
+ tx({ x: 524, y: 640, width: 640, height: 120, text: 'An architecture that turns your data into an append-only story \u2014 with real code, benchmarks and war stories.', fontFamily: 'Inter', fontSize: 28, lineHeight: 1.6, fill: '#5A6072', align: 'left' }),
+ ln({ x: 524, y: 820, width: 140, height: 0, stroke: '#4CC9F0', strokeWidth: 5 }),
+ tx({ x: 524, y: 870, width: 620, height: 70, text: 'Kavya Iyer, Principal Engineer', fontFamily: 'Poppins', bold: true, fontSize: 30, fill: '#16213E', align: 'left' }),
+ tx({ x: 524, y: 930, width: 620, height: 50, text: 'Distributed Systems Group \u00b7 42 pages', fontFamily: 'Inter', fontSize: 24, fill: '#8A90A2', align: 'left' }),
+ sh('rect', { x: 524, y: 1060, width: 620, height: 240, fill: '#FFFFFF', cornerRadius: 14 }),
+ tx({ x: 564, y: 1090, width: 540, height: 50, text: 'INSIDE', fontFamily: 'Inter', bold: true, fontSize: 20, letterSpacing: 3, fill: '#4361EE', align: 'left' }),
+ tx({ x: 564, y: 1145, width: 540, height: 140, text: '1 Why CRUD breaks at scale\n2 The event log as source of truth\n3 Projections & materialized views\n4 Migration playbook', fontFamily: 'Inter', fontSize: 24, lineHeight: 1.7, fill: '#3E4455', align: 'left' }),
+ tx({ x: 524, y: 1400, width: 620, height: 60, text: 'Read free at canvix.dev/whitepapers', fontFamily: 'DM Mono', fontSize: 24, fill: '#4CC9F0', align: 'left' }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'press-release-kit',
+ name: 'Press Release',
+ category: 'document',
+ width: 1240,
+ height: 1754,
+ accent: '#8C2F39',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'solid', color: '#FFFFFF' },
+ elements: [
+ sh('rect', { x: 0, y: 0, width: 1240, height: 16, fill: '#8C2F39' }),
+ tx({ x: 100, y: 90, width: 900, height: 70, text: 'FOR IMMEDIATE RELEASE', fontFamily: 'Archivo', bold: true, fontSize: 34, letterSpacing: 4, fill: '#8C2F39', align: 'left' }),
+ ln({ x: 100, y: 180, width: 1040, height: 0, stroke: '#D9C5C0', strokeWidth: 2 }),
+ tx({ x: 100, y: 230, width: 1040, height: 180, text: 'Canvix hits one million designs created', fontFamily: 'Playfair Display', fontSize: 72, lineHeight: 1.2, fill: '#1A1A1A', align: 'left' }),
+ tx({ x: 100, y: 460, width: 1040, height: 90, text: 'Community-driven design tool reaches milestone in 14 months, staying 100% free', fontFamily: 'Inter', fontSize: 32, lineHeight: 1.5, fill: '#6B6B6B', align: 'left' }),
+ tx({ x: 100, y: 610, width: 1040, height: 220, text: 'October 28, 2026 \u2014 Canvix, the free and open-source design platform, today announced that its community has created over one million designs. Unlike commercial tools, every feature \u2014 templates, exports, collaboration \u2014 remains free for everyone, forever.', fontFamily: 'Inter', fontSize: 26, lineHeight: 1.75, fill: '#2E2E2E', align: 'left' }),
+ tx({ x: 100, y: 880, width: 1040, height: 180, text: '\u201cA million designs means a million posters, menus, resumes and wedding invites that nobody had to pay a subscription for,\u201d said the project\u2019s founder. \u201cThat was the whole point.\u201d', fontFamily: 'Cormorant Garamond', italic: true, fontSize: 36, lineHeight: 1.6, fill: '#8C2F39', align: 'left' }),
+ tx({ x: 100, y: 1110, width: 1040, height: 160, text: 'The milestone follows the release of the Canvix Agent Edition, which lets AI assistants edit designs through an open protocol while users watch changes live.', fontFamily: 'Inter', fontSize: 26, lineHeight: 1.75, fill: '#2E2E2E', align: 'left' }),
+ sh('rect', { x: 100, y: 1330, width: 1040, height: 3, fill: '#8C2F39' }),
+ tx({ x: 100, y: 1370, width: 1040, height: 60, text: 'MEDIA CONTACT', fontFamily: 'Archivo', bold: true, fontSize: 24, letterSpacing: 3, fill: '#8C2F39', align: 'left' }),
+ tx({ x: 100, y: 1420, width: 1040, height: 110, text: 'Press Team \u00b7 [email protected] \u00b7 +1 (555) 010-2026\nFull media kit & screenshots: canvix.dev/press', fontFamily: 'Inter', fontSize: 24, lineHeight: 1.7, fill: '#4A4A4A', align: 'left' }),
+ tx({ x: 100, y: 1600, width: 1040, height: 50, text: '\u2116 Canvix is free software, MIT licensed. canvix.dev', fontFamily: 'Inter', bold: true, fontSize: 20, fill: '#9A9A9A', align: 'left' }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'meeting-agenda-doc',
+ name: 'Meeting Agenda',
+ category: 'document',
+ width: 1240,
+ height: 1754,
+ accent: '#2F4858',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'solid', color: '#FFFFFF' },
+ elements: [
+ sh('rect', { x: 0, y: 0, width: 1240, height: 300, fill: '#2F4858' }),
+ tx({ x: 90, y: 80, width: 700, height: 60, text: 'WEEKLY SYNC \u00b7 PRODUCT TEAM', fontFamily: 'Inter', bold: true, fontSize: 24, letterSpacing: 4, fill: '#86BBD8', align: 'left' }),
+ tx({ x: 90, y: 150, width: 900, height: 100, text: 'Meeting Agenda', fontFamily: 'Poppins', bold: true, fontSize: 60, fill: '#FFFFFF', align: 'left' }),
+ tx({ x: 830, y: 170, width: 320, height: 90, text: 'THU \u00b7 NOV 6\n10:00 \u2013 11:00', fontFamily: 'DM Mono', fontSize: 28, lineHeight: 1.6, fill: '#86BBD8', align: 'right' }),
+ sh('rect', { x: 90, y: 370, width: 1060, height: 100, fill: '#F0F4F8', cornerRadius: 10 }),
+ tx({ x: 120, y: 396, width: 1000, height: 60, text: 'GOAL: align on Q1 priorities and unblock the launch checklist', fontFamily: 'Poppins', bold: true, fontSize: 26, fill: '#2F4858', align: 'left' }),
+ tx({ x: 90, y: 540, width: 500, height: 50, text: 'AGENDA', fontFamily: 'Archivo', bold: true, fontSize: 28, letterSpacing: 3, fill: '#2F4858', align: 'left' }),
+ ln({ x: 90, y: 600, width: 1060, height: 0, stroke: '#D8E2EA', strokeWidth: 3 }),
+ tx({ x: 90, y: 640, width: 160, height: 60, text: '10:00', fontFamily: 'DM Mono', fontSize: 28, fill: '#86BBD8', align: 'left' }),
+ tx({ x: 280, y: 640, width: 870, height: 60, text: 'Wins since last week \u2014 round the room', fontFamily: 'Inter', bold: true, fontSize: 28, fill: '#2E2E2E', align: 'left' }),
+ tx({ x: 280, y: 700, width: 870, height: 50, text: '5 min \u00b7 facilitator: Sam', fontFamily: 'Inter', fontSize: 22, fill: '#8A97A5', align: 'left' }),
+ ln({ x: 90, y: 780, width: 1060, height: 0, stroke: '#D8E2EA', strokeWidth: 2 }),
+ tx({ x: 90, y: 820, width: 160, height: 60, text: '10:05', fontFamily: 'DM Mono', fontSize: 28, fill: '#86BBD8', align: 'left' }),
+ tx({ x: 280, y: 820, width: 870, height: 60, text: 'Launch checklist review', fontFamily: 'Inter', bold: true, fontSize: 28, fill: '#2E2E2E', align: 'left' }),
+ tx({ x: 280, y: 880, width: 870, height: 50, text: '20 min \u00b7 owner: Priya \u00b7 decisions needed on pricing page', fontFamily: 'Inter', fontSize: 22, fill: '#8A97A5', align: 'left' }),
+ ln({ x: 90, y: 960, width: 1060, height: 0, stroke: '#D8E2EA', strokeWidth: 2 }),
+ tx({ x: 90, y: 1000, width: 160, height: 60, text: '10:25', fontFamily: 'DM Mono', fontSize: 28, fill: '#86BBD8', align: 'left' }),
+ tx({ x: 280, y: 1000, width: 870, height: 60, text: 'Q1 priority stack-rank', fontFamily: 'Inter', bold: true, fontSize: 28, fill: '#2E2E2E', align: 'left' }),
+ tx({ x: 280, y: 1060, width: 870, height: 50, text: '25 min \u00b7 owner: Maya \u00b7 come with your top 3', fontFamily: 'Inter', fontSize: 22, fill: '#8A97A5', align: 'left' }),
+ ln({ x: 90, y: 1140, width: 1060, height: 0, stroke: '#D8E2EA', strokeWidth: 2 }),
+ tx({ x: 90, y: 1180, width: 160, height: 60, text: '10:50', fontFamily: 'DM Mono', fontSize: 28, fill: '#86BBD8', align: 'left' }),
+ tx({ x: 280, y: 1180, width: 870, height: 60, text: 'Blockers & asks', fontFamily: 'Inter', bold: true, fontSize: 28, fill: '#2E2E2E', align: 'left' }),
+ tx({ x: 280, y: 1240, width: 870, height: 50, text: '10 min \u00b7 open floor', fontFamily: 'Inter', fontSize: 22, fill: '#8A97A5', align: 'left' }),
+ sh('rect', { x: 90, y: 1400, width: 1060, height: 200, fill: '#F0F4F8', cornerRadius: 10 }),
+ tx({ x: 120, y: 1430, width: 1000, height: 50, text: 'NOTES', fontFamily: 'Archivo', bold: true, fontSize: 22, letterSpacing: 3, fill: '#86BBD8', align: 'left' }),
+ ln({ x: 120, y: 1500, width: 1000, height: 0, stroke: '#C8D6E0', strokeWidth: 2 }),
+ ln({ x: 120, y: 1550, width: 1000, height: 0, stroke: '#C8D6E0', strokeWidth: 2 }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'invoice-studio',
+ name: 'Studio Invoice',
+ category: 'document',
+ width: 1240,
+ height: 1754,
+ accent: '#111111',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'solid', color: '#FFFFFF' },
+ elements: [
+ tx({ x: 90, y: 100, width: 600, height: 80, text: 'INVOICE', fontFamily: 'Archivo', bold: true, fontSize: 64, letterSpacing: 8, fill: '#111111', align: 'left' }),
+ tx({ x: 90, y: 190, width: 600, height: 50, text: 'NO. 2026-047', fontFamily: 'DM Mono', fontSize: 26, fill: '#8A8A8A', align: 'left' }),
+ sh('rect', { x: 780, y: 100, width: 370, height: 150, fill: '#111111', cornerRadius: 12 }),
+ tx({ x: 810, y: 125, width: 310, height: 50, text: 'AMOUNT DUE', fontFamily: 'Inter', bold: true, fontSize: 18, letterSpacing: 3, fill: '#9A9A9A', align: 'left' }),
+ tx({ x: 810, y: 160, width: 310, height: 70, text: '$4,850.00', fontFamily: 'Archivo', bold: true, fontSize: 48, fill: '#FFFFFF', align: 'left' }),
+ tx({ x: 90, y: 320, width: 340, height: 40, text: 'FROM', fontFamily: 'Inter', bold: true, fontSize: 18, letterSpacing: 3, fill: '#8A8A8A', align: 'left' }),
+ tx({ x: 90, y: 365, width: 380, height: 130, text: 'Studio Meraki\n42 Foundry Lane\[email protected]', fontFamily: 'Inter', fontSize: 24, lineHeight: 1.7, fill: '#2E2E2E', align: 'left' }),
+ tx({ x: 780, y: 320, width: 340, height: 40, text: 'BILL TO', fontFamily: 'Inter', bold: true, fontSize: 18, letterSpacing: 3, fill: '#8A8A8A', align: 'left' }),
+ tx({ x: 780, y: 365, width: 380, height: 130, text: 'Harborview Dental\nAttn: R. Patel\[email protected]', fontFamily: 'Inter', fontSize: 24, lineHeight: 1.7, fill: '#2E2E2E', align: 'left' }),
+ ln({ x: 90, y: 560, width: 1060, height: 0, stroke: '#111111', strokeWidth: 3 }),
+ tx({ x: 90, y: 600, width: 640, height: 40, text: 'DESCRIPTION', fontFamily: 'Inter', bold: true, fontSize: 18, letterSpacing: 2, fill: '#8A8A8A', align: 'left' }),
+ tx({ x: 840, y: 600, width: 140, height: 40, text: 'QTY', fontFamily: 'Inter', bold: true, fontSize: 18, fill: '#8A8A8A', align: 'right' }),
+ tx({ x: 1010, y: 600, width: 140, height: 40, text: 'AMOUNT', fontFamily: 'Inter', bold: true, fontSize: 18, fill: '#8A8A8A', align: 'right' }),
+ ln({ x: 90, y: 650, width: 1060, height: 0, stroke: '#E5E5E5', strokeWidth: 2 }),
+ tx({ x: 90, y: 690, width: 640, height: 60, text: 'Website redesign \u2014 discovery & audit', fontFamily: 'Inter', fontSize: 26, fill: '#2E2E2E', align: 'left' }),
+ tx({ x: 840, y: 690, width: 140, height: 60, text: '1', fontFamily: 'DM Mono', fontSize: 26, fill: '#2E2E2E', align: 'right' }),
+ tx({ x: 1010, y: 690, width: 140, height: 60, text: '1,200', fontFamily: 'DM Mono', fontSize: 26, fill: '#2E2E2E', align: 'right' }),
+ ln({ x: 90, y: 770, width: 1060, height: 0, stroke: '#E5E5E5', strokeWidth: 2 }),
+ tx({ x: 90, y: 810, width: 640, height: 60, text: 'Visual design system (12 pages)', fontFamily: 'Inter', fontSize: 26, fill: '#2E2E2E', align: 'left' }),
+ tx({ x: 840, y: 810, width: 140, height: 60, text: '1', fontFamily: 'DM Mono', fontSize: 26, fill: '#2E2E2E', align: 'right' }),
+ tx({ x: 1010, y: 810, width: 140, height: 60, text: '2,150', fontFamily: 'DM Mono', fontSize: 26, fill: '#2E2E2E', align: 'right' }),
+ ln({ x: 90, y: 890, width: 1060, height: 0, stroke: '#E5E5E5', strokeWidth: 2 }),
+ tx({ x: 90, y: 930, width: 640, height: 60, text: 'Responsive build & CMS integration', fontFamily: 'Inter', fontSize: 26, fill: '#2E2E2E', align: 'left' }),
+ tx({ x: 840, y: 930, width: 140, height: 60, text: '1', fontFamily: 'DM Mono', fontSize: 26, fill: '#2E2E2E', align: 'right' }),
+ tx({ x: 1010, y: 930, width: 140, height: 60, text: '1,500', fontFamily: 'DM Mono', fontSize: 26, fill: '#2E2E2E', align: 'right' }),
+ ln({ x: 90, y: 1010, width: 1060, height: 0, stroke: '#E5E5E5', strokeWidth: 2 }),
+ ln({ x: 640, y: 1080, width: 510, height: 0, stroke: '#111111', strokeWidth: 2 }),
+ tx({ x: 640, y: 1110, width: 380, height: 50, text: 'Subtotal', fontFamily: 'Inter', fontSize: 26, fill: '#5A5A5A', align: 'left' }),
+ tx({ x: 1010, y: 1110, width: 140, height: 50, text: '4,850', fontFamily: 'DM Mono', fontSize: 26, fill: '#5A5A5A', align: 'right' }),
+ tx({ x: 640, y: 1170, width: 380, height: 50, text: 'Total due', fontFamily: 'Inter', bold: true, fontSize: 30, fill: '#111111', align: 'left' }),
+ tx({ x: 1010, y: 1170, width: 140, height: 50, text: '$4,850', fontFamily: 'DM Mono', bold: true, fontSize: 30, fill: '#111111', align: 'right' }),
+ tx({ x: 90, y: 1330, width: 1060, height: 90, text: 'Payment terms: net 14. Bank transfer \u2014 Meraki Studio LLC \u00b7 0183-4471 \u00b7 Thanks for building with us.', fontFamily: 'Inter', fontSize: 24, lineHeight: 1.6, fill: '#8A8A8A', align: 'left' }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'case-study-saas',
+ name: 'Case Study',
+ category: 'document',
+ width: 1240,
+ height: 1754,
+ accent: '#6C4AB6',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'solid', color: '#FFFFFF' },
+ elements: [
+ sh('rect', { x: 0, y: 0, width: 1240, height: 460, fill: '#6C4AB6' }),
+ sh('ellipse', { x: 900, y: -100, width: 480, height: 480, fill: '#8D70C4', opacity: 0.5 }),
+ tx({ x: 90, y: 100, width: 700, height: 50, text: 'CASE STUDY \u00b7 E-COMMERCE', fontFamily: 'Inter', bold: true, fontSize: 22, letterSpacing: 4, fill: '#D6C6F5', align: 'left' }),
+ tx({ x: 90, y: 170, width: 900, height: 90, text: 'Bloom & Co.', fontFamily: 'Playfair Display', fontSize: 76, fill: '#FFFFFF', align: 'left' }),
+ tx({ x: 90, y: 280, width: 900, height: 60, text: 'From cart chaos to checkout calm', fontFamily: 'Inter', fontSize: 32, fill: '#D6C6F5', align: 'left' }),
+ tx({ x: 90, y: 530, width: 340, height: 160, text: '+64%', fontFamily: 'Archivo', bold: true, fontSize: 88, fill: '#6C4AB6', align: 'left' }),
+ tx({ x: 90, y: 700, width: 340, height: 90, text: 'checkout\ncompletion', fontFamily: 'Inter', fontSize: 24, lineHeight: 1.5, fill: '#5A5A5A', align: 'left' }),
+ tx({ x: 450, y: 530, width: 340, height: 160, text: '\u221241%', fontFamily: 'Archivo', bold: true, fontSize: 88, fill: '#6C4AB6', align: 'left' }),
+ tx({ x: 450, y: 700, width: 340, height: 90, text: 'support tickets\nper week', fontFamily: 'Inter', fontSize: 24, lineHeight: 1.5, fill: '#5A5A5A', align: 'left' }),
+ tx({ x: 810, y: 530, width: 340, height: 160, text: '9 days', fontFamily: 'Archivo', bold: true, fontSize: 88, fill: '#6C4AB6', align: 'left' }),
+ tx({ x: 810, y: 700, width: 340, height: 90, text: 'from kickoff\nto launch', fontFamily: 'Inter', fontSize: 24, lineHeight: 1.5, fill: '#5A5A5A', align: 'left' }),
+ ln({ x: 90, y: 840, width: 1060, height: 0, stroke: '#E5DCF5', strokeWidth: 3 }),
+ tx({ x: 90, y: 890, width: 1060, height: 60, text: 'THE CHALLENGE', fontFamily: 'Poppins', bold: true, fontSize: 28, fill: '#6C4AB6', align: 'left' }),
+ tx({ x: 90, y: 960, width: 1060, height: 180, text: 'Bloom & Co. sold beautiful plants through a checkout that fought the customer at every step: five pages, no guest option, and errors that vanished before you could read them.', fontFamily: 'Inter', fontSize: 26, lineHeight: 1.7, fill: '#4A4A4A', align: 'left' }),
+ tx({ x: 90, y: 1190, width: 1060, height: 60, text: 'WHAT WE DID', fontFamily: 'Poppins', bold: true, fontSize: 28, fill: '#6C4AB6', align: 'left' }),
+ tx({ x: 90, y: 1260, width: 1060, height: 180, text: 'Single-page checkout, guest purchases, inline validation, and an address autocomplete that cut typing by 70%. Then A/B tested everything for two weeks.', fontFamily: 'Inter', fontSize: 26, lineHeight: 1.7, fill: '#4A4A4A', align: 'left' }),
+ tx({ x: 90, y: 1480, width: 1060, height: 60, text: 'THE RESULT', fontFamily: 'Poppins', bold: true, fontSize: 28, fill: '#6C4AB6', align: 'left' }),
+ tx({ x: 90, y: 1550, width: 1060, height: 160, text: 'Checkout completion jumped in the first week and kept climbing. Support tickets about payments essentially disappeared.', fontFamily: 'Inter', fontSize: 26, lineHeight: 1.7, fill: '#4A4A4A', align: 'left' }),
+ ],
+ },
+ ],
+ },
+
+ // ── Premium · Video & thumbnails ───────────────────────────
+ {
+ slug: 'gaming-thumbnail',
+ name: 'Gaming Thumbnail',
+ category: 'thumbnail',
+ width: 1280,
+ height: 720,
+ accent: '#FF2E63',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'gradient', from: '#1A1A2E', to: '#16213E', angle: 120 },
+ elements: [
+ sh('ellipse', { x: -140, y: 380, width: 520, height: 520, fill: '#FF2E63', opacity: 0.35 }),
+ sh('ellipse', { x: 960, y: -160, width: 480, height: 480, fill: '#0F3460', opacity: 0.8 }),
+ tx({ x: 50, y: 140, width: 820, height: 160, text: 'I BEAT', fontFamily: 'Anton', fontSize: 130, fill: '#FFFFFF', align: 'left' }),
+ tx({ x: 50, y: 290, width: 820, height: 160, text: 'THE GAME', fontFamily: 'Anton', fontSize: 130, fill: '#FF2E63', align: 'left' }),
+ tx({ x: 54, y: 470, width: 700, height: 60, text: 'without dying once (insane)', fontFamily: 'Inter', bold: true, fontSize: 34, fill: '#EAEAEA', align: 'left' }),
+ sh('rect', { x: 50, y: 560, width: 250, height: 84, fill: '#FF2E63', cornerRadius: 10, rotation: -3 }),
+ tx({ x: 70, y: 580, width: 210, height: 60, text: 'NEW \u2605', fontFamily: 'Archivo', bold: true, fontSize: 38, fill: '#FFFFFF', align: 'center' }),
+ sh('rect', { x: 320, y: 566, width: 320, height: 72, fill: 'transparent', stroke: '#00E5A0', strokeWidth: 3, cornerRadius: 36 }),
+ tx({ x: 340, y: 584, width: 280, height: 50, text: '1M VIEWS', fontFamily: 'Archivo', bold: true, fontSize: 30, fill: '#00E5A0', align: 'center' }),
+ gr('bolt', { x: 1010, y: 380, width: 190, height: 190, fill: '#FFD166' }),
+ st('\ud83d\ude80', { x: 1030, y: 430, width: 150, height: 150, fontSize: 110 }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'tutorial-thumb',
+ name: 'Tutorial Thumbnail',
+ category: 'thumbnail',
+ width: 1280,
+ height: 720,
+ accent: '#2563EB',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'solid', color: '#0F172A' },
+ elements: [
+ sh('rect', { x: 0, y: 0, width: 640, height: 720, fill: '#1E293B' }),
+ sh('rect', { x: 60, y: 90, width: 440, height: 300, fill: '#2563EB', cornerRadius: 16 }),
+ tx({ x: 90, y: 140, width: 380, height: 200, text: 'CODE\nALONG', fontFamily: 'Space Grotesk', bold: true, fontSize: 72, lineHeight: 1.15, fill: '#FFFFFF', align: 'left' }),
+ sh('ellipse', { x: 215, y: 470, width: 130, height: 130, fill: '#38BDF8' }),
+ sh('triangle', { x: 265, y: 505, width: 60, height: 60, fill: '#0F172A', rotation: 90 }),
+ tx({ x: 700, y: 130, width: 520, height: 60, text: 'BEGINNER FRIENDLY', fontFamily: 'Inter', bold: true, fontSize: 26, letterSpacing: 3, fill: '#38BDF8', align: 'left' }),
+ tx({ x: 700, y: 200, width: 540, height: 200, text: 'Build a\nportfolio\nin 30 min', fontFamily: 'Poppins', bold: true, fontSize: 62, lineHeight: 1.2, fill: '#FFFFFF', align: 'left' }),
+ tx({ x: 704, y: 440, width: 520, height: 60, text: 'no paid tools \u00b7 100% free stack', fontFamily: 'Caveat', bold: true, fontSize: 44, fill: '#FACC15', align: 'left' }),
+ sh('rect', { x: 700, y: 540, width: 300, height: 76, fill: '#FACC15', cornerRadius: 38 }),
+ tx({ x: 720, y: 561, width: 260, height: 50, text: 'EPISODE 12', fontFamily: 'Archivo', bold: true, fontSize: 32, fill: '#0F172A', align: 'center' }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'podcast-episode-thumb',
+ name: 'Podcast Episode',
+ category: 'thumbnail',
+ width: 1280,
+ height: 720,
+ accent: '#F97316',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'solid', color: '#18181B' },
+ elements: [
+ sh('ellipse', { x: 780, y: 60, width: 600, height: 600, fill: '#F97316', opacity: 0.16 }),
+ sh('rect', { x: 0, y: 0, width: 14, height: 720, fill: '#F97316' }),
+ tx({ x: 70, y: 100, width: 700, height: 60, text: 'EPISODE 147 \u00b7 THE MAKERS PODCAST', fontFamily: 'Inter', bold: true, fontSize: 24, letterSpacing: 3, fill: '#F97316', align: 'left' }),
+ tx({ x: 70, y: 190, width: 780, height: 260, text: '\u201cI quit my job\nto make chairs\u201d', fontFamily: 'Playfair Display', italic: true, fontSize: 82, lineHeight: 1.15, fill: '#FAFAFA', align: 'left' }),
+ ln({ x: 74, y: 500, width: 140, height: 0, stroke: '#F97316', strokeWidth: 5 }),
+ tx({ x: 74, y: 540, width: 700, height: 60, text: 'with woodworker Elena Marsh', fontFamily: 'Inter', fontSize: 32, fill: '#A1A1AA', align: 'left' }),
+ sh('ellipse', { x: 900, y: 210, width: 260, height: 260, fill: '#F97316' }),
+ st('\ud83c\udfb2', { x: 950, y: 260, width: 160, height: 160, fontSize: 120 }),
+ tx({ x: 70, y: 620, width: 700, height: 50, text: 'LISTEN FREE \u00b7 WHEREVER YOU GET PODCASTS', fontFamily: 'Inter', bold: true, fontSize: 20, letterSpacing: 2, fill: '#71717A', align: 'left' }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'unboxing-thumb',
+ name: 'Unboxing Thumbnail',
+ category: 'thumbnail',
+ width: 1280,
+ height: 720,
+ accent: '#10B981',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'gradient', from: '#ECFDF5', to: '#A7F3D0', angle: 135 },
+ elements: [
+ sh('rect', { x: 60, y: 60, width: 520, height: 600, fill: '#FFFFFF', cornerRadius: 24 }),
+ sh('rect', { x: 220, y: 240, width: 200, height: 200, fill: '#10B981', cornerRadius: 12 }),
+ sh('rect', { x: 300, y: 150, width: 40, height: 100, fill: '#059669', cornerRadius: 8 }),
+ st('\u2702\ufe0f', { x: 90, y: 430, width: 130, height: 130, fontSize: 96, rotation: -20 }),
+ tx({ x: 650, y: 120, width: 580, height: 70, text: 'UNBOXING #23', fontFamily: 'Archivo', bold: true, fontSize: 44, letterSpacing: 2, fill: '#059669', align: 'left' }),
+ tx({ x: 650, y: 210, width: 580, height: 220, text: 'The $19\ndesk setup', fontFamily: 'Poppins', bold: true, fontSize: 76, lineHeight: 1.15, fill: '#064E3B', align: 'left' }),
+ tx({ x: 654, y: 470, width: 540, height: 60, text: 'every item tested for 30 days', fontFamily: 'Inter', fontSize: 30, fill: '#4B7C6B', align: 'left' }),
+ sh('rect', { x: 650, y: 550, width: 340, height: 80, fill: '#064E3B', cornerRadius: 40 }),
+ tx({ x: 670, y: 572, width: 300, height: 50, text: 'FULL REVIEW \u2192', fontFamily: 'Archivo', bold: true, fontSize: 32, fill: '#A7F3D0', align: 'center' }),
+ gr('sparkle', { x: 1060, y: 90, width: 120, height: 120, fill: '#FBBF24' }),
+ ],
+ },
+ ],
+ },
+
+ // ── Premium · Logos ────────────────────────────────────────
+ {
+ slug: 'orbit-tech-logo',
+ name: 'Orbit Tech Logo',
+ category: 'logo',
+ width: 800,
+ height: 800,
+ accent: '#4F46E5',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'solid', color: '#FFFFFF' },
+ elements: [
+ sh('ellipse', { x: 250, y: 250, width: 300, height: 300, stroke: '#4F46E5', strokeWidth: 18, fill: 'transparent' }),
+ sh('ellipse', { x: 170, y: 190, width: 460, height: 460, stroke: '#06B6D4', strokeWidth: 12, fill: 'transparent', rotation: -30 }),
+ sh('ellipse', { x: 490, y: 180, width: 90, height: 90, fill: '#06B6D4' }),
+ sh('ellipse', { x: 360, y: 370, width: 80, height: 80, fill: '#4F46E5' }),
+ tx({ x: 100, y: 660, width: 600, height: 80, text: 'ORBIT', fontFamily: 'Space Grotesk', bold: true, fontSize: 72, letterSpacing: 14, fill: '#1E1B4B', align: 'center' }),
+ tx({ x: 100, y: 740, width: 600, height: 40, text: 'T E C H N O L O G I E S', fontFamily: 'Inter', fontSize: 22, letterSpacing: 8, fill: '#6B7280', align: 'center' }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'bloom-cafe-logo',
+ name: 'Bloom Cafe Logo',
+ category: 'logo',
+ width: 800,
+ height: 800,
+ accent: '#D97706',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'solid', color: '#FFFBF2' },
+ elements: [
+ sh('ellipse', { x: 400, y: 230, width: 0, height: 0, fill: '#D97706' }),
+ sh('ellipse', { x: 280, y: 120, width: 120, height: 120, fill: '#F59E0B', rotation: 0 }),
+ sh('ellipse', { x: 400, y: 80, width: 120, height: 120, fill: '#D97706' }),
+ sh('ellipse', { x: 520, y: 120, width: 120, height: 120, fill: '#B45309' }),
+ sh('ellipse', { x: 330, y: 220, width: 100, height: 100, fill: '#92400E' }),
+ sh('ellipse', { x: 440, y: 220, width: 100, height: 100, fill: '#92400E' }),
+ tx({ x: 90, y: 420, width: 620, height: 120, text: 'Bloom', fontFamily: 'Playfair Display', italic: true, fontSize: 110, fill: '#451A03', align: 'center' }),
+ ln({ x: 280, y: 570, width: 240, height: 0, stroke: '#D97706', strokeWidth: 4 }),
+ tx({ x: 90, y: 600, width: 620, height: 60, text: 'CAFE \u00b7 ROASTERY', fontFamily: 'Inter', bold: true, fontSize: 30, letterSpacing: 10, fill: '#B45309', align: 'center' }),
+ st('\u2615', { x: 366, y: 680, width: 70, height: 70, fontSize: 52 }),
+ ],
+ },
+ ],
+ },
+ {
+ slug: 'apex-fitness-logo',
+ name: 'Apex Fitness Logo',
+ category: 'logo',
+ width: 800,
+ height: 800,
+ accent: '#DC2626',
+ badge: 'premium',
+ pages: [
+ {
+ id: 'p1',
+ background: { type: 'solid', color: '#0F0F10' },
+ elements: [
+ sh('triangle', { x: 240, y: 140, width: 320, height: 280, fill: '#DC2626' }),
+ sh('triangle', { x: 290, y: 200, width: 220, height: 180, fill: '#0F0F10' }),
+ sh('triangle', { x: 340, y: 250, width: 120, height: 100, fill: '#DC2626' }),
+ ln({ x: 160, y: 500, width: 480, height: 0, stroke: '#DC2626', strokeWidth: 8 }),
+ tx({ x: 100, y: 540, width: 600, height: 100, text: 'APEX', fontFamily: 'Anton', fontSize: 96, letterSpacing: 16, fill: '#FFFFFF', align: 'center' }),
+ tx({ x: 100, y: 660, width: 600, height: 50, text: 'STRENGTH \u00b7 CONDITIONING \u00b7 COMMUNITY', fontFamily: 'Inter', bold: true, fontSize: 20, letterSpacing: 4, fill: '#DC2626', align: 'center' }),
+ ],
+ },
+ ],
+ },
]
export function templatesAsRecords(): TemplateRecord[] {
diff --git a/src/store/editor-store.test.ts b/src/store/editor-store.test.ts
new file mode 100644
index 0000000..7f54218
--- /dev/null
+++ b/src/store/editor-store.test.ts
@@ -0,0 +1,141 @@
+// ─────────────────────────────────────────────────────────────
+// v0.7 rendering-performance invariants: structural sharing
+//
+// These tests lock in the guarantees the memoized canvas depends on:
+// 1. updateElementsLive gives NEW identities only to patched elements
+// 2. untouched pages keep referential identity across mutations
+// 3. undo/redo history snapshots share structure with live state
+// 4. history push/undo/redo round-trips document content correctly
+// ─────────────────────────────────────────────────────────────
+
+import { describe, expect, it, beforeEach } from 'vitest'
+import { useEditorStore } from '@/store/editor-store'
+import type { AnyElement, PageData } from '@/lib/types'
+
+function makeText(id: string, text: string, x = 10, y = 10): AnyElement {
+ return {
+ type: 'text',
+ id,
+ x,
+ y,
+ width: 200,
+ height: 40,
+ rotation: 0,
+ opacity: 1,
+ visible: true,
+ locked: false,
+ text,
+ fontSize: 32,
+ fontFamily: 'Inter',
+ fill: '#111111',
+ align: 'left',
+ bold: false,
+ italic: false,
+ underline: false,
+ strike: false,
+ lineHeight: 1.25,
+ letterSpacing: 0,
+ uppercase: false,
+ } as unknown as AnyElement
+}
+
+function seedTwoPages(): { pageA: PageData; pageB: PageData } {
+ const pageA: PageData = {
+ id: 'page-a',
+ background: { type: 'solid', color: '#FFFFFF' },
+ elements: [makeText('t1', 'Hello'), makeText('t2', 'World', 10, 80)],
+ }
+ const pageB: PageData = {
+ id: 'page-b',
+ background: { type: 'solid', color: '#000000' },
+ elements: [makeText('t3', 'Second page')],
+ }
+ useEditorStore.setState({
+ pages: [pageA, pageB],
+ currentPage: 0,
+ selectedIds: [],
+ past: [],
+ future: [],
+ dirty: false,
+ version: 0,
+ designId: 'test-design',
+ })
+ return { pageA, pageB }
+}
+
+describe('editor-store structural sharing (v0.7)', () => {
+ beforeEach(() => seedTwoPages())
+
+ it('updateElementsLive replaces only the patched element identities', () => {
+ const { pages } = useEditorStore.getState()
+ useEditorStore.getState().updateElementsLive(['t1'], { text: 'Changed' })
+
+ const next = useEditorStore.getState().pages
+ // untouched page keeps identity
+ expect(next[1]).toBe(pages[1])
+ // touched page is a new object
+ expect(next[0]).not.toBe(pages[0])
+ const els = next[0].elements
+ // untouched element keeps identity → memoized node skips re-render
+ expect(els.find((e) => e.id === 't2')).toBe(pages[0].elements.find((e) => e.id === 't2'))
+ // patched element has a new identity with the new value
+ const t1 = els.find((e) => e.id === 't1')
+ expect(t1).not.toBe(pages[0].elements.find((e) => e.id === 't1'))
+ expect((t1 as { text: string }).text).toBe('Changed')
+ })
+
+ it('mutations never modify the previous pages snapshot in place', () => {
+ const before = useEditorStore.getState().pages
+ const snapshot = JSON.parse(JSON.stringify(before))
+ useEditorStore.getState().updateElementsLive(['t1'], { text: 'Typing…' })
+ useEditorStore.getState().addElement(makeText('t9', 'Added', 5, 5))
+ useEditorStore.getState().setPageBackground({ type: 'solid', color: '#FFEE00' })
+ useEditorStore.getState().undo()
+ // the ORIGINAL reference must still match its own deep value
+ expect(JSON.parse(JSON.stringify(before))).toEqual(snapshot)
+ })
+
+ it('history snapshots share structure with live state (O(1) push)', () => {
+ const before = useEditorStore.getState().pages
+ useEditorStore.getState().pushHistory()
+ const past = useEditorStore.getState().past
+ expect(past.length).toBe(1)
+ // snapshot stores the same reference — no deep clone
+ expect(past[past.length - 1].pages).toBe(before)
+ })
+
+ it('undo/redo round-trips content and shares structure', () => {
+ const original = useEditorStore.getState().pages
+ useEditorStore.getState().pushHistory()
+ useEditorStore.getState().updateElementsLive(['t2'], { x: 999 })
+ useEditorStore.getState().undo()
+
+ const restored = useEditorStore.getState().pages
+ // content round-trips…
+ expect((restored[0].elements.find((e) => e.id === 't2') as { x: number }).x).toBe(10)
+ // …and the restored reference IS the pre-edit snapshot (structural sharing)
+ expect(restored).toBe(original)
+
+ useEditorStore.getState().redo()
+ const redone = useEditorStore.getState().pages
+ expect((redone[0].elements.find((e) => e.id === 't2') as { x: number }).x).toBe(999)
+ })
+
+ it('applyRemoteOp keeps untouched page identity (remote live edit)', () => {
+ const before = useEditorStore.getState().pages
+ useEditorStore.getState().applyRemoteOp({
+ seq: 1,
+ id: 'evt-1',
+ designId: 'test-design',
+ actorId: 'remote-agent',
+ kind: 'elements:update',
+ payload: { pageId: 'page-a', ids: ['t1'], patch: { x: 4242 } },
+ createdAt: new Date().toISOString(),
+ })
+
+ const next = useEditorStore.getState().pages
+ expect(next[1]).toBe(before[1])
+ expect((next[0].elements.find((e) => e.id === 't1') as { x: number }).x).toBe(4242)
+ expect(next[0].elements.find((e) => e.id === 't2')).toBe(before[0].elements.find((e) => e.id === 't2'))
+ })
+})
diff --git a/src/store/editor-store.ts b/src/store/editor-store.ts
index 20a76cc..8f6a8dc 100644
--- a/src/store/editor-store.ts
+++ b/src/store/editor-store.ts
@@ -211,6 +211,23 @@ interface EditorState {
const clone = <T,>(v: T): T => (typeof structuredClone === 'function' ? structuredClone(v) : JSON.parse(JSON.stringify(v)))
+// ── v0.7 rendering performance: structural sharing ────────────
+// Every mutation below builds NEW page/element objects and never mutates
+// existing ones. Untouched pages and elements keep referential identity,
+// so memoized canvas nodes skip re-rendering and undo/redo history can
+// share structure (snapshots are plain references — no deep clones).
+
+/** fresh page object with individually-cloned elements */
+const clonePage = (p: PageData): PageData => ({ ...p, elements: p.elements.map((e) => clone(e)) })
+
+/** new pages array where only `index` gets a fresh page object (safe for
+ * call sites that still mutate that page's element list in place) */
+const editPage = (pages: PageData[], index: number): PageData[] =>
+ pages.map((p, i) => (i === index ? clonePage(p) : p))
+
+/** new array of pages where every page is a fresh copy */
+const cloneAllPages = (pages: PageData[]): PageData[] => pages.map(clonePage)
+
const ZOOM_MIN = 0.05
const ZOOM_MAX = 8
const HISTORY_LIMIT = 60
@@ -298,12 +315,14 @@ export const useEditorStore = create<EditorState>((set, get) => ({
},
pushHistory: () => {
- const { pages, currentPage, past, version } = get()
+ // v0.7: snapshots share structure — pages are never mutated in place,
+ // so storing the reference is safe and keeps history O(1) per push.
+ const { pages, currentPage, past } = get()
set({
- past: [...past.slice(-HISTORY_LIMIT + 1), { pages: clone(pages), currentPage }],
+ past: [...past.slice(-HISTORY_LIMIT + 1), { pages, currentPage }],
future: [],
dirty: true,
- version: version + 1,
+ version: get().version + 1,
})
},
@@ -315,7 +334,7 @@ export const useEditorStore = create<EditorState>((set, get) => ({
pages: prev.pages,
currentPage: Math.min(prev.currentPage, prev.pages.length - 1),
past: past.slice(0, -1),
- future: [...future, { pages: clone(pages), currentPage }],
+ future: [...future, { pages, currentPage }],
selectedIds: [],
dirty: true,
version: version + 1,
@@ -333,7 +352,7 @@ export const useEditorStore = create<EditorState>((set, get) => ({
pages: next.pages,
currentPage: Math.min(next.currentPage, next.pages.length - 1),
future: future.slice(0, -1),
- past: [...past, { pages: clone(pages), currentPage }],
+ past: [...past, { pages, currentPage }],
selectedIds: [],
dirty: true,
version: version + 1,
@@ -353,17 +372,26 @@ export const useEditorStore = create<EditorState>((set, get) => ({
addElement: (el) => {
get().pushHistory()
const { pages, currentPage } = get()
- const next = clone(pages)
+ const next = editPage(pages, currentPage)
next[currentPage].elements.push(el)
set({ pages: next, selectedIds: [el.id] })
emit({ kind: 'element:add', pageId: next[currentPage].id, element: el })
},
updateElementsLive: (ids, patch) => {
+ // v0.7 hot path (typing, slider drags, remote/MCP live edits):
+ // pure immutable update — only the patched elements get new identities,
+ // every other page/element keeps its reference so memoized nodes skip.
const { pages, currentPage, version } = get()
- const next = clone(pages)
- next[currentPage].elements = next[currentPage].elements.map((e) =>
- ids.includes(e.id) ? ({ ...e, ...patch } as AnyElement) : e
+ const idSet = ids.length > 4 ? new Set(ids) : null
+ const hit = idSet ? (id: string) => idSet.has(id) : (id: string) => ids.includes(id)
+ const next = pages.map((p, i) =>
+ i !== currentPage
+ ? p
+ : {
+ ...p,
+ elements: p.elements.map((e) => (hit(e.id) ? ({ ...e, ...patch } as AnyElement) : e)),
+ }
)
set({ pages: next, version: version + 1, dirty: true })
emit({ kind: 'elements:update', pageId: next[currentPage].id, ids: [...ids], patch: { ...patch } })
@@ -379,7 +407,7 @@ export const useEditorStore = create<EditorState>((set, get) => ({
if (!selectedIds.length) return
get().pushHistory()
const { pages, currentPage } = get()
- const next = clone(pages)
+ const next = editPage(pages, currentPage)
next[currentPage].elements = next[currentPage].elements.filter((e) => !selectedIds.includes(e.id))
set({ pages: next, selectedIds: [] })
emit({ kind: 'element:delete', pageId: next[currentPage].id, ids: [...selectedIds] })
@@ -393,7 +421,7 @@ export const useEditorStore = create<EditorState>((set, get) => ({
const clones = page.elements
.filter((e) => selectedIds.includes(e.id))
.map((e) => ({ ...clone(e), id: uid(e.type), x: e.x + 32, y: e.y + 32 }))
- const next = clone(pages)
+ const next = editPage(pages, currentPage)
next[currentPage].elements = [...next[currentPage].elements, ...clones]
set({ pages: next, selectedIds: clones.map((c) => c.id) })
emit({ kind: 'elements:add', pageId: next[currentPage].id, elements: clones })
@@ -416,7 +444,7 @@ export const useEditorStore = create<EditorState>((set, get) => ({
get().pushHistory()
const clones = clipboard.map((e) => ({ ...clone(e), id: uid(e.type), x: e.x + 32, y: e.y + 32 }))
const { pages, currentPage } = get()
- const next = clone(pages)
+ const next = editPage(pages, currentPage)
next[currentPage].elements = [...next[currentPage].elements, ...clones]
set({ pages: next, selectedIds: clones.map((c) => c.id) })
emit({ kind: 'elements:add', pageId: next[currentPage].id, elements: clones })
@@ -425,7 +453,7 @@ export const useEditorStore = create<EditorState>((set, get) => ({
moveLayer: (id, dir) => {
get().pushHistory()
const { pages, currentPage } = get()
- const next = clone(pages)
+ const next = editPage(pages, currentPage)
const els = next[currentPage].elements
const i = els.findIndex((e) => e.id === id)
if (i === -1) return
@@ -446,7 +474,7 @@ export const useEditorStore = create<EditorState>((set, get) => ({
if (i === -1) return
if (i === targetIndex) return
get().pushHistory()
- const next = clone(pages)
+ const next = editPage(pages, currentPage)
const arr = next[currentPage].elements
arr.splice(targetIndex, 0, ...arr.splice(i, 1))
set({ pages: next })
@@ -463,7 +491,7 @@ export const useEditorStore = create<EditorState>((set, get) => ({
if (children.length < 2) return
get().pushHistory()
const group = createGroupElement(children)
- const next = clone(pages)
+ const next = editPage(pages, currentPage)
next[currentPage].elements = [...next[currentPage].elements.filter((e) => !selectedIds.includes(e.id)), group]
set({ pages: next, selectedIds: [group.id] })
emit({ kind: 'page:replace', pageId: next[currentPage].id, page: next[currentPage] })
@@ -475,7 +503,7 @@ export const useEditorStore = create<EditorState>((set, get) => ({
const groups = page.elements.filter((e) => selectedIds.includes(e.id) && e.type === 'group')
if (!groups.length) return
get().pushHistory()
- const next = clone(pages)
+ const next = editPage(pages, currentPage)
let released: string[] = []
for (const g of groups) {
if (g.type !== 'group') continue
@@ -510,18 +538,24 @@ export const useEditorStore = create<EditorState>((set, get) => ({
if (!ids.length) return
get().pushHistory()
const { pages, currentPage, width, height } = get()
- const next = clone(pages)
- next[currentPage].elements = next[currentPage].elements.map((el) => {
- if (!ids.includes(el.id)) return el
- switch (mode) {
- case 'left': return { ...el, x: 0 }
- case 'cx': return { ...el, x: Math.round((width - el.width) / 2) }
- case 'right': return { ...el, x: width - el.width }
- case 'top': return { ...el, y: 0 }
- case 'cy': return { ...el, y: Math.round((height - el.height) / 2) }
- case 'bottom': return { ...el, y: height - el.height }
- }
- })
+ const next = pages.map((p, i) =>
+ i !== currentPage
+ ? p
+ : {
+ ...p,
+ elements: p.elements.map((el) => {
+ if (!ids.includes(el.id)) return el
+ switch (mode) {
+ case 'left': return { ...el, x: 0 }
+ case 'cx': return { ...el, x: Math.round((width - el.width) / 2) }
+ case 'right': return { ...el, x: width - el.width }
+ case 'top': return { ...el, y: 0 }
+ case 'cy': return { ...el, y: Math.round((height - el.height) / 2) }
+ case 'bottom': return { ...el, y: height - el.height }
+ }
+ }),
+ }
+ )
set({ pages: next })
emit({ kind: 'page:replace', pageId: next[currentPage].id, page: next[currentPage] })
},
@@ -530,13 +564,19 @@ export const useEditorStore = create<EditorState>((set, get) => ({
const { selectedIds, pages, currentPage } = get()
if (!selectedIds.length) return
get().pushHistory()
- const next = clone(pages)
- next[currentPage].elements = next[currentPage].elements.map((el) => {
- if (!selectedIds.includes(el.id)) return el
- if (el.type === 'image') return { ...el, flipH: axis === 'h' ? !el.flipH : el.flipH, flipV: axis === 'v' ? !el.flipV : el.flipV }
- // shapes/text: mirror via negative scale is not in the model; rotate 180 for symmetric flip feel
- return { ...el, rotation: (el.rotation + (axis === 'h' ? 0 : 180)) % 360 }
- })
+ const next = pages.map((p, i) =>
+ i !== currentPage
+ ? p
+ : {
+ ...p,
+ elements: p.elements.map((el) => {
+ if (!selectedIds.includes(el.id)) return el
+ if (el.type === 'image') return { ...el, flipH: axis === 'h' ? !el.flipH : el.flipH, flipV: axis === 'v' ? !el.flipV : el.flipV }
+ // shapes/text: mirror via negative scale is not in the model; rotate 180 for symmetric flip feel
+ return { ...el, rotation: (el.rotation + (axis === 'h' ? 0 : 180)) % 360 }
+ }),
+ }
+ )
set({ pages: next })
emit({ kind: 'page:replace', pageId: next[currentPage].id, page: next[currentPage] })
},
@@ -545,7 +585,7 @@ export const useEditorStore = create<EditorState>((set, get) => ({
get().pushHistory()
const { pages } = get()
const page: PageData = { id: uid('page'), background: { type: 'solid', color: '#FFFFFF' }, elements: [] }
- set({ pages: [...clone(pages), page] })
+ set({ pages: [...pages, page] })
emit({ kind: 'page:add', page })
},
@@ -554,7 +594,7 @@ export const useEditorStore = create<EditorState>((set, get) => ({
if (pages.length <= 1) return
get().pushHistory()
const removedId = pages[index].id
- const next = clone(pages)
+ const next = [...pages]
next.splice(index, 1)
set({ pages: next, currentPage: Math.min(index, next.length - 1), selectedIds: [] })
emit({ kind: 'page:delete', pageId: removedId })
@@ -563,8 +603,8 @@ export const useEditorStore = create<EditorState>((set, get) => ({
duplicatePage: (index) => {
get().pushHistory()
const { pages } = get()
- const next = clone(pages)
- const copy = clone(next[index])
+ const next = [...pages]
+ const copy = clonePage(pages[index])
copy.id = uid('page')
copy.elements = copy.elements.map((e) => ({ ...e, id: uid(e.type) }))
next.splice(index + 1, 0, copy)
@@ -577,8 +617,7 @@ export const useEditorStore = create<EditorState>((set, get) => ({
setPageBackground: (bg) => {
get().pushHistory()
const { pages, currentPage } = get()
- const next = clone(pages)
- next[currentPage].background = bg
+ const next = pages.map((p, i) => (i !== currentPage ? p : { ...p, background: bg }))
set({ pages: next })
emit({ kind: 'page:background', pageId: next[currentPage].id, background: bg })
},
@@ -647,7 +686,7 @@ export const useEditorStore = create<EditorState>((set, get) => ({
name: designName,
width,
height,
- pages: clone(pages),
+ pages, // v0.7: immutable snapshot — reference shares structure, no deep clone
}
const next = [v, ...versions].slice(0, 30) // keep the 30 most recent
set({ versions: next })
@@ -671,7 +710,7 @@ export const useEditorStore = create<EditorState>((set, get) => ({
if (!v) return
get().pushHistory()
set({
- pages: clone(v.pages),
+ pages: cloneAllPages(v.pages), // detach from the stored version snapshot
width: v.width,
height: v.height,
designName: v.name,
@@ -701,7 +740,7 @@ export const useEditorStore = create<EditorState>((set, get) => ({
const { pages, width: oldW, height: oldH } = get()
// v0.4 magic resize: smart re-layout — elements scale & keep their relative
// position instead of all being dumped in the centre
- const next = magicRelayoutPages(clone(pages), oldW, oldH, width, height)
+ const next = magicRelayoutPages(cloneAllPages(pages), oldW, oldH, width, height)
set({ width, height, pages: next, selectedIds: [], zoom: 1 })
emit({ kind: 'pages:replace', pages: next, width, height })
},
@@ -717,7 +756,7 @@ export const useEditorStore = create<EditorState>((set, get) => ({
if (el.type === 'group') return { ...el, children: applyTexts(el.children) }
return map.has(el.id) ? ({ ...el, text: map.get(el.id)! } as AnyElement) : el
})
- const next = clone(pages).map((p) => ({ ...p, elements: applyTexts(p.elements) }))
+ const next = pages.map((p) => ({ ...p, elements: applyTexts(p.elements) }))
set({ pages: next, version: version + 1, dirty: true })
emit({ kind: 'pages:replace', pages: next })
},
@@ -727,7 +766,7 @@ export const useEditorStore = create<EditorState>((set, get) => ({
if (!els.length) return
get().pushHistory()
const { pages, currentPage } = get()
- const next = clone(pages)
+ const next = editPage(pages, currentPage)
next[currentPage].elements = [...next[currentPage].elements, ...els.map((e) => clone(e))]
set({ pages: next, selectedIds: els.map((e) => e.id) })
emit({ kind: 'elements:add', pageId: next[currentPage].id, elements: els })
@@ -735,15 +774,15 @@ export const useEditorStore = create<EditorState>((set, get) => ({
replaceCurrentPage: (page) => {
get().pushHistory()
const { pages, currentPage } = get()
- const next = clone(pages)
- next[currentPage] = clone(page)
+ const next = [...pages]
+ next[currentPage] = clonePage(page)
set({ pages: next, selectedIds: [] })
emit({ kind: 'page:replace', pageId: page.id, page })
},
appendPage: (page) => {
get().pushHistory()
const { pages } = get()
- set({ pages: [...clone(pages), clone(page)], currentPage: pages.length, selectedIds: [] })
+ set({ pages: [...pages, clonePage(page)], currentPage: pages.length, selectedIds: [] })
emit({ kind: 'page:add', page })
},
@@ -760,9 +799,15 @@ export const useEditorStore = create<EditorState>((set, get) => ({
if (!ids.length) return
get().pushHistory()
const { pages, currentPage } = get()
- const next = clone(pages)
- next[currentPage].elements = next[currentPage].elements.map((e) =>
- ids.includes(e.id) ? { ...e, animation: animation ?? undefined } : e
+ const next = pages.map((p, i) =>
+ i !== currentPage
+ ? p
+ : {
+ ...p,
+ elements: p.elements.map((e) =>
+ ids.includes(e.id) ? { ...e, animation: animation ?? undefined } : e
+ ),
+ }
)
set({ pages: next })
emit({
@@ -774,26 +819,23 @@ export const useEditorStore = create<EditorState>((set, get) => ({
setPageTransition: (transition) => {
get().pushHistory()
const { pages, currentPage } = get()
- const next = clone(pages)
- next[currentPage] = { ...next[currentPage], transition: transition ?? undefined }
+ const next = pages.map((p, i) => (i !== currentPage ? p : { ...p, transition: transition ?? undefined }))
set({ pages: next })
emit({ kind: 'page:replace', pageId: next[currentPage].id, page: next[currentPage] })
},
magicAnimateCurrentPage: (speed = 'medium') => {
get().pushHistory()
const { pages, currentPage, height } = get()
- const next = clone(pages)
- const animated = magicAnimatePage(next[currentPage], height, speed)
- next[currentPage] = animated
+ const next = pages.map((p, i) => (i !== currentPage ? p : magicAnimatePage(p, height, speed)))
+ const animated = next[currentPage]
set({ pages: next })
emit({ kind: 'page:replace', pageId: animated.id, page: animated })
},
clearPageAnimations: () => {
get().pushHistory()
const { pages, currentPage } = get()
- const next = clone(pages)
- const cleared = clearPageAnimations(next[currentPage])
- next[currentPage] = cleared
+ const next = pages.map((p, i) => (i !== currentPage ? p : clearPageAnimations(p)))
+ const cleared = next[currentPage]
set({ pages: next })
emit({ kind: 'page:replace', pageId: cleared.id, page: cleared })
},
@@ -805,21 +847,24 @@ export const useEditorStore = create<EditorState>((set, get) => ({
const payload = event.payload as Record<string, unknown> | null
if (!payload) return
const { pages, version } = get()
- const next = clone(pages)
- const findPage = (pageId: unknown): number =>
- next.findIndex((p) => p.id === pageId)
+ const findPage = (pageId: unknown): number => pages.findIndex((p) => p.id === pageId)
- const applyToPage = (pageId: unknown, fn: (page: PageData) => PageData): void => {
+ // v0.7: immutable update — only the touched page gets a new object;
+ // untouched pages/elements keep identity so memoized nodes skip re-render.
+ const mapPage = (pageId: unknown, fn: (page: PageData) => PageData): PageData[] => {
const i = findPage(pageId)
- if (i >= 0) next[i] = fn(next[i])
+ if (i < 0) return pages
+ return pages.map((p, k) => (k === i ? fn(p) : p))
}
+ let next = pages
+
switch (event.kind) {
case 'elements:update': {
const ids = (payload.ids as string[]) ?? []
const patch = (payload.patch as Record<string, unknown>) ?? {}
- applyToPage(payload.pageId, (page) => ({
+ next = mapPage(payload.pageId, (page) => ({
...page,
elements: page.elements.map((e) => (ids.includes(e.id) ? ({ ...e, ...patch } as AnyElement) : e)),
}))
@@ -828,7 +873,7 @@ export const useEditorStore = create<EditorState>((set, get) => ({
case 'element:add': {
const el = payload.element as AnyElement | undefined
if (el?.id) {
- applyToPage(payload.pageId, (page) =>
+ next = mapPage(payload.pageId, (page) =>
page.elements.some((e) => e.id === el.id) ? page : { ...page, elements: [...page.elements, clone(el)] }
)
}
@@ -837,7 +882,7 @@ export const useEditorStore = create<EditorState>((set, get) => ({
case 'elements:add': {
const els = (payload.elements as AnyElement[]) ?? []
if (els.length) {
- applyToPage(payload.pageId, (page) => {
+ next = mapPage(payload.pageId, (page) => {
const known = new Set(page.elements.map((e) => e.id))
return { ...page, elements: [...page.elements, ...els.filter((e) => !known.has(e.id)).map((e) => clone(e))] }
})
@@ -846,12 +891,12 @@ export const useEditorStore = create<EditorState>((set, get) => ({
}
case 'element:delete': {
const ids = new Set((payload.ids as string[]) ?? [])
- applyToPage(payload.pageId, (page) => ({ ...page, elements: page.elements.filter((e) => !ids.has(e.id)) }))
+ next = mapPage(payload.pageId, (page) => ({ ...page, elements: page.elements.filter((e) => !ids.has(e.id)) }))
break
}
case 'elements:reorder': {
const orderedIds = (payload.orderedIds as string[]) ?? []
- applyToPage(payload.pageId, (page) => {
+ next = mapPage(payload.pageId, (page) => {
const byId = new Map(page.elements.map((e) => [e.id, e]))
const ordered = orderedIds.map((id) => byId.get(id)).filter((e): e is AnyElement => !!e)
const rest = page.elements.filter((e) => !orderedIds.includes(e.id))
@@ -861,29 +906,29 @@ export const useEditorStore = create<EditorState>((set, get) => ({
}
case 'page:add': {
const page = clone(payload.page as PageData)
- if (page?.id && !next.some((p) => p.id === page.id)) {
+ if (page?.id && !pages.some((p) => p.id === page.id)) {
const afterIdx = payload.afterId ? findPage(payload.afterId) : -1
+ next = [...pages]
next.splice(afterIdx >= 0 ? afterIdx + 1 : next.length, 0, page)
}
break
}
case 'page:delete': {
- if (next.length > 1) {
+ if (pages.length > 1) {
const i = findPage(payload.pageId)
- if (i >= 0) next.splice(i, 1)
+ if (i >= 0) next = pages.filter((_, k) => k !== i)
}
break
}
case 'page:background': {
- applyToPage(payload.pageId, (page) => ({ ...page, background: clone(payload.background as Background) }))
+ next = mapPage(payload.pageId, (page) => ({ ...page, background: clone(payload.background as Background) }))
break
}
case 'page:replace': {
const page = clone(payload.page as PageData)
if (page?.id) {
const i = findPage(page.id)
- if (i >= 0) next[i] = page
- else next.push(page)
+ next = i >= 0 ? pages.map((p, k) => (k === i ? page : p)) : [...pages, page]
}
break
}