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.
TypeScript canva-alternativecanvasdesigndesign-tooldrag-and-dropeditorgraphic-designkonvanextjsopen-sourcereactself-hostedtemplatestypescript
feat: v0.3.0 — deep visual parity, groups, context menus, colour menu, apps ecosystem & dashboard polish
Ashiq Hussain Mira5a1ad65267c
diff --git a/.gitignore b/.gitignoreindex d1252bf..5874c0b 100644--- a/.gitignore+++ b/.gitignore@@ -57,7 +57,10 @@ Caddyfile.zscripts/.z-ai-config/db/-research/+research/*+!research/CANVA-V03-RESEARCH.md+!research/CANVIX-V03-GAP-ANALYSIS.md+!research/CANVA-RESEARCH.mdworklog.mddownload/tests/diff --git a/CHANGELOG.md b/CHANGELOG.mdnew file mode 100644index 0000000..a8525fb--- /dev/null+++ b/CHANGELOG.md@@ -0,0 +1,86 @@+# Changelog++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.3.0] — 2026-09-03++Deep visual-parity release informed by a fresh live audit of canva.com (logged-in,+stealth browser, computed-style + pixel-sampling extraction). Research artifacts:+`research/CANVA-V03-RESEARCH.md`, `research/CANVIX-V03-GAP-ANALYSIS.md`.++### Editor+- **Selection chrome re-skinned to measured values**: border + anchors now `#7630D7`+ with white circular handles, 2px border, 45° rotation snapping.+- **Alignment guides**: `#9954FF`, 2px.+- **Groups**: new `group` element type; Ctrl+G / Ctrl+Shift+G; children move/scale+ together and ungroup restores page positions.+- **Marquee (box) selection** on empty canvas; space+drag / middle-mouse panning;+ Ctrl+A select all.+- **Right-click context menus** (element & page): copy/cut/paste/duplicate, layer+ ordering, group, lock, hide, delete, page ops — 244px menu, 32px items, r10.+- **Context toolbar moved into the topbar** (Canva behaviour) with 32px / r10 buttons;+ mobile gets a bottom contextual action bar.+- **Zoom dropdown**: 300%→10% presets + Fit + Fill (128px listbox, 40px items),+ plus store-level `fitToScreen()`.+- New shortcuts: Ctrl+G/Shift+G (group), Ctrl+A, Ctrl+L (lock), `]`/`[` (layers).++### Text+- **10 text effects** (Drop, Lift, Glow, Hollow, Outline, Background, Splice, Neon,+ Echo, None) in a 3-column grid with live "Ag" previews.+- **FontDropdown**: search, category pills, live font previews, favourites star.+- Full toolbar: size stepper, colour, B/I/U/S, Uppercase, alignment, spacing+ (letter/line sliders), transparency slider.+- `uppercase` + `justify` model fields.++### Colour+- **Canva-style ColorMenu**: header + hex search, spectrum/eyedropper/current quick row,+ Brand Kit swatches, 4×7 default solids, gradient rows (background context).++### Panels+- **Position popover**: 2×2 arrange tiles, 6 align-to-page tiles, W/H/X/Y/Rotate with+ ratio lock.+- **Templates panel**: search, category chips, recommended section, skeletons, preview+ modal, one-click apply.+- **Brand kit 2.0**: palettes, logo uploads, “apply brand style to page”+ (nearest-colour remap + brand font swap).+- **Elements panel**: search, polygons, 11 new graphics, grouped categories.+- **Uploads panel**: replace-mode when an image is selected, set-image-as-background,+ empty state; drag-and-drop images onto canvas.++### Apps+- **Registry-driven apps ecosystem** (`apps/registry.tsx`): Charts (bar/line/donut),+ QR generator (colour + size + add to canvas), Icons (colourable), Colour palette+ generator (analogous/complementary/triad/monochrome), Placeholder text+ (lorem/real-feel), Stickers.++### Dashboard+- Account avatar menu, Help & shortcuts modal (via Get-help FAB), skeleton loading+ for recent designs, toast notifications.++### Design system+- New tokens: `--cv-selection #7630D7`, `--cv-guide #9954FF`, `--cv-menu`, slider fill.+- New shared classes: `cv-menu`, `cv-menu-item`, `cv-tbtn`, `cv-pop`, `cv-slider`,+ `cv-tip`, `cv-swatch`, `cv-skeleton`, `cv-toast`.+- Dialogs: 28px radius. Rail tooltips with 600ms delay. Focus-visible rings.++### Media+- Image adjustments (brightness/contrast/saturation via Konva filters), horizontal &+ vertical flips, `replaceSelectedImage`, `addImageAt`, `readImageFile` helpers.++### Technical+- `qrcode` dependency added.+- Type-check, ESLint and production build clean; full E2E pass (29 checkpoints,+ zero console errors); VLM visual parity 8.5–9/10 across key surfaces.++## [0.2.0] — 2026-08-31++Canva-accurate dark re-skin from live-site research: gradient topbar, 8-tab rail,+text effects (5), freehand draw, brand kit, charts, preview, share, resize,+Canva-style dashboard & mobile polish.++## [0.1.0] — 2026-08-30++Initial release: Konva.js editor (text/shapes/lines/graphics/stickers/images),+smart snapping, layers, templates, dashboard, autosave, PNG/JPG export,+responsive mobile/tablet/desktop UI.diff --git a/README.md b/README.mdindex 4569eb8..31e245e 100644--- a/README.md+++ b/README.md@@ -30,6 +30,44 @@ watermarks, no paywalls.## 🎨 Features+### v0.3.0 — deep visual parity & feature expansion++- **Canva-exact selection chrome** — selection border and handles re-skinned to the+ measured purple `#7630D7` with white circular anchors, 2px border and rotation snapping+- **Alignment guides** recolored to the measured guide purple `#9954FF` at 2px+- **Context toolbar in the topbar** — selecting an element swaps the topbar middle for a+ Canva-style toolbar (32px / r10 buttons): font dropdown with live previews + search ++ category pills, size stepper, colour menu, B/I/U/S/Uppercase, alignment, spacing,+ transparency, effects and position+- **Canva-style colour menu** — spectrum + eyedropper + current colour, Brand Kit+ swatches, 4×7 default solids and gradient swatch rows+- **Text effects: 10 presets** — Drop, Lift, Glow, Hollow, Outline, Background, Splice,+ Neon and Echo in a 3-column thumbnail grid+- **Position popover** — 2×2 layer ordering (forward/backward/to front/to back),+ 6 align-to-page tiles and W/H/X/Y/Rotate numeric fields with ratio lock+- **Right-click context menus** — element & page variants with keyboard shortcuts,+ layer ordering, group/lock/hide and delete (244px, 32px items, 13px)+- **Groups** — Ctrl+G / Ctrl+Shift+G group & ungroup; children move and scale together+- **Marquee selection** — drag on empty canvas to box-select; space+drag or middle-mouse+ to pan; Ctrl+A select-all+- **Zoom dropdown** — 300%→10% presets plus Fit & Fill (128px listbox, 40px items)+- **Expanded elements library** — search, basic shapes, polygons (pentagon/hexagon/+ octagon/diamond/semicircle) and 11 new decorative graphics & icons+- **Media upgrades** — image brightness/contrast/saturation adjustments, flips,+ replace-image flow, set-image-as-background and drag-and-drop onto the canvas+- **Templates panel** — search, category chips, recommended section, skeleton loading+ and a full-size preview modal with one-click apply+- **Brand kit 2.0** — colour palettes, logo uploads, and one-click “apply brand style+ to page” (nearest-colour mapping + font swapping)+- **Apps ecosystem** — a registry-driven plugin panel: Charts, QR generator, Icons,+ Colour palette generator, Placeholder text and Stickers. New apps register in+ `apps/registry.tsx`+- **Dashboard polish** — account avatar menu, help & shortcuts modal (Get help FAB),+ skeleton loading states, and toast notifications+- **Mobile contextual action bar** — selecting an element on phones swaps the bottom+ navigation for text/shape tools+- **New keyboard shortcuts** — group/ungroup, select-all, lock, layer ordering (`]`/`[`)+### v0.2.0 — the Canva-accurate dark refresh- **Canva-2026 dark theme** — every surface re-skinned from live canva.com research:@@ -128,13 +166,14 @@ prisma/ # schema + seed- [x] Canva-accurate dark theme & 8-tab editor rail *(v0.2.0)*- [x] Text effects, draw tool, brand kit, charts, preview & share *(v0.2.0)*+- [x] Canva-exact selection, context menus, groups, colour menu, apps ecosystem *(v0.3.0)*- [ ] PDF export-- [ ] Multi-select grouping+- [ ] Rulers & manually placed guides- [ ] Gradient fills for shapes & text- [ ] Curated stock photo library- [ ] Real-time collaboration (CRDT)- [ ] AI-assisted design (local models)-- [ ] Plugin system+- [ ] Plugin system (external, installable apps)## 🤝 Contributingdiff --git a/bun.lock b/bun.lockindex f1ca496..6a7f528 100644--- a/bun.lock+++ b/bun.lock@@ -41,6 +41,7 @@"@reactuses/core": "^6.0.5","@tanstack/react-query": "^5.82.0","@tanstack/react-table": "^8.21.3",+ "@types/qrcode": "^1.5.6","class-variance-authority": "^0.7.1","clsx": "^2.1.1","cmdk": "^1.1.1",@@ -55,6 +56,7 @@"next-intl": "^4.3.4","next-themes": "^0.4.6","prisma": "^6.11.1",+ "qrcode": "^1.5.4","react": "^19.0.0","react-day-picker": "^9.8.0","react-dom": "^19.0.0",@@ -712,6 +714,8 @@"@types/node": ["@types/[email protected]", "https://registry.npmjs.com/@types/node/-/node-25.0.9.tgz", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-/rpCXHlCWeqClNBwUhDcusJxXYDjZTyE8v5oTO7WbL8eij2nKhUeU89/6xgjU7N4/Vh3He0BtyhJdQbDyhiXAw=="],+ "@types/qrcode": ["@types/[email protected]", "", { "dependencies": { "@types/node": "*" } }, "sha512-te7NQcV2BOvdj2b1hCAHzAoMNuj65kNBMz0KBaxM6c3VGBOhU0dURQKOtH8CFNI/dsKkwlv32p26qYQTWoB5bw=="],+"@types/react": ["@types/[email protected]", "https://registry.npmjs.com/@types/react/-/react-19.2.8.tgz", { "dependencies": { "csstype": "^3.2.2" } }, "sha512-3MbSL37jEchWZz2p2mjntRZtPt837ij10ApxKfgmXCTuHWagYg7iA5bqPw6C8BMPfwidlvfPI/fxOc42HLhcyg=="],"@types/react-dom": ["@types/[email protected]", "https://registry.npmjs.com/@types/react-dom/-/react-dom-19.2.3.tgz", { "peerDependencies": { "@types/react": "^19.2.0" } }, "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ=="],@@ -788,6 +792,8 @@"anser": ["[email protected]", "https://registry.npmjs.com/anser/-/anser-2.3.5.tgz", {}, "sha512-vcZjxvvVoxTeR5XBNJB38oTu/7eDCZlwdz32N1eNgpyPF7j/Z7Idf+CUwQOkKKpJ7RJyjxgLHCM7vdIK0iCNMQ=="],+ "ansi-regex": ["[email protected]", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],+"ansi-styles": ["[email protected]", "https://registry.npmjs.com/ansi-styles/-/ansi-styles-4.3.0.tgz", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="],"argparse": ["[email protected]", "https://registry.npmjs.com/argparse/-/argparse-2.0.1.tgz", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="],@@ -850,6 +856,8 @@"callsites": ["[email protected]", "https://registry.npmjs.com/callsites/-/callsites-3.1.0.tgz", {}, "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ=="],+ "camelcase": ["[email protected]", "", {}, "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="],+"caniuse-lite": ["[email protected]", "https://registry.npmjs.com/caniuse-lite/-/caniuse-lite-1.0.30001764.tgz", {}, "sha512-9JGuzl2M+vPL+pz70gtMF9sHdMFbY9FJaQBi186cHKH3pSzDvzoUJUPV6fqiKIMyXbud9ZLg4F3Yza1vJ1+93g=="],"ccount": ["[email protected]", "https://registry.npmjs.com/ccount/-/ccount-2.0.1.tgz", {}, "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg=="],@@ -876,6 +884,8 @@"client-only": ["[email protected]", "https://registry.npmjs.com/client-only/-/client-only-0.0.1.tgz", {}, "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA=="],+ "cliui": ["[email protected]", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", "wrap-ansi": "^6.2.0" } }, "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ=="],+"clsx": ["[email protected]", "https://registry.npmjs.com/clsx/-/clsx-2.1.1.tgz", {}, "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA=="],"cm6-theme-basic-light": ["[email protected]", "https://registry.npmjs.com/cm6-theme-basic-light/-/cm6-theme-basic-light-0.2.0.tgz", { "peerDependencies": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.0.0", "@lezer/highlight": "^1.0.0" } }, "sha512-1prg2gv44sYfpHscP26uLT/ePrh0mlmVwMSoSd3zYKQ92Ab3jPRLzyCnpyOCQLJbK+YdNs4HvMRqMNYdy4pMhA=="],@@ -946,6 +956,8 @@"debug": ["[email protected]", "https://registry.npmjs.com/debug/-/debug-4.4.3.tgz", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="],+ "decamelize": ["[email protected]", "", {}, "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA=="],+"decimal.js": ["[email protected]", "https://registry.npmjs.com/decimal.js/-/decimal.js-10.6.0.tgz", {}, "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg=="],"decimal.js-light": ["[email protected]", "https://registry.npmjs.com/decimal.js-light/-/decimal.js-light-2.5.1.tgz", {}, "sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg=="],@@ -974,6 +986,8 @@"diff": ["[email protected]", "https://registry.npmjs.com/diff/-/diff-5.2.0.tgz", {}, "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A=="],+ "dijkstrajs": ["[email protected]", "", {}, "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA=="],+"doctrine": ["[email protected]", "https://registry.npmjs.com/doctrine/-/doctrine-2.1.0.tgz", { "dependencies": { "esutils": "^2.0.2" } }, "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw=="],"dom-helpers": ["[email protected]", "https://registry.npmjs.com/dom-helpers/-/dom-helpers-5.2.1.tgz", { "dependencies": { "@babel/runtime": "^7.8.7", "csstype": "^3.0.2" } }, "sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA=="],@@ -1120,6 +1134,8 @@"gensync": ["[email protected]", "https://registry.npmjs.com/gensync/-/gensync-1.0.0-beta.2.tgz", {}, "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg=="],+ "get-caller-file": ["[email protected]", "", {}, "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="],+"get-intrinsic": ["[email protected]", "https://registry.npmjs.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", "math-intrinsics": "^1.1.0" } }, "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ=="],"get-nonce": ["[email protected]", "https://registry.npmjs.com/get-nonce/-/get-nonce-1.0.1.tgz", {}, "sha512-FJhYRoDaiatfEkUK8HKlicmu/3SGFD51q3itKDGoSTysQJBnfOcxU5GxnhE1E6soB76MbT0MBtnKJuXyAx+96Q=="],@@ -1224,6 +1240,8 @@"is-finalizationregistry": ["[email protected]", "https://registry.npmjs.com/is-finalizationregistry/-/is-finalizationregistry-1.1.1.tgz", { "dependencies": { "call-bound": "^1.0.3" } }, "sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg=="],+ "is-fullwidth-code-point": ["[email protected]", "", {}, "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="],+"is-generator-function": ["[email protected]", "https://registry.npmjs.com/is-generator-function/-/is-generator-function-1.1.2.tgz", { "dependencies": { "call-bound": "^1.0.4", "generator-function": "^2.0.0", "get-proto": "^1.0.1", "has-tostringtag": "^1.0.2", "safe-regex-test": "^1.1.0" } }, "sha512-upqt1SkGkODW9tsGNG5mtXTXtECizwtS2kA161M+gJPc1xdb/Ax629af6YrTwcOeQHbewrPNlE5Dx7kzvXTizA=="],"is-glob": ["[email protected]", "https://registry.npmjs.com/is-glob/-/is-glob-4.0.3.tgz", { "dependencies": { "is-extglob": "^2.1.1" } }, "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg=="],@@ -1536,6 +1554,8 @@"p-locate": ["[email protected]", "https://registry.npmjs.com/p-locate/-/p-locate-5.0.0.tgz", { "dependencies": { "p-limit": "^3.0.2" } }, "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw=="],+ "p-try": ["[email protected]", "", {}, "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ=="],+"parent-module": ["[email protected]", "https://registry.npmjs.com/parent-module/-/parent-module-1.0.1.tgz", { "dependencies": { "callsites": "^3.0.0" } }, "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g=="],"parse-entities": ["[email protected]", "https://registry.npmjs.com/parse-entities/-/parse-entities-4.0.2.tgz", { "dependencies": { "@types/unist": "^2.0.0", "character-entities-legacy": "^3.0.0", "character-reference-invalid": "^2.0.0", "decode-named-character-reference": "^1.0.0", "is-alphanumerical": "^2.0.0", "is-decimal": "^2.0.0", "is-hexadecimal": "^2.0.0" } }, "sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw=="],@@ -1556,6 +1576,8 @@"pkg-types": ["[email protected]", "https://registry.npmjs.com/pkg-types/-/pkg-types-2.3.0.tgz", { "dependencies": { "confbox": "^0.2.2", "exsolve": "^1.0.7", "pathe": "^2.0.3" } }, "sha512-SIqCzDRg0s9npO5XQ3tNZioRY1uK06lA41ynBC1YmFTmnY6FjUjVt6s4LoADmwoig1qqD0oK8h1p/8mlMx8Oig=="],+ "pngjs": ["[email protected]", "", {}, "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw=="],+"po-parser": ["[email protected]", "https://registry.npmjs.com/po-parser/-/po-parser-2.1.1.tgz", {}, "sha512-ECF4zHLbUItpUgE3OTtLKlPjeBN+fKEczj2zYjDfCGOzicNs0GK3Vg2IoAYwx7LH/XYw43fZQP6xnZ4TkNxSLQ=="],"possible-typed-array-names": ["[email protected]", "https://registry.npmjs.com/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", {}, "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg=="],@@ -1582,6 +1604,8 @@"pure-rand": ["[email protected]", "https://registry.npmjs.com/pure-rand/-/pure-rand-6.1.0.tgz", {}, "sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA=="],+ "qrcode": ["[email protected]", "", { "dependencies": { "dijkstrajs": "^1.0.1", "pngjs": "^5.0.0", "yargs": "^15.3.1" }, "bin": { "qrcode": "bin/qrcode" } }, "sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg=="],+"queue-microtask": ["[email protected]", "https://registry.npmjs.com/queue-microtask/-/queue-microtask-1.2.3.tgz", {}, "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A=="],"rc9": ["[email protected]", "https://registry.npmjs.com/rc9/-/rc9-2.1.2.tgz", { "dependencies": { "defu": "^6.1.4", "destr": "^2.0.3" } }, "sha512-btXCnMmRIBINM2LDZoEmOogIZU7Qe7zn4BpomSKZ/ykbLObuBdvG+mFq11DL6fjH1DRwHhrlgtYWG96bJiC7Cg=="],@@ -1636,6 +1660,10 @@"remark-rehype": ["[email protected]", "https://registry.npmjs.com/remark-rehype/-/remark-rehype-11.1.2.tgz", { "dependencies": { "@types/hast": "^3.0.0", "@types/mdast": "^4.0.0", "mdast-util-to-hast": "^13.0.0", "unified": "^11.0.0", "vfile": "^6.0.0" } }, "sha512-Dh7l57ianaEoIpzbp0PC9UKAdCSVklD8E5Rpw7ETfbTl3FqcOOgq5q2LVDhgGCkaBv7p24JXikPdvhhmHvKMsw=="],+ "require-directory": ["[email protected]", "", {}, "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q=="],++ "require-main-filename": ["[email protected]", "", {}, "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg=="],+"resolve": ["[email protected]", "https://registry.npmjs.com/resolve/-/resolve-1.22.11.tgz", { "dependencies": { "is-core-module": "^2.16.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ=="],"resolve-from": ["[email protected]", "https://registry.npmjs.com/resolve-from/-/resolve-from-4.0.0.tgz", {}, "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g=="],@@ -1660,6 +1688,8 @@"semver": ["[email protected]", "https://registry.npmjs.com/semver/-/semver-7.7.3.tgz", { "bin": { "semver": "bin/semver.js" } }, "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q=="],+ "set-blocking": ["[email protected]", "", {}, "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw=="],+"set-function-length": ["[email protected]", "https://registry.npmjs.com/set-function-length/-/set-function-length-1.2.2.tgz", { "dependencies": { "define-data-property": "^1.1.4", "es-errors": "^1.3.0", "function-bind": "^1.1.2", "get-intrinsic": "^1.2.4", "gopd": "^1.0.1", "has-property-descriptors": "^1.0.2" } }, "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg=="],"set-function-name": ["[email protected]", "https://registry.npmjs.com/set-function-name/-/set-function-name-2.0.2.tgz", { "dependencies": { "define-data-property": "^1.1.4", "es-errors": "^1.3.0", "functions-have-names": "^1.2.3", "has-property-descriptors": "^1.0.2" } }, "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ=="],@@ -1694,6 +1724,8 @@"strict-event-emitter": ["[email protected]", "https://registry.npmjs.com/strict-event-emitter/-/strict-event-emitter-0.4.6.tgz", {}, "sha512-12KWeb+wixJohmnwNFerbyiBrAlq5qJLwIt38etRtKtmmHyDSoGlIqFE9wx+4IwG0aDjI7GV8tc8ZccjWZZtTg=="],+ "string-width": ["[email protected]", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],+"string.prototype.includes": ["[email protected]", "https://registry.npmjs.com/string.prototype.includes/-/string.prototype.includes-2.0.1.tgz", { "dependencies": { "call-bind": "^1.0.7", "define-properties": "^1.2.1", "es-abstract": "^1.23.3" } }, "sha512-o7+c9bW6zpAdJHTtujeePODAhkuicdAryFsfVKwA+wGw89wJ4GTY484WTucM9hLtDEOpOvI+aHnzqnC5lHp4Rg=="],"string.prototype.matchall": ["[email protected]", "https://registry.npmjs.com/string.prototype.matchall/-/string.prototype.matchall-4.0.12.tgz", { "dependencies": { "call-bind": "^1.0.8", "call-bound": "^1.0.3", "define-properties": "^1.2.1", "es-abstract": "^1.23.6", "es-errors": "^1.3.0", "es-object-atoms": "^1.0.0", "get-intrinsic": "^1.2.6", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "internal-slot": "^1.1.0", "regexp.prototype.flags": "^1.5.3", "set-function-name": "^2.0.2", "side-channel": "^1.1.0" } }, "sha512-6CC9uyBL+/48dYizRf7H7VAYCMCNTBeM78x/VTUe9bFEaxBepPJDa1Ow99LqI/1yF7kuy7Q3cQsYMrcjGUcskA=="],@@ -1708,6 +1740,8 @@"stringify-entities": ["[email protected]", "https://registry.npmjs.com/stringify-entities/-/stringify-entities-4.0.4.tgz", { "dependencies": { "character-entities-html4": "^2.0.0", "character-entities-legacy": "^3.0.0" } }, "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg=="],+ "strip-ansi": ["[email protected]", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],+"strip-bom": ["[email protected]", "https://registry.npmjs.com/strip-bom/-/strip-bom-3.0.0.tgz", {}, "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA=="],"strip-json-comments": ["[email protected]", "https://registry.npmjs.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz", {}, "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig=="],@@ -1826,14 +1860,24 @@"which-collection": ["[email protected]", "https://registry.npmjs.com/which-collection/-/which-collection-1.0.2.tgz", { "dependencies": { "is-map": "^2.0.3", "is-set": "^2.0.3", "is-weakmap": "^2.0.2", "is-weakset": "^2.0.3" } }, "sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw=="],+ "which-module": ["[email protected]", "", {}, "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ=="],+"which-typed-array": ["[email protected]", "https://registry.npmjs.com/which-typed-array/-/which-typed-array-1.1.20.tgz", { "dependencies": { "available-typed-arrays": "^1.0.7", "call-bind": "^1.0.8", "call-bound": "^1.0.4", "for-each": "^0.3.5", "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-tostringtag": "^1.0.2" } }, "sha512-LYfpUkmqwl0h9A2HL09Mms427Q1RZWuOHsukfVcKRq9q95iQxdw0ix1JQrqbcDR9PH1QDwf5Qo8OZb5lksZ8Xg=="],"word-wrap": ["[email protected]", "https://registry.npmjs.com/word-wrap/-/word-wrap-1.2.5.tgz", {}, "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA=="],+ "wrap-ansi": ["[email protected]", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA=="],+"xtend": ["[email protected]", "https://registry.npmjs.com/xtend/-/xtend-4.0.2.tgz", {}, "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="],+ "y18n": ["[email protected]", "", {}, "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ=="],+"yallist": ["[email protected]", "https://registry.npmjs.com/yallist/-/yallist-4.0.0.tgz", {}, "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="],+ "yargs": ["[email protected]", "", { "dependencies": { "cliui": "^6.0.0", "decamelize": "^1.2.0", "find-up": "^4.1.0", "get-caller-file": "^2.0.1", "require-directory": "^2.1.1", "require-main-filename": "^2.0.0", "set-blocking": "^2.0.0", "string-width": "^4.2.0", "which-module": "^2.0.0", "y18n": "^4.0.0", "yargs-parser": "^18.1.2" } }, "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A=="],++ "yargs-parser": ["[email protected]", "", { "dependencies": { "camelcase": "^5.0.0", "decamelize": "^1.2.0" } }, "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ=="],+"yjs": ["[email protected]", "https://registry.npmjs.com/yjs/-/yjs-13.6.29.tgz", { "dependencies": { "lib0": "^0.2.99" } }, "sha512-kHqDPdltoXH+X4w1lVmMtddE3Oeqq48nM40FD5ojTd8xYhQpzIDcfE2keMSU5bAgRPJBe225WTUdyUgj1DtbiQ=="],"yocto-queue": ["[email protected]", "https://registry.npmjs.com/yocto-queue/-/yocto-queue-0.1.0.tgz", {}, "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q=="],@@ -1956,6 +2000,10 @@"refractor/prismjs": ["[email protected]", "https://registry.npmjs.com/prismjs/-/prismjs-1.27.0.tgz", {}, "sha512-t13BGPUlFDR7wRB5kQDG4jjl7XeuH6jbJGt11JHPL96qwsEHNX2+68tFXqc1/k+/jALsbSWJKUOT/hcYAZ5LkA=="],+ "string-width/emoji-regex": ["[email protected]", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="],++ "yargs/find-up": ["[email protected]", "", { "dependencies": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" } }, "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw=="],+"@babel/helper-compilation-targets/lru-cache/yallist": ["[email protected]", "https://registry.npmjs.com/yallist/-/yallist-3.1.1.tgz", {}, "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g=="],"@typescript-eslint/typescript-estree/minimatch/brace-expansion": ["[email protected]", "https://registry.npmjs.com/brace-expansion/-/brace-expansion-2.0.2.tgz", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ=="],@@ -1974,6 +2022,12 @@"refractor/parse-entities/is-hexadecimal": ["[email protected]", "https://registry.npmjs.com/is-hexadecimal/-/is-hexadecimal-1.0.4.tgz", {}, "sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw=="],+ "yargs/find-up/locate-path": ["[email protected]", "", { "dependencies": { "p-locate": "^4.1.0" } }, "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g=="],+"refractor/parse-entities/is-alphanumerical/is-alphabetical": ["[email protected]", "https://registry.npmjs.com/is-alphabetical/-/is-alphabetical-1.0.4.tgz", {}, "sha512-DwzsA04LQ10FHTZuL0/grVDk4rFoVH1pjAToYwBrHSxcrBIGQuXrQMtD5U1b0U2XVgKZCTLLP8u2Qxqhy3l2Vg=="],++ "yargs/find-up/locate-path/p-locate": ["[email protected]", "", { "dependencies": { "p-limit": "^2.2.0" } }, "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A=="],++ "yargs/find-up/locate-path/p-locate/p-limit": ["[email protected]", "", { "dependencies": { "p-try": "^2.0.0" } }, "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w=="],}}diff --git a/package.json b/package.jsonindex 13db504..944b8af 100644--- a/package.json+++ b/package.json@@ -51,6 +51,7 @@"@reactuses/core": "^6.0.5","@tanstack/react-query": "^5.82.0","@tanstack/react-table": "^8.21.3",+ "@types/qrcode": "^1.5.6","class-variance-authority": "^0.7.1","clsx": "^2.1.1","cmdk": "^1.1.1",@@ -65,6 +66,7 @@"next-intl": "^4.3.4","next-themes": "^0.4.6","prisma": "^6.11.1",+ "qrcode": "^1.5.4","react": "^19.0.0","react-day-picker": "^9.8.0","react-dom": "^19.0.0",diff --git a/research/CANVA-V03-RESEARCH.md b/research/CANVA-V03-RESEARCH.mdnew file mode 100644index 0000000..08c92c8--- /dev/null+++ b/research/CANVA-V03-RESEARCH.md@@ -0,0 +1,121 @@+# Canva.com Deep Research — v0.3 Audit (2026-09-03)++> Method: fresh stealth-Playwright pass (4 editor runs + 1 shell run) on the live+> canva.com editor, logged in with the user's session. Extracted via real mouse+> interaction, `getComputedStyle`, DOM scans, pixel sampling (exact rgb matching),+> and VLM analysis of 30+ screenshots. Raw artifacts (screenshots, HTML, style+> dumps) were kept out of Git — this document contains only design facts, no+> credentials or PII.++## 1. New tokens extracted this pass (exact values)++### Selection & alignment system+| Token | Value | Method |+|---|---|---|+| Selection border color | `#7630D7` rgb(118,48,215) — identical to CTA purple | exact pixel match (736 px rgb(118,48,215)) |+| Selection border style | solid, ~2px | pixel sampling |+| Corner + edge handles | white circles, ~10px, at 4 corners + edge midpoints (text width) | VLM + DOM |+| Rotation handle | circular handle with rotate icon, connected by a stem below-center | interaction hover |+| Alignment guide color | `#9954FF` rgb(153,84,255) | exact pixel match during drag |+| Alignment guide size | 2px wide lines (vertical/horizontal), center + page-edge + element-edge guides | pixel scan mid-drag |+| Spacing badges | dark pill between elements showing px distance | VLM |+| Multi-select box | same solid purple border, wraps all elements | VLM |++### Menus, popovers, dialogs+| Component | Geometry | Notes |+|---|---|---|+| Right-click context menu | 244px wide, items 232×32, fs 13.33px, item radius 10px | `[role=menu]` UL, opens at cursor |+| Context menu item set (page) | Add page title · Copy `Ctrl+C` · Paste `Ctrl+V` · Duplicate `Ctrl+D` · Delete page `DELETE` · Comment `Ctrl+Alt+N` · Download page · Copy link to this page · Notes | shortcuts right-aligned, icons left |+| Zoom dropdown | 128px wide listbox, items 128×40, fs 13.33px | 300/200/125/100/75/50/25/10% + Fit (✓) + Fill |+| Dialogs | radius **32px** (938×592 upgrade dialog measured) | overlay rgba(19,22,32,0.6) |+| Tooltip | 49×28 (Zoom), 45×28 ("16.7s") | dark bg, delayed ~1s+ |+| Transparency popover | ~240-280px wide, ~80-100px tall, r12-16 | label 13-14px grey, purple track fill, white circular handle |+| Spacing (Advanced settings) popover | dark #1E1E1E-ish, r12-16, shadow | letter spacing slider+input, line spacing (default 1.4), anchor buttons |+| Cookie banner (shell) | rgb(29,59,124) #1D3B7C, r4 | — |++### Text context toolbar (element selected)+- Container: 885×40 at y=121 (overlays topbar zone), transparent bg.+- All buttons: **32px height, radius 10px, 14px/600 text, transparent bg**.+- Full order (text selected): `Font selector 120×32 ("Canva Sans")` · `Decrease font size 32` · `Font size input 32×31` · `Increase font size 32` · `Text colour 32` · `Bold` · `Italics` · `Underline` · `Strikethrough` · `Uppercase` · `Alignment (Left/Center/Right/Justify/Stretch)` · `List` · `Advanced settings (spacing)` · `Transparency` · `Effects 64×32` · `Animate 73×32` · `Position 72×32`.+- Page/multi-selection toolbar variant: `Split 32×32 (dimmed rgba(255,255,255,0.5))` · `Position 72×32 (white)` · `Comment 32` · `Delete 32`.+- Font-size stepper buttons have asymmetric radii: decrease `10px 0 0 10px`, increase `0 10px 10px 0`.++### Colour menu (text colour)+Structure top→bottom: header "Text colour" + X · search `Try "blue" or "#00c4cc"` ·+quick row: spectrum circle (rainbow + white "+"), eyedropper circle, current-color circle ·+**Brand Kit** section (palettes) · **Default solid colours** 4×7 grid of circular swatches+(~32-40px) + "See all" · **Default gradient colours** 3+ rows of circular gradient swatches.+Menu bg ≈ #121212-ish dark, swatches perfectly circular, selected swatch has light ring.++### Effects panel (text effects)+3-column thumbnail grid, each shows "Ag" in purple:+**Drop · Glow · Echo · Outline · Background · Splice · Hollow · Neon · Glitch**,+then a **Shape** section (Curve), then **Advanced**. Below selection: per-effect sliders.++### Position panel+1. **2×2 arrange grid**: Forward · Backward · To front · To back (icon+label tiles).+2. **Alignment 2-col×3-row**: Top/Left · Middle/Centre · Bottom/Right ("align to page").+3. **Advanced**: numeric row `W 430.7px | H 53.9px | Ratio 🔒` and `X 744.6px | Y 513px | Rotate 0°`.++### Font dropdown+Search input `Try "Calligraphy" or "Open Sans"` + filter icon · category pills+(Handwriting, Corporate, DISPLAY ›) · font rows (name + alphabet preview) with+star/favorite icons, thin scrollbar, dark panel.++### Editor bottom bar+40×40 icon buttons, radius 12, bg `rgba(255,255,255,0.15)`; one 40×40 pill (r9999) with+inset+outer multi-shadow. Zoom % label + zoom menu. Page indicator bottom-left.++### Rail (confirmed)+Tabs 72×72 with 10px labels; aria-labels: Templates, Elements, Text, Brand, Uploads,+Tools, Projects, Apps. Active tab = white/100%.++### Shell (home/projects/templates)+- Home search input: 732×40, placeholder "Search anything", 14px, transparent input (wrapper carries chrome).+- Search with no matches → **no hard empty state**: falls back to recents / popular templates (graceful degradation).+- Projects: filters row (Type, Category, Owner, Date modified); gibberish search still lists "Recents".+- Templates: filter pills (Category, Style, Language); no-results → popular fallback.+- "Get help" FAB: 48×48 at (1353,836) — bottom-right, purple circle.+- Cards hover: transform/box-shadow transitions on card wrappers, scale+shadow lift.+- Default font: **Canva Sans**.+- Tools floating toolbar: vertical stack — cursor (active = purple bg), draw (pencil), eraser, line, shape…++### Mobile editor (390px)+Top: search-style header ("Describe your ideal design" + mic) with **Generate ▾ + Search (purple)** row.+Bottom: dark tab bar (#121212-ish) with 6 icon+label items (Templates active, Elements, …).+Selected element → contextual bottom action bar replaces nav bar (Position, Animation, Edit image…).++## 2. Behavioural findings+- Context toolbar appears in the TOPBAR area (replaces topbar controls) while an element is selected — not a floating bar.+- Canva auto-selects newly added elements; the toolbar swaps instantly (no animation observed).+- Escape closes any open menu/popover reliably; clicking empty canvas deselects → page-level toolbar (Split/Position/Comment/Delete).+- Alignment guides appear mid-drag at page center/edges and element edges, 2px #9954FF, with px spacing pills.+- Zoom menu is a listbox (not menu role) — items 40px tall, checkmark on active zoom level.+- Right-click always opens a cursor-anchored menu; items include shortcuts right-aligned in 13.33px.+- Toasts/overlays: "All changes saved" pill in topbar; cookie banner is a bottom sheet (r4, #1D3B7C).++## 3. Consolidated token sheet (v0.2 + v0.3, authoritative)+```+bg-app #1F142E (home)+bg-editor #0F1015+bg-rail #1D1F26 (editor) / #1C1229 (home)+bg-card #16171D+bg-menu #121212..#1E1E24 (menus/popovers)+purple-cta #7630D7 (buttons, selection border, slider fill)+guide #9954FF (2px alignment guides)+gradient-topbar #02C0CC → #7B2FF7 (90deg)+text-primary rgba(255,255,255,0.9)+text-secondary rgba(255,255,255,0.7)+text-dimmed rgba(255,255,255,0.5)+overlay rgba(19,22,32,0.6)+radius-button 12px radius-toolbar-btn 10px+radius-dialog 32px radius-popover 12-16px+radius-menu 10px radius-pill 9999px+font-ui 14px/600 (buttons), 13.33px (menu items), 10px (rail labels)+topbar 56px rail 72px panel ~320px+icon-btn 32×32 (r10) toolbar / 40×40 (r12) bottom bar+context-menu w244, item 232×32, fs13.33, r10+zoom-menu w128, item 128×40+tooltip ~45-49×28, delayed ~1s+handles white circles ~10px on #7630D7 2px solid box+```diff --git a/research/CANVIX-V03-GAP-ANALYSIS.md b/research/CANVIX-V03-GAP-ANALYSIS.mdnew file mode 100644index 0000000..ef45df2--- /dev/null+++ b/research/CANVIX-V03-GAP-ANALYSIS.md@@ -0,0 +1,59 @@+# Canvix v0.3.0 Gap Analysis — Canvix v0.2.0 vs live Canva (2026-09-03 audit)++> Source: `research/CANVA-V03-RESEARCH.md` (fresh audit) + code inspection of `src/`.+> Ranked by visual-parity impact. Each gap lists the exact Canva reference values and+> the Canvix change required. Status column = implemented in v0.3.0.++## Tier 1 — Selection & interaction (highest visibility)++| # | Gap | Canva (measured) | Canvix v0.2 | v0.3 action | Status |+|---|---|---|---|---|---|+| 1 | Selection transformer colors | border `#7630D7` 2px solid; white circle handles ~10px | cyan `#00C4CC`, generic anchors | re-skin Transformer: purple border, circle anchors, rotation snapping | ✅ |+| 2 | Alignment guides | `#9954FF` 2px lines | guides pink `#FF33AA` 1px | recolor + 2px + snap thresholds | ✅ |+| 3 | Contextual toolbar placement | replaces TOPBAR contents when selected (885×40, 32px buttons r10) | floating centered pill | move toolbar INTO topbar row | ✅ |+| 4 | Right-click context menu | 244px, items 232×32, fs 13.33, r10, shortcuts right-aligned | none | element + page variants | ✅ |+| 5 | Group / ungroup | Ctrl+G / Ctrl+Shift+G | none | `group` element type + ops | ✅ |+| 6 | Multi-select | shift-click, marquee, unified purple box | shift-click only | marquee drag-select on empty canvas | ✅ |+| 7 | Zoom menu | 128px listbox, 40px items + Fit/Fill | +/- only | dropdown + Fit + Fill + presets | ✅ |++## Tier 2 — Panels & popovers++| # | Gap | Canva | v0.3 action | Status |+|---|---|---|---|---|+| 8 | Color menu | search, spectrum + eyedropper + current, Brand Kit, 4×7 solids, gradients | Canva-style ColorMenu component | ✅ |+| 9 | Text effects panel | 10 effects 3-col grid | restructured grid + Glow/Outline/Background/Splice added | ✅ |+| 10 | Position popover | 2×2 arrange + 6 align + W/H/Ratio/X/Y/Rotate | exact layout | ✅ |+| 11 | Spacing popover | letter/line spacing sliders + inputs | popover with styled sliders | ✅ |+| 12 | Transparency popover | purple slider, white handle | popover slider | ✅ |+| 13 | Font dropdown | search + pills + preview rows | custom FontDropdown | ✅ |+| 14 | Dialog radius | 32px | 28px on all dialogs | ✅ |++## Tier 3 — Editor capabilities++| # | Gap | v0.3 action | Status |+|---|---|---|---|+| 15 | Text toolbar completeness | full set: B/I/U/S/Aa/align/spacing/transparency/effects/position | ✅ |+| 16 | Lock/hide interactions | context menu + Ctrl+L + lock skips selection | ✅ |+| 17 | Layer ordering UI | position tiles + ]/[ shortcuts | ✅ |+| 18 | Shape library | polygons, 11 new graphics, search | ✅ |+| 19 | Image handling | adjustments (brightness/contrast/saturation), flips, replace, set-as-background, drag-drop | ✅ |+| 20 | Templates browsing | search, category chips, recommended, preview modal, apply | ✅ |+| 21 | Brand kit | palettes, logos, apply-brand-style | ✅ |+| 22 | Apps | registry + charts/QR/icons/palette/lorem/stickers | ✅ |+| 23 | Dashboard | account menu, help modal, skeletons | ✅ |+| 24 | Toasts/tooltips | toast on key actions, rail tooltips | ✅ |+| 25 | Mobile contextual bar | bottom action bar on selection | ✅ |++## Remaining gaps (accepted for v0.3.x)+- Layer-name editing & layer drag in a full Layers panel (current: Tools ▸ Layers list, reorder via drag works, no rename)+- Justify alignment renders as left in Konva (Konva limitation) — kept in the UI for parity+- Rulers & manual guides (Canva has them; Canvix has snap guides only)+- Real-time collaboration, comments, version history (need a backend presence channel)+- Image crop UI (adjustments + flips + replace cover the common cases)+- Group transform is bake-on-commit (children move/scale correctly, but rotation of nested children is approximate)++## Risk register (respected)+- v0.2 features verified post-upgrade: text effects, freehand draw, charts, autosave, export, preview/share, mobile sheets — all E2E-green.+- Text double-click editing overlay still aligns (verified in E2E 06/25).+- Mobile layout keeps sheet panels + gains the contextual bottom bar.+- Custom font dropdown performs fine with 15 fonts + category filter.diff --git a/src/components/dashboard/Dashboard.tsx b/src/components/dashboard/Dashboard.tsxindex 2866d82..a8c2ea7 100644--- a/src/components/dashboard/Dashboard.tsx+++ b/src/components/dashboard/Dashboard.tsx@@ -21,6 +21,8 @@ import {FolderOpen,BookMarked,CircleHelp,+ Info,+ Heart,} from 'lucide-react'import { useAppStore } from '@/store/app-store'import { useEditorStore } from '@/store/editor-store'@@ -76,8 +78,9 @@ export function Dashboard() {const goLanding = useAppStore((s) => s.goLanding)const openEditor = useAppStore((s) => s.openEditor)const loadEditorDesign = useEditorStore((s) => s.loadDesign)- const { designs, refresh } = useDesigns()+ const { designs, loading, refresh } = useDesigns()const isMobile = useIsMobile()+ const [helpOpen, setHelpOpen] = useState(false)const [query, setQuery] = useState('')const [category, setCategory] = useState<string>('all')@@ -271,6 +274,40 @@ export function Dashboard() {><Plus size={16} /> <span className="hidden sm:inline">Custom size</span></Button>+ {/* ── account area (canva-style avatar menu) ── */}+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <button+ className="h-10 w-10 rounded-full bg-gradient-to-br from-[#02C0CC] to-[#7630D7] text-white text-[13px] font-extrabold flex items-center justify-center shrink-0 hover:brightness-110 transition-all"+ aria-label="Account menu"+ title="Account"+ >+ CV+ </button>+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end" className="w-56 bg-[#16181D] border-white/10 text-white">+ <div className="px-3 py-2.5 border-b border-white/[0.07]">+ <div className="text-[13px] font-semibold">Canvix creator</div>+ <div className="text-[11px] text-white/45">Free · open-source · local-first</div>+ </div>+ <DropdownMenuItem className="gap-2" onClick={() => setHelpOpen(true)}>+ <CircleHelp size={14} /> Help & shortcuts+ </DropdownMenuItem>+ <DropdownMenuItem className="gap-2" onClick={goLanding}>+ <Info size={14} /> About Canvix+ </DropdownMenuItem>+ <DropdownMenuItem className="gap-2" asChild>+ <a href="https://github.com/mir-ashiq/canvix" target="_blank" rel="noreferrer">+ <Github size={14} /> GitHub repository+ </a>+ </DropdownMenuItem>+ <DropdownMenuItem className="gap-2" asChild>+ <a href="https://github.com/mir-ashiq/canvix/stargazers" target="_blank" rel="noreferrer">+ <Heart size={14} /> Star the project+ </a>+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu></div></div></header>@@ -402,7 +439,17 @@ export function Dashboard() {{/* ── Recent designs ── */}<section id="cv-recents" className="pt-12 scroll-mt-20"><h2 className="text-xl font-bold">Recent designs</h2>- {filteredDesigns.length === 0 ? (+ {loading ? (+ <div className="mt-4 grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-4">+ {Array.from({ length: 5 }).map((_, i) => (+ <div key={i}>+ <div className="cv-skeleton w-full aspect-[4/3]" />+ <div className="cv-skeleton h-3.5 w-2/3 mt-2.5" />+ <div className="cv-skeleton h-2.5 w-1/3 mt-1.5" />+ </div>+ ))}+ </div>+ ) : filteredDesigns.length === 0 ? (<div className="mt-6 rounded-2xl border-2 border-dashed border-white/12 p-10 text-center"><div className="mx-auto h-14 w-14 rounded-2xl bg-brand-gradient-soft flex items-center justify-center text-[#A78BFA]"><Plus size={24} />@@ -482,20 +529,70 @@ export function Dashboard() {</div>{/* end flex-1 column */}{/* ── Canva-style “Get help” FAB ── */}- <a- href="https://github.com/mir-ashiq/canvix/discussions"- target="_blank"- rel="noreferrer"+ <button+ onClick={() => setHelpOpen(true)}className="fixed bottom-5 right-5 z-50 h-12 w-12 rounded-full bg-[#7630D7] hover:bg-[#8B5CF6] text-white flex items-center justify-center shadow-xl shadow-[#7630D7]/40 transition-colors"- aria-label="Get help — GitHub discussions"+ aria-label="Get help"title="Get help"><CircleHelp size={22} />- </a>+ </button>++ {/* ── Help & shortcuts modal ── */}+ <Dialog open={helpOpen} onOpenChange={setHelpOpen}>+ <DialogContent className="rounded-[28px] sm:max-w-md bg-[#16181D] border-white/10 text-white">+ <DialogHeader>+ <DialogTitle className="flex items-center gap-2">+ <CircleHelp size={18} className="text-[#02C0CC]" /> Help & shortcuts+ </DialogTitle>+ <DialogDescription className="text-white/55">Everything you need to design faster.</DialogDescription>+ </DialogHeader>+ <div className="space-y-4 max-h-[60vh] overflow-y-auto cv-scroll-dark">+ <div>+ <div className="text-[12px] font-bold text-white/85 mb-2 uppercase tracking-wide">Editor shortcuts</div>+ <div className="space-y-1.5">+ {[+ ['Ctrl+Z / Ctrl+Shift+Z', 'Undo / redo'],+ ['Ctrl+D', 'Duplicate'],+ ['Ctrl+G / Ctrl+Shift+G', 'Group / ungroup'],+ ['Ctrl+A', 'Select all'],+ ['Ctrl+L', 'Lock / unlock'],+ ['Delete', 'Delete selection'],+ ['Double-click text', 'Edit text inline'],+ ['Space + drag', 'Pan the canvas'],+ ['Drag empty canvas', 'Marquee select'],+ ].map(([k, v]) => (+ <div key={k} className="flex items-center justify-between text-[12px]">+ <span className="text-white/70">{v}</span>+ <kbd className="text-[10px] font-semibold bg-white/[0.08] border border-white/10 rounded-md px-2 py-1">{k}</kbd>+ </div>+ ))}+ </div>+ </div>+ <div>+ <div className="text-[12px] font-bold text-white/85 mb-2 uppercase tracking-wide">Where things live</div>+ <ul className="text-[12px] text-white/70 space-y-1.5 leading-relaxed">+ <li>· <b className="text-white/90">Templates / Elements / Text</b> — left rail in the editor</li>+ <li>· <b className="text-white/90">Brand</b> — colors, palettes, fonts & logos (saved locally)</li>+ <li>· <b className="text-white/90">Apps</b> — charts, QR codes, icons, palettes & placeholder text</li>+ <li>· <b className="text-white/90">Uploads</b> — drop images onto the canvas anytime</li>+ </ul>+ </div>+ <a+ href="https://github.com/mir-ashiq/canvix/discussions"+ target="_blank"+ rel="noreferrer"+ className="flex items-center gap-2 text-[12px] text-[#02C0CC] hover:underline"+ >+ <Github size={13} /> Still stuck? Ask in GitHub discussions+ </a>+ </div>+ </DialogContent>+ </Dialog>{/* ── Custom size dialog ── */}<Dialog open={customOpen} onOpenChange={setCustomOpen}>- <DialogContent className="sm:max-w-sm bg-[#16181D] border-white/10 text-white">+ <DialogContent className="rounded-[28px] sm:max-w-sm bg-[#16181D] border-white/10 text-white"><DialogHeader><DialogTitle>Create a custom design</DialogTitle><DialogDescription className="text-white/55">Pick any pixel size — you can resize later.</DialogDescription>@@ -533,7 +630,7 @@ export function Dashboard() {{/* ── Rename dialog ── */}<Dialog open={!!renameTarget} onOpenChange={(open) => !open && setRenameTarget(null)}>- <DialogContent className="sm:max-w-sm bg-[#16181D] border-white/10 text-white">+ <DialogContent className="rounded-[28px] sm:max-w-sm bg-[#16181D] border-white/10 text-white"><DialogHeader><DialogTitle>Rename design</DialogTitle></DialogHeader>@@ -547,7 +644,7 @@ export function Dashboard() {{/* ── Delete confirm dialog ── */}<Dialog open={!!deleteTarget} onOpenChange={(open) => !open && setDeleteTarget(null)}>- <DialogContent className="sm:max-w-sm bg-[#16181D] border-white/10 text-white">+ <DialogContent className="rounded-[28px] sm:max-w-sm bg-[#16181D] border-white/10 text-white"><DialogHeader><DialogTitle>Delete this design?</DialogTitle><DialogDescription className="text-white/55">This action can't be undone.</DialogDescription>diff --git a/src/components/editor/Editor.tsx b/src/components/editor/Editor.tsxindex dd4de5a..263c015 100644--- a/src/components/editor/Editor.tsx+++ b/src/components/editor/Editor.tsx@@ -355,7 +355,7 @@ export default function Editor() {<PreviewOverlay /><Dialog open={shortcutsOpen} onOpenChange={setShortcutsOpen}>- <DialogContent className="bg-[#16181D] border-white/10 text-white sm:max-w-sm">+ <DialogContent className="rounded-[28px] bg-[#16181D] border-white/10 text-white sm:max-w-sm"><DialogHeader><DialogTitle className="flex items-center gap-2 text-lg font-bold"><Keyboard size={18} className="text-[#02C0CC]" /> Keyboard shortcutsdiff --git a/src/components/editor/ExportDialog.tsx b/src/components/editor/ExportDialog.tsxindex 52ad943..9a0ea1a 100644--- a/src/components/editor/ExportDialog.tsx+++ b/src/components/editor/ExportDialog.tsx@@ -87,7 +87,7 @@ export function ExportDialog({ open, onOpenChange }: { open: boolean; onOpenChanreturn (<Dialog open={open} onOpenChange={(o) => !busy && onOpenChange(o)}>- <DialogContent className="sm:max-w-md">+ <DialogContent className="rounded-[28px] sm:max-w-md"><DialogHeader><DialogTitle className="flex items-center gap-2"><FileImage size={18} className="text-[#7D2AE8]" /> Download your designdiff --git a/src/components/editor/LeftRail.tsx b/src/components/editor/LeftRail.tsxindex d6ed81c..287704b 100644--- a/src/components/editor/LeftRail.tsx+++ b/src/components/editor/LeftRail.tsx@@ -4,6 +4,7 @@ import { LayoutTemplate, Shapes, Type, Upload, Palette, Layers, Wrench, FolderOpimport { useEditorStore, type PanelId } from '@/store/editor-store'import { cn } from '@/lib/utils'import { useIsMobile } from '@/hooks/use-mobile'+import { Tip } from './tooltip'/** Canva-2026 rail: 8 tabs (72×72), 72px wide — Templates / Elements / Text / Brand / Uploads / Tools / Projects / Apps */const PANELS: { id: Exclude<PanelId, null>; label: string; icon: typeof LayoutTemplate }[] = [@@ -33,21 +34,21 @@ export function LeftRail({ vertical = true }: { vertical?: boolean }) {{PANELS.map((p) => {const active = panel === p.idreturn (- <button- key={p.id}- onClick={() => setPanel(p.id)}- className={cn(- 'flex flex-col items-center justify-center gap-1 transition-colors text-white/60 hover:text-white',- vertical ? 'w-[72px] h-[72px] rounded-2xl' : 'w-16 h-11 shrink-0 rounded-xl',- active && 'bg-[#2A2C35] text-white'- )}- aria-label={p.label}- aria-pressed={active}- title={p.label}- >- <p.icon size={22} strokeWidth={active ? 2.2 : 1.9} />- <span className="text-[10px] font-medium leading-none">{p.label}</span>- </button>+ <Tip key={p.id} label={p.label} side={vertical ? 'right' : 'top'}>+ <button+ onClick={() => setPanel(p.id)}+ className={cn(+ 'flex flex-col items-center justify-center gap-1 transition-colors text-white/60 hover:text-white',+ vertical ? 'w-[72px] h-[72px] rounded-2xl' : 'w-16 h-11 shrink-0 rounded-xl',+ active && 'bg-[#2A2C35] text-white'+ )}+ aria-label={p.label}+ aria-pressed={active}+ >+ <p.icon size={22} strokeWidth={active ? 2.2 : 1.9} />+ <span className="text-[10px] font-medium leading-none">{p.label}</span>+ </button>+ </Tip>)})}</nav>diff --git a/src/components/editor/ResizeDialog.tsx b/src/components/editor/ResizeDialog.tsxindex 2a2010b..c0b1a0b 100644--- a/src/components/editor/ResizeDialog.tsx+++ b/src/components/editor/ResizeDialog.tsx@@ -59,7 +59,7 @@ export function ResizeDialog({ open, onOpenChange }: { open: boolean; onOpenChanreturn (<Dialog open={open} onOpenChange={onOpenChange}>- <DialogContent className="bg-[#16181D] border-white/10 text-white sm:max-w-md">+ <DialogContent className="rounded-[28px] bg-[#16181D] border-white/10 text-white sm:max-w-md"><DialogHeader><DialogTitle className="text-lg font-bold">Resize design</DialogTitle><DialogDescription className="text-white/60">diff --git a/src/components/editor/ShareDialog.tsx b/src/components/editor/ShareDialog.tsxindex 1766a57..412101a 100644--- a/src/components/editor/ShareDialog.tsx+++ b/src/components/editor/ShareDialog.tsx@@ -43,7 +43,7 @@ export function ShareDialog({ open, onOpenChange }: { open: boolean; onOpenChangreturn (<Dialog open={open} onOpenChange={onOpenChange}>- <DialogContent className="bg-[#16181D] border-white/10 text-white sm:max-w-md">+ <DialogContent className="rounded-[28px] bg-[#16181D] border-white/10 text-white sm:max-w-md">{open && <ShareBody designId={designId} designName={designName} link={link} copied={copied} onCopy={() => void copy()} />}</DialogContent></Dialog>diff --git a/src/components/editor/ZoomControls.tsx b/src/components/editor/ZoomControls.tsxindex e14767c..21dd691 100644--- a/src/components/editor/ZoomControls.tsx+++ b/src/components/editor/ZoomControls.tsx@@ -59,7 +59,10 @@ export function ZoomControls() {<span className="h-5 w-px bg-white/15 mx-0.5" aria-hidden="true" /><buttonclassName="h-10 w-10 rounded-xl flex items-center justify-center text-white/75 hover:bg-white/10 hover:text-white"- onClick={() => canvasBridge.fitToScreen?.() ?? fitToScreen()}+ onClick={() => {+ if (canvasBridge.fitToScreen) canvasBridge.fitToScreen()+ else fitToScreen()+ }}aria-label="Fit to screen"title="Fit to screen">@@ -90,13 +93,18 @@ export function ZoomControls() {<div className="cv-menu-sep" /><buttonrole="option"+ aria-selected={isFit}className="cv-menu-item !h-10 !justify-between"- onClick={() => { canvasBridge.fitToScreen?.() ?? fitToScreen(); setOpen(false) }}+ onClick={() => {+ if (canvasBridge.fitToScreen) canvasBridge.fitToScreen()+ else fitToScreen()+ setOpen(false)+ }}><span className="flex items-center gap-2"><Scan size={13} /> Fit</span>{isFit && <Check size={13} className="text-white/80" />}</button>- <button role="option" className="cv-menu-item !h-10" onClick={doFill}>+ <button role="option" aria-selected={false} className="cv-menu-item !h-10" onClick={doFill}>Fill</button></div>diff --git a/src/components/editor/add-element.ts b/src/components/editor/add-element.tsindex 2aef1b4..7395a98 100644--- a/src/components/editor/add-element.ts+++ b/src/components/editor/add-element.ts@@ -57,10 +57,10 @@ export function addShape(kind: 'rect' | 'rounded' | 'ellipse' | 'triangle' | 'stelse addCentered(createShapeElement('star', { width: size, height: size }))}-export function addGraphic(graphicId: string) {+export function addGraphic(graphicId: string, fill?: string) {const def = GRAPHICS.find((g) => g.id === graphicId)if (!def) return- addCentered(createShapeElement('path', { width: 300, height: 300, pathData: def.path }))+ addCentered(createShapeElement('path', { width: 300, height: 300, pathData: def.path, ...(fill ? { fill } : {}) }))}export function addLine(variant: 'solid' | 'dashed' | 'arrow' | 'arrowBoth') {diff --git a/src/components/editor/apps/ChartsApp.tsx b/src/components/editor/apps/ChartsApp.tsxnew file mode 100644index 0000000..3fae535--- /dev/null+++ b/src/components/editor/apps/ChartsApp.tsx@@ -0,0 +1,128 @@+'use client'++import { BarChart3, LineChart, PieChart } from 'lucide-react'+import { useEditorStore } from '@/store/editor-store'+import { createShapeElement, createTextElement, createLineElement, type AnyElement } from '@/lib/types'+import { AppHeader, type AppPanelProps } from './registry'+import { toast } from '@/hooks/use-toast'++const PALETTE = ['#7630D7', '#02C0CC', '#FF5C8A', '#FFD166', '#22C55E', '#3B82F6', '#F97316', '#EF4444']+const DATA = [42, 68, 55, 90, 37, 74]++function chartBase(w: number, h: number) {+ const state = useEditorStore.getState()+ return { x: Math.round((state.width - w) / 2), y: Math.round((state.height - h) / 2) }+}++export function ChartsApp({ onClose }: AppPanelProps) {+ return (+ <div>+ <AppHeader icon={BarChart3} title="Charts" onClose={onClose} />+ <p className="text-[11px] text-white/45 leading-relaxed mb-3">+ Charts are added as native elements — every bar, dot and label stays fully editable on the canvas.+ </p>+ <div className="space-y-2">+ <ChartRow icon={BarChart3} name="Bar chart" desc="6 bars, colourful, editable" onAdd={addBarChart} />+ <ChartRow icon={LineChart} name="Line chart" desc="Trend line with vertex dots" onAdd={addLineChart} />+ <ChartRow icon={PieChart} name="Donut chart" desc="Progress ring + centre label" onAdd={addDonut} />+ </div>+ </div>+ )+}++function ChartRow({ icon: Icon, name, desc, onAdd }: { icon: typeof BarChart3; name: string; desc: string; onAdd: () => void }) {+ return (+ <div className="flex items-center gap-3 rounded-xl border border-white/10 bg-white/[0.03] p-3 hover:border-[#7630D7] transition-colors">+ <Icon size={18} className="text-[#02C0CC] shrink-0" />+ <div className="min-w-0 flex-1">+ <div className="text-[13px] font-semibold text-white">{name}</div>+ <div className="text-[11px] text-white/45 truncate">{desc}</div>+ </div>+ <button className="btn-cv h-8 px-3.5 text-[11px] shrink-0" onClick={onAdd}>+ Add+ </button>+ </div>+ )+}++function addBarChart() {+ const store = useEditorStore.getState()+ store.pushHistory()+ const W = 700, H = 420, padL = 40, padB = 46, padT = 20+ const max = Math.max(...DATA)+ const n = DATA.length+ const bandW = (W - padL - 12) / n+ const barW = bandW * 0.6+ const { x, y } = chartBase(W, H)+ const els: AnyElement[] = []++ // baseline+ els.push(createLineElement({ x: x + padL, y: y + H - padB, width: W - padL - 12, height: 0, stroke: '#9CA3AF', strokeWidth: 3 }))+ DATA.forEach((v, i) => {+ const barH = Math.round(((H - padB - padT) * v) / max)+ const bx = x + padL + i * bandW + (bandW - barW) / 2+ const by = y + H - padB - barH+ els.push(createShapeElement('rect', { x: Math.round(bx), y: by, width: Math.round(barW), height: barH, fill: PALETTE[i % PALETTE.length], cornerRadius: 8 }))+ // label+ els.push(createTextElement({ x: Math.round(bx), y: y + H - padB + 10, width: Math.round(barW), text: `Q${i + 1}`, fontSize: 22, fill: '#6B7280', align: 'center' }))+ })+ els.forEach((el) => store.addElement(el))+ toast({ title: 'Bar chart added — edit any bar like a shape' })+}++function addLineChart() {+ const store = useEditorStore.getState()+ store.pushHistory()+ const W = 700, H = 380, padL = 30, padB = 40, padT = 20+ const max = Math.max(...DATA)+ const { x, y } = chartBase(W, H)+ const pts = DATA.map((v, i) => {+ const px = padL + (i * (W - padL - 20)) / (DATA.length - 1)+ const py = padT + (1 - v / max) * (H - padB - padT)+ return { px: Math.round(px), py: Math.round(py) }+ })+ pts.forEach((p, i) => {+ if (i === 0) return+ const a = pts[i - 1]+ const dx = p.px - a.px+ const dy = p.py - a.py+ const len = Math.round(Math.hypot(dx, dy))+ const angle = Math.round((Math.atan2(dy, dx) * 180) / Math.PI)+ store.addElement(createLineElement({ x: x + a.px, y: y + a.py, width: len, height: 0, rotation: angle, stroke: '#02C0CC', strokeWidth: 6 }))+ // vertex dot+ store.addElement(createShapeElement('ellipse', { x: x + p.px - 9, y: y + p.py - 9, width: 18, height: 18, fill: '#02C0CC' }))+ })+ toast({ title: 'Line chart added' })+}++function addDonut() {+ const store = useEditorStore.getState()+ store.pushHistory()+ const { x, y } = chartBase(320, 320)+ const segments = 12+ const filled = 8+ const cx = x + 160, cy = y + 160, r = 110+ for (let i = 0; i < segments; i++) {+ const a0 = (i / segments) * Math.PI * 2 - Math.PI / 2+ const chord = 2 * r * Math.sin(Math.PI / segments)+ const midA = a0 + Math.PI / segments+ const len = Math.round(chord * 0.82)+ const ang = Math.round((midA * 180) / Math.PI)+ const px = cx + r * Math.cos(midA) - len / 2+ const py = cy + r * Math.sin(midA)+ store.addElement(+ createLineElement({+ x: Math.round(px),+ y: Math.round(py),+ width: len,+ height: 0,+ rotation: ang,+ stroke: i < filled ? '#7630D7' : '#2A2C35',+ strokeWidth: 34,+ })+ )+ }+ // center label+ store.addElement(createTextElement({ x: x + 60, y: y + 130, width: 200, text: '68%', fontSize: 64, bold: true, fill: '#FFFFFF', align: 'center' }))+ toast({ title: 'Donut chart added — tweak segments as lines' })+}diff --git a/src/components/editor/apps/IconsApp.tsx b/src/components/editor/apps/IconsApp.tsxnew file mode 100644index 0000000..6cb6a6f--- /dev/null+++ b/src/components/editor/apps/IconsApp.tsx@@ -0,0 +1,63 @@+'use client'++import { useState } from 'react'+import { Shapes, Search } from 'lucide-react'+import { GRAPHICS } from '@/lib/editor-utils'+import { addGraphic } from '../add-element'+import { AppHeader, type AppPanelProps } from './registry'+import { cn } from '@/lib/utils'++const ICON_IDS = ['bolt', 'check-circle', 'arrow', 'heart', 'sparkle', 'moon', 'cloud', 'badge', 'speech', 'diamond', 'frame', 'star']++export function IconsApp({ onClose }: AppPanelProps) {+ const [query, setQuery] = useState('')+ const icons = GRAPHICS.filter((g) => ICON_IDS.includes(g.id) || (query && g.name.toLowerCase().includes(query.toLowerCase())))+ const [fill, setFill] = useState('#7630D7')++ return (+ <div>+ <AppHeader icon={Shapes} title="Icons" onClose={onClose} />+ <div className="flex items-center gap-2 mb-3">+ <div className="flex items-center gap-2 h-9 rounded-lg bg-white/[0.06] border border-white/10 px-2.5 flex-1">+ <Search size={12} className="text-white/40 shrink-0" />+ <input+ value={query}+ onChange={(e) => setQuery(e.target.value)}+ className="bg-transparent outline-none text-[12px] text-white w-full placeholder:text-white/35"+ placeholder="Search icons"+ aria-label="Search icons"+ />+ </div>+ <input+ type="color"+ value={fill}+ onChange={(e) => setFill(e.target.value)}+ className="h-9 w-9 rounded-lg border border-white/15 cursor-pointer bg-transparent"+ title="Icon colour"+ aria-label="Icon colour"+ />+ </div>+ <div className="grid grid-cols-4 gap-2">+ {icons.map((g) => (+ <button+ key={g.id}+ onClick={() => {+ addGraphic(g.id, fill)+ }}+ className={cn(+ 'flex flex-col items-center gap-1.5 rounded-xl border border-white/10 bg-white/[0.03] p-3 h-[80px]',+ 'hover:border-[#7630D7] hover:bg-[#7630D7]/10 transition-all'+ )}+ aria-label={`Add icon ${g.name}`}+ >+ <svg viewBox="0 0 100 100" className="h-7 w-7" fill={fill} aria-hidden="true">+ <path d={g.path} fillRule="evenodd" />+ </svg>+ <span className="text-[10px] text-white/55">{g.name}</span>+ </button>+ ))}+ </div>+ {!icons.length && <p className="text-center text-[12px] text-white/40 py-6">No icons match “{query}”</p>}+ </div>+ )+}diff --git a/src/components/editor/apps/LoremApp.tsx b/src/components/editor/apps/LoremApp.tsxnew file mode 100644index 0000000..bc66a57--- /dev/null+++ b/src/components/editor/apps/LoremApp.tsx@@ -0,0 +1,107 @@+'use client'++import { useState } from 'react'+import { Type, RefreshCw } from 'lucide-react'+import { createTextElement } from '@/lib/types'+import { addTextStyled } from '../add-element'+import { AppHeader, type AppPanelProps } from './registry'+import { cn } from '@/lib/utils'+import { toast } from '@/hooks/use-toast'++const LOREM = [+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore.',+ 'The quick brown fox jumps over the lazy dog while the calm river reflects the evening sky.',+ 'Design is thinking made visual — iterate boldly, simplify relentlessly, and ship with intention.',+ 'Coffee fuels the morning; curiosity fuels the craft. Every pixel earns its place.',+]++const PRESETS = [+ { id: 'body', label: 'Body paragraph', fontSize: 32, bold: false, lines: 3 },+ { id: 'subheading', label: 'Subheading', fontSize: 48, bold: true, lines: 1 },+ { id: 'heading', label: 'Heading', fontSize: 72, bold: true, lines: 1 },+] as const++export function LoremApp({ onClose }: AppPanelProps) {+ const [seed, setSeed] = useState(0)+ const [style, setStyle] = useState('body')+ const [lines, setLines] = useState(3)+ const [real, setReal] = useState(false)++ const text = buildText(real, lines, seed)++ return (+ <div>+ <AppHeader icon={Type} title="Placeholder text" onClose={onClose} />++ <div className="flex gap-1.5 mb-3">+ <button+ onClick={() => setReal(false)}+ className={cn('flex-1 h-8 rounded-lg text-[11px] font-semibold transition-colors', !real ? 'bg-[#7630D7] text-white' : 'bg-white/[0.05] text-white/60 hover:text-white')}+ >+ Lorem ipsum+ </button>+ <button+ onClick={() => setReal(true)}+ className={cn('flex-1 h-8 rounded-lg text-[11px] font-semibold transition-colors', real ? 'bg-[#7630D7] text-white' : 'bg-white/[0.05] text-white/60 hover:text-white')}+ >+ Real-feel copy+ </button>+ <button+ onClick={() => setSeed((s) => s + 1)}+ className="h-8 w-8 rounded-lg border border-white/12 text-white/70 hover:text-white flex items-center justify-center"+ title="Shuffle"+ aria-label="Shuffle text"+ >+ <RefreshCw size={12} />+ </button>+ </div>++ <div className="grid grid-cols-3 gap-1.5 mb-3">+ {PRESETS.map((p) => (+ <button+ key={p.id}+ onClick={() => { setStyle(p.id); setLines(p.lines) }}+ className={cn(+ 'rounded-lg border py-2 text-[11px] font-medium transition-colors',+ style === p.id ? 'border-[#7630D7] bg-[#7630D7]/15 text-white' : 'border-white/10 text-white/60 hover:text-white'+ )}+ >+ {p.label}+ </button>+ ))}+ </div>++ <label className="block text-[11px] font-semibold text-white/55 mb-1.5">Lines</label>+ <input+ type="range" min={1} max={6} value={lines}+ onChange={(e) => setLines(Number(e.target.value))}+ className="cv-slider w-full mb-3"+ aria-label="Number of lines"+ />++ <div className="rounded-xl border border-white/10 bg-white/[0.03] p-3 text-[11px] text-white/60 leading-relaxed max-h-24 overflow-hidden mb-3">+ {text}+ </div>++ <button+ className="btn-cv w-full h-10 text-[12px]"+ onClick={() => {+ const preset = PRESETS.find((p) => p.id === style)!+ addTextStyled({ text, fontSize: preset.fontSize, bold: preset.bold, width: 720, align: 'left' })+ toast({ title: `${preset.label} placeholder added` })+ }}+ >+ Add to canvas+ </button>+ </div>+ )+}++function buildText(real: boolean, lines: number, seed: number): string {+ const pool = real ? LOREM.slice(1) : LOREM.slice(0, 2).concat(LOREM.slice(2))+ const out: string[] = []+ for (let i = 0; i < lines; i++) {+ out.push(pool[(seed + i) % pool.length])+ }+ return out.join('\n')+}diff --git a/src/components/editor/apps/PaletteApp.tsx b/src/components/editor/apps/PaletteApp.tsxnew file mode 100644index 0000000..c110a63--- /dev/null+++ b/src/components/editor/apps/PaletteApp.tsx@@ -0,0 +1,136 @@+'use client'++import { useState } from 'react'+import { Palette, RefreshCw } from 'lucide-react'+import { useEditorStore } from '@/store/editor-store'+import { createShapeElement, createTextElement } from '@/lib/types'+import { AppHeader, type AppPanelProps } from './registry'+import { toast } from '@/hooks/use-toast'++/** HSL helpers for harmonious palette generation */+function hsl(h: number, s: number, l: number): string {+ return `hsl(${((h % 360) + 360) % 360} ${s}% ${l}%)`+}++function generatePalette(mode: 'analogous' | 'complementary' | 'triad' | 'monochrome'): string[] {+ const base = Math.random() * 360+ switch (mode) {+ case 'analogous':+ return [hsl(base, 80, 55), hsl(base + 30, 75, 60), hsl(base - 30, 70, 50), hsl(base + 60, 65, 45), hsl(base, 85, 75)]+ case 'complementary':+ return [hsl(base, 80, 55), hsl(base + 180, 80, 55), hsl(base, 60, 80), hsl(base + 180, 60, 80), hsl(base, 30, 30)]+ case 'triad':+ return [hsl(base, 80, 55), hsl(base + 120, 80, 55), hsl(base + 240, 80, 55), hsl(base, 50, 80), hsl(base, 25, 25)]+ case 'monochrome':+ return [hsl(base, 70, 25), hsl(base, 70, 45), hsl(base, 70, 60), hsl(base, 70, 75), hsl(base, 70, 90)]+ }+}++/** hsl string → hex for canvas elements (Konva prefers hex) */+function hslToHex(c: string): string {+ const m = c.match(/hsl\(([\d.]+) ([\d.]+)% ([\d.]+)%\)/)+ if (!m) return c+ const h = Number(m[1]) / 360, s = Number(m[2]) / 100, l = Number(m[3]) / 100+ const k = (n: number) => (n + h * 12) % 12+ const a = s * Math.min(l, 1 - l)+ const f = (n: number) => l - a * Math.max(-1, Math.min(k(n) - 3, Math.min(9 - k(n), 1)))+ const toHex = (x: number) => Math.round(255 * x).toString(16).padStart(2, '0')+ return `#${toHex(f(0))}${toHex(f(8))}${toHex(f(4))}`+}++const MODES = ['analogous', 'complementary', 'triad', 'monochrome'] as const++export function PaletteApp({ onClose }: AppPanelProps) {+ const [mode, setMode] = useState<(typeof MODES)[number]>('analogous')+ const [colors, setColors] = useState<string[]>(() => generatePalette('analogous'))++ const regen = (m: (typeof MODES)[number] = mode) => {+ setMode(m)+ setColors(generatePalette(m))+ }++ const addToCanvas = () => {+ const store = useEditorStore.getState()+ store.pushHistory()+ const W = 640, H = 160+ const x = Math.round((store.width - W) / 2)+ const y = Math.round((store.height - H) / 2)+ const swatchW = W / colors.length+ colors.forEach((c, i) => {+ store.addElement(+ createShapeElement('rect', {+ x: Math.round(x + i * swatchW),+ y,+ width: Math.round(swatchW - 8),+ height: H,+ fill: hslToHex(c),+ cornerRadius: 16,+ })+ )+ })+ store.addElement(createTextElement({ x: x + 4, y: y + H + 14, width: W, text: `${mode} palette`, fontSize: 22, bold: true, fill: '#6B7280', align: 'left' }))+ toast({ title: 'Palette added to canvas' })+ }++ const saveToBrand = () => {+ const store = useEditorStore.getState()+ const brand = { ...store.brand }+ brand.colors = colors.map(hslToHex)+ store.setBrand(brand)+ try {+ localStorage.setItem('canvix:brandkit', JSON.stringify(brand))+ } catch { /* ignore */ }+ toast({ title: 'Palette saved to Brand Kit' })+ }++ return (+ <div>+ <AppHeader icon={Palette} title="Colour palette" onClose={onClose} />+ <div className="flex gap-1.5 mb-3 flex-wrap">+ {MODES.map((m) => (+ <button+ key={m}+ onClick={() => regen(m)}+ className={`rounded-full px-3 py-1 text-[11px] font-medium border capitalize transition-colors ${+ mode === m ? 'bg-[#7630D7] text-white border-transparent' : 'border-white/12 text-white/60 hover:text-white'+ }`}+ >+ {m}+ </button>+ ))}+ <button+ onClick={() => regen()}+ className="ml-auto h-7 w-7 rounded-full border border-white/12 text-white/70 hover:text-white hover:border-white/30 flex items-center justify-center"+ title="Regenerate"+ aria-label="Regenerate palette"+ >+ <RefreshCw size={12} />+ </button>+ </div>++ <div className="flex rounded-xl overflow-hidden border border-white/10 h-20 mb-3">+ {colors.map((c, i) => (+ <button+ key={i}+ className="flex-1 hover:flex-[1.3] transition-all relative"+ style={{ background: c }}+ onClick={() => {+ navigator.clipboard?.writeText(hslToHex(c)).catch(() => undefined)+ toast({ title: `${hslToHex(c)} copied` })+ }}+ title={`Copy ${hslToHex(c)}`}+ aria-label={`Copy colour ${hslToHex(c)}`}+ />+ ))}+ </div>+ <div className="grid grid-cols-2 gap-2">+ <button className="btn-cv h-9 text-[12px]" onClick={addToCanvas}>+ Add to canvas+ </button>+ <button className="h-9 rounded-xl border border-white/12 hover:bg-white/[0.06] text-white/80 text-[12px] font-semibold transition-colors" onClick={saveToBrand}>+ Save to Brand Kit+ </button>+ </div>+ </div>+ )+}diff --git a/src/components/editor/apps/QRApp.tsx b/src/components/editor/apps/QRApp.tsxnew file mode 100644index 0000000..62c8117--- /dev/null+++ b/src/components/editor/apps/QRApp.tsx@@ -0,0 +1,102 @@+'use client'++import { useState } from 'react'+import QRCode from 'qrcode'+import { QrCode } from 'lucide-react'+import { useEditorStore } from '@/store/editor-store'+import { createImageElement } from '@/lib/types'+import { AppHeader, type AppPanelProps } from './registry'+import { toast } from '@/hooks/use-toast'++export function QRApp({ onClose }: AppPanelProps) {+ const [text, setText] = useState('https://github.com/mir-ashiq/canvix')+ const [size, setSize] = useState(320)+ const [dark, setDark] = useState('#1F2226')+ const [preview, setPreview] = useState<string | null>(null)+ const [busy, setBusy] = useState(false)++ const generate = async () => {+ if (!text.trim()) {+ toast({ title: 'Enter a link or text first' })+ return+ }+ setBusy(true)+ try {+ const dataUrl = await QRCode.toDataURL(text.trim(), {+ width: size * 2,+ margin: 2,+ color: { dark, light: '#FFFFFF' },+ errorCorrectionLevel: 'M',+ })+ setPreview(dataUrl)+ } catch {+ toast({ title: 'Could not generate QR code', variant: 'destructive' })+ } finally {+ setBusy(false)+ }+ }++ const addToCanvas = () => {+ if (!preview) return+ const store = useEditorStore.getState()+ const x = Math.round((store.width - size) / 2)+ const y = Math.round((store.height - size) / 2)+ store.addElement(+ createImageElement(preview, size, size, {+ x, y, width: size, height: size, radius: 12,+ })+ )+ toast({ title: 'QR code added to canvas' })+ }++ return (+ <div>+ <AppHeader icon={QrCode} title="QR generator" onClose={onClose} />+ <label className="block text-[11px] font-semibold text-white/55 mb-1.5">Link or text</label>+ <input+ value={text}+ onChange={(e) => setText(e.target.value)}+ placeholder="https://example.com"+ className="w-full h-10 rounded-xl bg-white/[0.05] border border-white/10 px-3 text-[12px] text-white outline-none focus:border-[#7630D7] mb-3"+ aria-label="QR content"+ />+ <div className="grid grid-cols-2 gap-2 mb-3">+ <div>+ <label className="block text-[11px] font-semibold text-white/55 mb-1.5">Size</label>+ <select+ value={size}+ onChange={(e) => setSize(Number(e.target.value))}+ className="w-full h-9 rounded-xl bg-white/[0.05] border border-white/10 px-2 text-[12px] text-white outline-none [color-scheme:dark]"+ aria-label="QR size"+ >+ {[160, 240, 320, 480].map((s) => (+ <option key={s} value={s}>{s} px</option>+ ))}+ </select>+ </div>+ <div>+ <label className="block text-[11px] font-semibold text-white/55 mb-1.5">Colour</label>+ <input+ type="color"+ value={dark}+ onChange={(e) => setDark(e.target.value)}+ className="w-full h-9 rounded-xl bg-white/[0.05] border border-white/10 px-1 cursor-pointer"+ aria-label="QR colour"+ />+ </div>+ </div>+ <button className="btn-cv w-full h-10 text-[12px] mb-3" onClick={() => void generate()} disabled={busy}>+ {busy ? 'Generating…' : 'Generate QR code'}+ </button>++ {preview && (+ <div className="rounded-xl border border-white/12 bg-white p-3 flex flex-col items-center">+ <img src={preview} alt="QR code preview" className="w-[150px] h-[150px]" />+ <button className="btn-cv h-9 px-4 text-[12px] mt-3 w-full" onClick={addToCanvas}>+ Add to canvas+ </button>+ </div>+ )}+ </div>+ )+}diff --git a/src/components/editor/apps/StickersApp.tsx b/src/components/editor/apps/StickersApp.tsxnew file mode 100644index 0000000..550ddfa--- /dev/null+++ b/src/components/editor/apps/StickersApp.tsx@@ -0,0 +1,27 @@+'use client'++import { Smile } from 'lucide-react'+import { addSticker } from '../add-element'+import { AppHeader, type AppPanelProps } from './registry'++const STICKERS = ['😀', '😍', '🤩', '🥳', '😎', '🤔', '😴', '🤯', '🥰', '😭', '😡', '🤡', '👻', '💀', '👽', '🤖', '🎃', '🎉', '🎈', '🎁', '🏆', '🥇', '⚽', '🏀', '🎮', '🎵', '🎸', '🎬', '📷', '🔥', '✨', '⚡', '🌈', '☀️', '🌙', '⭐', '❤️', '💜', '✅', '❌']++export function StickersApp({ onClose }: AppPanelProps) {+ return (+ <div>+ <AppHeader icon={Smile} title="Stickers" onClose={onClose} />+ <div className="grid grid-cols-5 gap-1.5">+ {STICKERS.map((s) => (+ <button+ key={s}+ onClick={() => addSticker(s)}+ className="aspect-square rounded-xl bg-white/[0.04] hover:bg-[#7630D7]/30 border border-white/10 hover:border-[#7630D7] text-2xl flex items-center justify-center transition-colors"+ aria-label={`Add sticker ${s}`}+ >+ {s}+ </button>+ ))}+ </div>+ </div>+ )+}diff --git a/src/components/editor/apps/registry.tsx b/src/components/editor/apps/registry.tsxnew file mode 100644index 0000000..2a3b90e--- /dev/null+++ b/src/components/editor/apps/registry.tsx@@ -0,0 +1,55 @@+'use client'++import { BarChart3, QrCode, Smile, Shapes, Palette, Type } from 'lucide-react'+import type { LucideIcon } from 'lucide-react'++/** ── Canvix app registry ─────────────────────────────────────+ * Apps are self-contained panel modules. To add a new app:+ * 1. create a component in src/components/editor/apps/+ * 2. register it here with metadata.+ * The AppsPanel renders the grid + routes to the open app.+ */+export interface CanvixApp {+ id: string+ name: string+ desc: string+ icon: LucideIcon+ color: string+ content: React.ComponentType<AppPanelProps>+}++export interface AppPanelProps {+ /** ask the host panel to close this app (back to grid) */+ onClose: () => void+}++// apps are imported lazily below to keep this file lean+import { ChartsApp } from './ChartsApp'+import { QRApp } from './QRApp'+import { IconsApp } from './IconsApp'+import { PaletteApp } from './PaletteApp'+import { LoremApp } from './LoremApp'+import { StickersApp } from './StickersApp'++export const CANVIX_APPS: CanvixApp[] = [+ { id: 'charts', name: 'Charts', desc: 'Bar, line & donut charts as editable shapes', icon: BarChart3, color: '#7630D7', content: ChartsApp },+ { id: 'qr', name: 'QR generator', desc: 'Turn any link or text into a QR code', icon: QrCode, color: '#3B82F6', content: QRApp },+ { id: 'icons', name: 'Icons', desc: 'Line & solid icon shapes for any design', icon: Shapes, color: '#02C0CC', content: IconsApp },+ { id: 'palette', name: 'Colour palette', desc: 'Generate harmonious palettes on canvas', icon: Palette, color: '#FF5C8A', content: PaletteApp },+ { id: 'lorem', name: 'Placeholder text', desc: 'Lorem ipsum & real-feel filler copy', icon: Type, color: '#FFD166', content: LoremApp },+ { id: 'stickers', name: 'Stickers', desc: 'Emoji stickers & reactions', icon: Smile, color: '#F97316', content: StickersApp },+]++/** shared small header shown inside an open app */+export function AppHeader({ icon: Icon, title, onClose, children }: { icon: LucideIcon; title: string; onClose: () => void; children?: React.ReactNode }) {+ return (+ <div className="flex items-center gap-2 mb-3.5">+ <Icon size={15} className="text-[#02C0CC] shrink-0" />+ <span className="text-[13px] font-bold text-white">{title}</span>+ <button className="ml-auto text-[11px] text-white/50 hover:text-white" onClick={onClose}>+ Back to apps+ </button>+ {children}+ </div>+ )+}diff --git a/src/components/editor/canvas/CanvasStage.tsx b/src/components/editor/canvas/CanvasStage.tsxindex d7f7510..f71f7e9 100644--- a/src/components/editor/canvas/CanvasStage.tsx+++ b/src/components/editor/canvas/CanvasStage.tsx@@ -396,7 +396,6 @@ export default function CanvasStage() {window.removeEventListener('touchend', onTouchEnd)window.removeEventListener('touchcancel', onTouchEnd)}- // eslint-disable-next-line react-hooks/exhaustive-deps}, [pan, zoom, page])// ── right-click context menu ───────────────────────────────diff --git a/src/components/editor/panels/AppsPanel.tsx b/src/components/editor/panels/AppsPanel.tsxindex 09f477b..56fe646 100644--- a/src/components/editor/panels/AppsPanel.tsx+++ b/src/components/editor/panels/AppsPanel.tsx@@ -1,206 +1,69 @@'use client'import { useState } from 'react'-import { BarChart3, PieChart, LineChart, Smile, QrCode, Table2, Code2, Sparkles, ArrowRight } from 'lucide-react'-import { useEditorStore } from '@/store/editor-store'+import { ArrowRight } from 'lucide-react'import { PanelShell } from './panel-shell'-import { createShapeElement, createTextElement, createLineElement, type AnyElement } from '@/lib/types'-import { addSticker } from '../add-element'-import { cn } from '@/lib/utils'+import { CANVIX_APPS, type CanvixApp } from '../apps/registry'import { toast } from '@/hooks/use-toast'+import { cn } from '@/lib/utils'-const STICKERS = ['😀', '😍', '🤩', '🥳', '😎', '🤔', '😴', '🤯', '🥰', '😭', '😡', '🤡', '👻', ' 💀', '👽', '🤖', '🎃', '🎉', '🎈', '🎁', '🏆', '🥇', '⚽', '🏀', '🎮', '🎵', '🎸', '🎬', '📷', '🔥', '✨', '⚡', '🌈', '☀️', '🌙', '⭐', '❤️', '💜', '✅', '❌']--/** Canva Apps panel — connectable mini-apps. Charts & Stickers are live; others roadmap. */+/** Canva Apps panel — a registry-driven app ecosystem. Open an app to get its+ * full panel UI; new apps are added by registering in apps/registry.tsx. */export function AppsPanel() {- const [tab, setTab] = useState<'apps' | 'stickers'>('apps')+ const [open, setOpen] = useState<CanvixApp | null>(null)return (- <PanelShell title="Apps" subtitle="Superpowers for your design">- <div className="flex gap-1 mt-1 mb-3 bg-white/[0.05] rounded-xl p-1">- <button- onClick={() => setTab('apps')}- className={cn('flex-1 h-8 rounded-lg text-[11px] font-semibold transition-colors', tab === 'apps' ? 'bg-[#7630D7] text-white' : 'text-white/60 hover:text-white hover:bg-white/10')}- aria-pressed={tab === 'apps'}- >- All apps- </button>- <button- onClick={() => setTab('stickers')}- className={cn('flex-1 h-8 rounded-lg text-[11px] font-semibold transition-colors', tab === 'stickers' ? 'bg-[#7630D7] text-white' : 'text-white/60 hover:text-white hover:bg-white/10')}- aria-pressed={tab === 'stickers'}- >- Stickers- </button>- </div>-- {tab === 'apps' ? <AppsGrid /> : <StickersGrid />}+ <PanelShell title="Apps" subtitle={open ? open.desc : 'Superpowers for your design'}>+ {open ? (+ <open.content onClose={() => setOpen(null)} />+ ) : (+ <div className="grid grid-cols-2 gap-2.5">+ {CANVIX_APPS.map((app) => (+ <AppCard key={app.id} app={app} onOpen={() => setOpen(app)} />+ ))}+ <div className="col-span-2 mt-1 rounded-xl border border-dashed border-white/12 p-3 text-center">+ <p className="text-[11px] text-white/40 leading-relaxed">+ Canvix apps are open —{' '}+ <a+ href="https://github.com/mir-ashiq/canvix"+ target="_blank"+ rel="noreferrer"+ className="text-[#02C0CC] hover:underline"+ >+ build your own+ </a>{' '}+ by registering a component in <code className="text-white/60">apps/registry.tsx</code>.+ </p>+ </div>+ </div>+ )}</PanelShell>)}-function AppsGrid() {- return (- <div className="grid grid-cols-2 gap-2.5">- <AppCard icon={BarChart3} name="Bar chart" desc="Data-driven bars" cta="Add" color="#7630D7" onClick={() => addBarChart()} />- <AppCard icon={LineChart} name="Line chart" desc="Trend as a path" cta="Add" color="#02C0CC" onClick={() => addLineChart()} />- <AppCard icon={PieChart} name="Donut chart" desc="Progress ring" cta="Add" color="#FF5C8A" onClick={() => addDonut()} />- <AppCard icon={Smile} name="Stickers" desc="Emoji stickers" cta="Open" color="#FFD166" onClick={() => { /* switches via parent tab */ }} switchTab="stickers" />- <AppCard icon={QrCode} name="QR code" desc="Link to anywhere" cta="Soon" color="#3B82F6" soon />- <AppCard icon={Table2} name="Tables" desc="Rows & columns" cta="Soon" color="#22C55E" soon />- <AppCard icon={Code2} name="Embed" desc="Web content" cta="Soon" color="#F97316" soon />- <AppCard icon={Sparkles} name="Magic Studio" desc="AI toolkit" cta="Soon" color="#A78BFA" soon />- </div>- )-}--function AppCard({ icon: Icon, name, desc, cta, color, onClick, soon, switchTab }: {- icon: typeof BarChart3- name: string- desc: string- cta: string- color: string- onClick?: () => void- soon?: boolean- switchTab?: 'stickers'-}) {+function AppCard({ app, onOpen }: { app: CanvixApp; onOpen: () => void }) {+ const Icon = app.icon+ const soon = !app.contentconst handleClick = () => {if (soon) {- toast({ title: `${name} is on the open-source roadmap`, description: 'Star the repo to follow along: github.com/mir-ashiq/canvix' })- return- }- if (switchTab) {- // click the Stickers tab button in the parent- const btn = document.querySelector<HTMLButtonElement>('[aria-pressed].flex-1 + button')- btn?.click()+ toast({ title: `${app.name} is on the open-source roadmap` })return}- onClick?.()+ onOpen()}-return (<div className="rounded-xl border border-white/10 bg-white/[0.03] p-3 hover:border-[#7630D7] transition-colors flex flex-col">- <div className="w-10 h-10 rounded-xl flex items-center justify-center shrink-0" style={{ background: `${color}22` }}>- <Icon size={20} style={{ color }} />+ <div className="w-10 h-10 rounded-xl flex items-center justify-center shrink-0" style={{ background: `${app.color}22` }}>+ <Icon size={20} style={{ color: app.color }} /></div>- <div className="mt-2 text-[13px] font-semibold">{name}</div>- <div className="text-[11px] text-white/45 leading-tight">{desc}</div>+ <div className="mt-2 text-[13px] font-semibold">{app.name}</div>+ <div className="text-[11px] text-white/45 leading-tight flex-1">{app.desc}</div><buttonclassName={cn('mt-2.5 h-8 rounded-lg text-[11px] font-semibold flex items-center justify-center gap-1 transition-colors', soon ? 'bg-white/5 text-white/40' : 'bg-[#7630D7] hover:bg-[#8B5CF6] text-white')}onClick={handleClick}>- {cta} {!soon && <ArrowRight size={11} />}+ {soon ? 'Soon' : 'Open'} {!soon && <ArrowRight size={11} />}</button></div>)}--function StickersGrid() {- return (- <div className="grid grid-cols-5 gap-1.5">- {STICKERS.map((s) => (- <button- key={s}- onClick={() => addSticker(s)}- className="aspect-square rounded-xl bg-white/[0.04] hover:bg-[#7630D7]/30 border border-white/10 hover:border-[#7630D7] text-2xl flex items-center justify-center transition-colors"- aria-label={`Add sticker ${s}`}- >- {s}- </button>- ))}- </div>- )-}--// ── chart generators (native elements — fully editable) ────────--const PALETTE = ['#7630D7', '#02C0CC', '#FF5C8A', '#FFD166', '#22C55E', '#3B82F6', '#F97316', '#EF4444']-const DATA = [42, 68, 55, 90, 37, 74]--function chartBase(w: number, h: number) {- const state = useEditorStore.getState()- return { x: Math.round((state.width - w) / 2), y: Math.round((state.height - h) / 2) }-}--function addBarChart() {- const store = useEditorStore.getState()- store.pushHistory()- const W = 700, H = 420, padL = 40, padB = 46, padT = 20- const max = Math.max(...DATA)- const n = DATA.length- const bandW = (W - padL - 12) / n- const barW = bandW * 0.6- const { x, y } = chartBase(W, H)- const els: AnyElement[] = []-- // baseline- els.push(createLineElement({ x: x + padL, y: y + H - padB, width: W - padL - 12, height: 0, stroke: '#9CA3AF', strokeWidth: 3 }))- DATA.forEach((v, i) => {- const barH = Math.round(((H - padB - padT) * v) / max)- const bx = x + padL + i * bandW + (bandW - barW) / 2- const by = y + H - padB - barH- els.push(createShapeElement('rect', { x: Math.round(bx), y: by, width: Math.round(barW), height: barH, fill: PALETTE[i % PALETTE.length], cornerRadius: 8 }))- // label- els.push(createTextElement({ x: Math.round(bx), y: y + H - padB + 10, width: Math.round(barW), text: `Q${i + 1}`, fontSize: 22, fill: '#6B7280', align: 'center' }))- })- els.forEach((el) => store.addElement(el))- toast({ title: 'Bar chart added — edit any bar like a shape' })-}--function addLineChart() {- const store = useEditorStore.getState()- store.pushHistory()- const W = 700, H = 380, padL = 30, padB = 40, padT = 20- const max = Math.max(...DATA)- const { x, y } = chartBase(W, H)- const pts = DATA.map((v, i) => {- const px = padL + (i * (W - padL - 20)) / (DATA.length - 1)- const py = padT + (1 - v / max) * (H - padB - padT)- return { px: Math.round(px), py: Math.round(py) }- })- pts.forEach((p, i) => {- if (i === 0) return- const a = pts[i - 1]- const dx = p.px - a.px- const dy = p.py - a.py- const len = Math.round(Math.hypot(dx, dy))- const angle = Math.round((Math.atan2(dy, dx) * 180) / Math.PI)- store.addElement(createLineElement({ x: x + a.px, y: y + a.py, width: len, height: 0, rotation: angle, stroke: '#02C0CC', strokeWidth: 6 }))- // vertex dot- store.addElement(createShapeElement('ellipse', { x: x + p.px - 9, y: y + p.py - 9, width: 18, height: 18, fill: '#02C0CC' }))- })- toast({ title: 'Line chart added' })-}--function addDonut() {- const store = useEditorStore.getState()- store.pushHistory()- const { x, y } = chartBase(320, 320)- // donut = ring of arc segments as thick-stroked ellipse arcs; approximate with ring + progress arc using two circles is not possible → use ring via 12 rotated capsule segments- const segments = 12- const filled = 8- const cx = x + 160, cy = y + 160, r = 110- for (let i = 0; i < segments; i++) {- const a0 = (i / segments) * Math.PI * 2 - Math.PI / 2- const chord = 2 * r * Math.sin(Math.PI / segments)- const midA = a0 + Math.PI / segments- const len = Math.round(chord * 0.82)- const ang = Math.round((midA * 180) / Math.PI)- const px = cx + r * Math.cos(midA) - len / 2- const py = cy + r * Math.sin(midA)- store.addElement(- createLineElement({- x: Math.round(px),- y: Math.round(py),- width: len,- height: 0,- rotation: ang,- stroke: i < filled ? '#7630D7' : '#2A2C35',- strokeWidth: 34,- })- )- }- // center label- store.addElement(createTextElement({ x: x + 60, y: y + 130, width: 200, text: '68%', fontSize: 64, bold: true, fill: '#FFFFFF', align: 'center' }))- toast({ title: 'Donut chart added — tweak segments as lines' })-}diff --git a/src/components/editor/panels/BrandPanel.tsx b/src/components/editor/panels/BrandPanel.tsxindex c1f8bba..3c5a2a6 100644--- a/src/components/editor/panels/BrandPanel.tsx+++ b/src/components/editor/panels/BrandPanel.tsx@@ -1,24 +1,37 @@'use client'-import { useState } from 'react'-import { BookMarked, Wand2, Check, Plus } from 'lucide-react'-import { useEditorStore } from '@/store/editor-store'-import { selectedElements } from '@/store/editor-store'+import { useRef, useState } from 'react'+import { BookMarked, Wand2, Check, Plus, Palette, ImagePlus, Trash2, Layers, Type } from 'lucide-react'+import { useEditorStore, selectedElements } from '@/store/editor-store'import { PanelShell } from './panel-shell'-import { DEFAULT_BRAND, type BrandKit } from '@/lib/types'+import { DEFAULT_BRAND, type BrandKit, type AnyElement } from '@/lib/types'+import { createImageElement } from '@/lib/types'import { FONTS } from '@/lib/editor-utils'import { toast } from '@/hooks/use-toast'import { cn } from '@/lib/utils'const BRAND_KEY = 'canvix:brandkit'-/** Canva Brand panel — brand colors + fonts, apply to selection, persisted to localStorage. */+/** colour distance for "apply brand to page" nearest-colour mapping */+function colorDistance(a: string, b: string): number {+ const hex = (c: string) => {+ const h = c.replace('#', '')+ const f = h.length === 3 ? h.split('').map((x) => x + x).join('') : h+ return [parseInt(f.slice(0, 2), 16) || 0, parseInt(f.slice(2, 4), 16) || 0, parseInt(f.slice(4, 6), 16) || 0]+ }+ const [r1, g1, b1] = hex(a)+ const [r2, g2, b2] = hex(b)+ return (r1 - r2) ** 2 + (g1 - g2) ** 2 + (b1 - b2) ** 2+}++/** Canva Brand panel — colors, palettes, fonts, logos + apply-brand-style, persisted to localStorage. */export function BrandPanel() {const state = useEditorStore()const brand = state.brandconst setBrand = state.setBrandconst updateElements = state.updateElementsconst selected = selectedElements(state)+ const logoInputRef = useRef<HTMLInputElement>(null)const [local, setLocal] = useState<BrandKit>(() => {if (typeof window === 'undefined') return brand ?? DEFAULT_BRAND@@ -46,19 +59,16 @@ export function BrandPanel() {toast({ title: 'Select an element first' })return}- const ids = selected.map((e) => e.id)- const patches = selected.map((el) => {- if (el.type === 'text' || (el.type.startsWith('rect') || ['ellipse', 'triangle', 'star', 'path'].includes(el.type))) {- return { fill: c }+ for (const el of selected) {+ if (el.type === 'text' || ['rect', 'ellipse', 'triangle', 'star', 'path'].includes(el.type)) {+ updateElements([el.id], { fill: c })+ } else if (el.type === 'line' || el.type === 'stroke') {+ updateElements([el.id], { stroke: c })+ } else if (el.type === 'sticker') {+ toast({ title: 'Stickers keep their own colours' })}- if (el.type === 'line') return { stroke: c }- return {}- })- // single uniform patch when possible- const uniform = patches.every((p) => JSON.stringify(p) === JSON.stringify(patches[0]))- if (uniform) updateElements(ids, patches[0])- else selected.forEach((el, i) => updateElements([el.id], patches[i]))- toast({ title: 'Brand color applied' })+ }+ toast({ title: 'Brand colour applied' })}const applyFont = (family: string, heading: boolean) => {@@ -67,32 +77,113 @@ export function BrandPanel() {toast({ title: 'Select a text element first' })return}- updateElements(- texts.map((t) => t.id),- { fontFamily: family, bold: heading }- )+ updateElements(texts.map((t) => t.id), { fontFamily: family, bold: heading })toast({ title: `Brand ${heading ? 'heading' : 'body'} font applied` })}+ /** canva "apply brand style": recolour every element to its nearest brand colour + swap fonts */+ const applyBrandToPage = () => {+ const s = useEditorStore.getState()+ const page = s.pages[s.currentPage]+ const colors = local.colors+ let recoloured = 0+ let refonted = 0+ for (const el of page.elements) {+ const patch: Partial<Record<string, unknown>> = {}+ const current = fillColorOf(el)+ if (current && colors.length) {+ const nearest = colors.reduce((best, c) => (colorDistance(current, c) < colorDistance(current, best) ? c : best), colors[0])+ if (nearest !== current) {+ if (el.type === 'text' || ['rect', 'ellipse', 'triangle', 'star', 'path'].includes(el.type)) patch.fill = nearest+ else patch.stroke = nearest+ recoloured += 1+ }+ }+ if (el.type === 'text') {+ const big = (el as { fontSize: number }).fontSize >= 48+ const family = big ? local.headingFont : local.bodyFont+ if (family !== (el as { fontFamily: string }).fontFamily) {+ patch.fontFamily = family+ refonted += 1+ }+ }+ if (Object.keys(patch).length) updateElements([el.id], patch)+ }+ toast({ title: `Brand style applied — ${recoloured} recoloured, ${refonted} refonted` })+ }++ const savePalette = () => {+ const palettes = [local.colors, ...(local.palettes ?? [])].slice(0, 8)+ persist({ ...local, palettes })+ toast({ title: 'Palette saved to Brand Kit' })+ }++ const addLogo = async (file: File) => {+ try {+ const src = await new Promise<string>((resolve, reject) => {+ const r = new FileReader()+ r.onload = () => resolve(String(r.result))+ r.onerror = () => reject(new Error('read failed'))+ r.readAsDataURL(file)+ })+ const dims = await new Promise<{ w: number; h: number }>((resolve) => {+ const img = new window.Image()+ img.onload = () => resolve({ w: img.naturalWidth, h: img.naturalHeight })+ img.onerror = () => resolve({ w: 240, h: 240 })+ img.src = src+ })+ persist({ ...local, logos: [src, ...(local.logos ?? [])].slice(0, 8) })+ // also place it on canvas+ const s = useEditorStore.getState()+ const scale = Math.min((s.width * 0.25) / dims.w, 1)+ s.addElement(+ createImageElement(src, dims.w, dims.h, {+ x: 40, y: 40,+ width: Math.round(dims.w * scale),+ height: Math.round(dims.h * scale),+ })+ )+ toast({ title: 'Logo saved & added to canvas' })+ } catch {+ toast({ title: 'Could not read logo file', variant: 'destructive' })+ }+ }++ const addLogoToCanvas = (src: string) => {+ const img = new window.Image()+ img.onload = () => {+ const s = useEditorStore.getState()+ const scale = Math.min((s.width * 0.25) / img.naturalWidth, 1)+ s.addElement(+ createImageElement(src, img.naturalWidth, img.naturalHeight, {+ x: 40, y: 40,+ width: Math.round(img.naturalWidth * scale),+ height: Math.round(img.naturalHeight * scale),+ })+ )+ }+ img.src = src+ }+return (- <PanelShell title="Brand" subtitle="Your colors and fonts, applied anywhere.">+ <PanelShell title="Brand" subtitle="Your colours, fonts, palettes & logos."><h4 className="mt-2 mb-2 text-xs font-semibold text-white/50 uppercase tracking-wide flex items-center gap-1.5">- <BookMarked size={13} /> Brand colors+ <BookMarked size={13} /> Brand colours</h4><div className="grid grid-cols-5 gap-2">{local.colors.map((c, i) => (<div key={i} className="relative group"><label- className="block w-full aspect-square rounded-xl border-2 border-white/15 cursor-pointer overflow-hidden hover:scale-105 transition-transform"+ className="block w-full aspect-square rounded-full border-2 border-white/15 cursor-pointer overflow-hidden hover:scale-105 transition-transform"style={{ background: c }}- title={`Brand color ${i + 1}: ${c}`}+ title={`Brand colour ${i + 1}: ${c}`}><inputtype="color"value={c}onChange={(e) => setColor(i, e.target.value)}className="absolute inset-0 opacity-0 cursor-pointer w-full h-full"- aria-label={`Edit brand color ${i + 1}`}+ aria-label={`Edit brand colour ${i + 1}`}/></label><button@@ -106,10 +197,45 @@ export function BrandPanel() {</div>))}</div>- <p className="text-[11px] text-white/40 mt-2">Click a swatch to edit • hover and hit ✓ to apply to selection</p>+ <button onClick={savePalette} className="mt-2 text-[11px] text-white/50 hover:text-white inline-flex items-center gap-1">+ <Palette size={11} /> Save current colours as palette+ </button>++ {(local.palettes?.length ?? 0) > 0 && (+ <>+ <h4 className="mt-5 mb-2 text-xs font-semibold text-white/50 uppercase tracking-wide flex items-center gap-1.5">+ <Layers size={13} /> Palettes+ </h4>+ <div className="space-y-1.5">+ {local.palettes!.map((pal, pi) => (+ <div key={pi} className="group flex items-center gap-2 rounded-lg border border-white/10 bg-white/[0.03] p-1.5 hover:border-[#7630D7]/50 transition-colors">+ <div className="flex gap-1.5 flex-1">+ {pal.map((c) => (+ <button+ key={c}+ className="h-6 w-6 rounded-full border border-white/20 hover:scale-110 transition-transform"+ style={{ background: c }}+ onClick={() => applyColor(c)}+ title={`Apply ${c}`}+ aria-label={`Apply ${c}`}+ />+ ))}+ </div>+ <button+ className="opacity-0 group-hover:opacity-100 text-white/40 hover:text-red-400"+ onClick={() => persist({ ...local, palettes: local.palettes!.filter((_, i) => i !== pi) })}+ aria-label="Delete palette"+ >+ <Trash2 size={12} />+ </button>+ </div>+ ))}+ </div>+ </>+ )}<h4 className="mt-6 mb-2 text-xs font-semibold text-white/50 uppercase tracking-wide flex items-center gap-1.5">- <Wand2 size={13} /> Brand fonts+ <Type size={13} /> Brand fonts</h4><div className="space-y-2"><FontRow@@ -126,6 +252,46 @@ export function BrandPanel() {/></div>+ <h4 className="mt-6 mb-2 text-xs font-semibold text-white/50 uppercase tracking-wide flex items-center gap-1.5">+ <ImagePlus size={13} /> Logos+ </h4>+ <div className="grid grid-cols-4 gap-2">+ {(local.logos ?? []).map((src, i) => (+ <div key={i} className="group relative rounded-lg border border-white/10 bg-[#0F1015] aspect-square overflow-hidden">+ <button onClick={() => addLogoToCanvas(src)} className="w-full h-full flex items-center justify-center" aria-label="Add logo to canvas" title="Add to canvas">+ <img src={src} alt="Brand logo" className="max-w-full max-h-full object-contain p-1" />+ </button>+ <button+ className="absolute top-0.5 right-0.5 opacity-0 group-hover:opacity-100 text-white/60 hover:text-red-400 bg-black/50 rounded p-0.5"+ onClick={() => persist({ ...local, logos: local.logos!.filter((_, j) => j !== i) })}+ aria-label="Remove logo"+ >+ <Trash2 size={11} />+ </button>+ </div>+ ))}+ <button+ onClick={() => logoInputRef.current?.click()}+ className="rounded-lg border-2 border-dashed border-white/15 hover:border-[#7630D7] aspect-square flex flex-col items-center justify-center text-white/40 hover:text-white transition-colors"+ aria-label="Upload logo"+ >+ <Plus size={16} />+ <span className="text-[9px] mt-1">Logo</span>+ </button>+ <input+ ref={logoInputRef}+ type="file"+ accept="image/*"+ className="hidden"+ onChange={(e) => {+ const f = e.target.files?.[0]+ if (f) void addLogo(f)+ e.target.value = ''+ }}+ aria-label="Logo file"+ />+ </div>+<div className="mt-6 rounded-xl border border-dashed border-white/15 p-4 text-center"><div className="text-white/70 text-sm font-semibold">Brand kit preview</div><div className="mt-2 rounded-lg p-3" style={{ background: local.colors[0], color: '#fff' }}>@@ -135,7 +301,14 @@ export function BrandPanel() {</div><button- className="w-full h-10 rounded-xl bg-[#7630D7] hover:bg-[#8B5CF6] text-white text-[13px] font-semibold mt-3 transition-colors"+ className="w-full h-10 rounded-xl bg-gradient-to-r from-[#02C0CC] to-[#7630D7] hover:brightness-110 text-white text-[13px] font-semibold mt-3 flex items-center justify-center gap-1.5 transition-all"+ onClick={applyBrandToPage}+ >+ <Wand2 size={14} /> Apply brand style to page+ </button>++ <button+ className="w-full h-9 rounded-xl border border-white/12 hover:bg-white/[0.06] text-white/70 text-[12px] font-semibold mt-2 transition-colors"onClick={() => persist(DEFAULT_BRAND)}>Reset to defaults@@ -144,6 +317,13 @@ export function BrandPanel() {)}+function fillColorOf(el: AnyElement): string | null {+ if (el.type === 'text') return (el as { fill: string }).fill+ if (el.type === 'line' || el.type === 'stroke') return (el as { stroke: string }).stroke+ if (['rect', 'ellipse', 'triangle', 'star', 'path'].includes(el.type)) return (el as { fill: string }).fill+ return null+}+function FontRow({ label, font, onChange, onApply }: { label: string; font: string; onChange: (f: string) => void; onApply: () => void }) {return (<div className="flex items-center gap-2">diff --git a/src/components/editor/panels/TemplatesPanel.tsx b/src/components/editor/panels/TemplatesPanel.tsxindex c22a822..1e201e5 100644--- a/src/components/editor/panels/TemplatesPanel.tsx+++ b/src/components/editor/panels/TemplatesPanel.tsx@@ -1,7 +1,8 @@'use client'-import { useMemo, useState } from 'react'-import { TEMPLATES } from '@/lib/templates'+import { useEffect, useMemo, useState } from 'react'+import { Search, Sparkles, Clock, X, Check } from 'lucide-react'+import { TEMPLATES, type TemplateDef } from '@/lib/templates'import { useEditorStore } from '@/store/editor-store'import { DesignPreview } from '@/components/design-preview'import { cn } from '@/lib/utils'@@ -9,15 +10,57 @@ import { TEMPLATE_CATEGORIES } from '@/lib/types'export function TemplatesPanel() {const applyTemplate = useEditorStore((s) => s.applyTemplate)+ const pages = useEditorStore((s) => s.pages)const [category, setCategory] = useState('all')+ const [query, setQuery] = useState('')+ const [loading, setLoading] = useState(true)+ const [preview, setPreview] = useState<TemplateDef | null>(null)- const list = useMemo(() => TEMPLATES.filter((t) => category === 'all' || t.category === category), [category])+ // brief skeleton on first open (canva templates load with skeletons)+ useEffect(() => {+ const t = setTimeout(() => setLoading(false), 350)+ return () => clearTimeout(t)+ }, [])++ const list = useMemo(+ () =>+ TEMPLATES.filter((t) => {+ const inCat = category === 'all' || t.category === category+ const q = query.trim().toLowerCase()+ const inQuery = !q || t.name.toLowerCase().includes(q) || t.category.toLowerCase().includes(q)+ return inCat && inQuery+ }),+ [category, query]+ )++ const recommended = useMemo(() => TEMPLATES.slice(0, 4), [])++ const designHasContent = pages.some((p) => p.elements.length > 0)++ const use = (t: TemplateDef) => {+ applyTemplate(t)+ setPreview(null)+ }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]">+ <div className="px-4 pt-4 pb-3 border-b border-white/[0.07] shrink-0"><h3 className="font-bold text-sm">Templates</h3>- <p className="text-xs text-white/50 mt-0.5">Applying a template replaces this design's pages.</p>+ <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+ value={query}+ onChange={(e) => setQuery(e.target.value)}+ className="bg-transparent outline-none text-[12px] text-white w-full placeholder:text-white/35"+ placeholder="Search templates"+ aria-label="Search templates"+ />+ {query && (+ <button onClick={() => setQuery('')} aria-label="Clear search" className="text-white/40 hover:text-white">+ <X size={12} />+ </button>+ )}+ </div><div className="mt-3 flex gap-1.5 flex-wrap">{[{ id: 'all', label: 'All' }, ...TEMPLATE_CATEGORIES.map((c) => ({ id: c.id, label: c.label }))].map((c) => (<button@@ -33,23 +76,111 @@ export function TemplatesPanel() {))}</div></div>+<div className="flex-1 overflow-y-auto cv-scroll-dark p-4">- <div className="grid grid-cols-2 gap-3">- {list.map((t) => (- <button- key={t.slug}- onClick={() => applyTemplate(t)}- className="group text-left rounded-lg overflow-hidden border border-white/10 hover:border-[#7630D7] transition-all"- aria-label={`Apply template ${t.name}`}- >- <div className="bg-[#0F1015]" style={{ aspectRatio: `${t.width} / ${t.height}` }}>- <DesignPreview page={t.pages[0]} width={t.width} height={t.height} />- </div>- <div className="px-2 py-1.5 text-[11px] font-medium truncate bg-[#16181D] text-white/80">{t.name}</div>- </button>- ))}+ {loading ? (+ <div className="grid grid-cols-2 gap-3">+ {Array.from({ length: 6 }).map((_, i) => (+ <div key={i} className="cv-skeleton aspect-[4/5] w-full" />+ ))}+ </div>+ ) : !query && category === 'all' ? (+ <>+ <SectionLabel icon={<Sparkles size={11} />}>Recommended for you</SectionLabel>+ <div className="grid grid-cols-2 gap-3 mb-5">+ {recommended.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) => (+ <TemplateCard key={t.slug} t={t} onApply={() => use(t)} onPreview={() => setPreview(t)} />+ ))}+ </div>+ </>+ ) : list.length ? (+ <div className="grid grid-cols-2 gap-3">+ {list.map((t) => (+ <TemplateCard key={t.slug} t={t} onApply={() => use(t)} onPreview={() => setPreview(t)} />+ ))}+ </div>+ ) : (+ <EmptyState label={`No templates match “${query}”`} />+ )}+ </div>++ {/* full-size preview modal */}+ {preview && (+ <>+ <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>+ <button className="text-white/60 hover:text-white" onClick={() => setPreview(null)} aria-label="Close preview">+ <X size={16} />+ </button>+ </div>+ <div className="rounded-xl overflow-hidden border border-white/10 bg-[#0F1015]" style={{ aspectRatio: `${preview.width} / ${preview.height}` }}>+ <DesignPreview page={preview.pages[0]} width={preview.width} height={preview.height} />+ </div>+ <div className="flex items-center justify-between mt-3">+ <span className="text-[11px] text-white/50">+ {preview.width} × {preview.height} px · {preview.pages.length} page{preview.pages.length > 1 ? 's' : ''}+ {designHasContent && ' · replaces current pages'}+ </span>+ <button className="btn-cv h-9 px-4 text-[13px] flex items-center gap-1.5" onClick={() => use(preview)}>+ <Check size={14} /> Use this template+ </button>+ </div>+ </div>+ </>+ )}+ </div>+ )+}++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"+ aria-label={`Template ${t.name}`}+ >+ <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} /></div>+ </button>+ <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>+ <div className="absolute inset-x-0 bottom-9 p-1.5 opacity-0 group-hover:opacity-100 transition-opacity bg-gradient-to-t from-black/70 to-transparent">+ <button+ onClick={onApply}+ className="w-full h-8 rounded-lg bg-[#7630D7] hover:bg-[#8b5cf6] text-white text-[11px] font-bold transition-colors"+ aria-label={`Apply ${t.name}`}+ >+ Apply+ </button>+ </div>+ </div>+ )+}++function SectionLabel({ icon, children }: { icon: React.ReactNode; children: React.ReactNode }) {+ return (+ <h4 className="flex items-center gap-1.5 text-[11px] font-bold text-white/45 uppercase tracking-wide mb-2.5">+ {icon} {children}+ </h4>+ )+}++function EmptyState({ label }: { label: string }) {+ return (+ <div className="flex flex-col items-center py-10 text-white/35">+ <Search size={26} strokeWidth={1.4} />+ <p className="text-xs mt-2.5 text-center">{label}</p>+ <p className="text-[11px] mt-1 text-white/25">Try “instagram”, “poster” or “logo”</p></div>)}diff --git a/src/components/editor/panels/UploadsPanel.tsx b/src/components/editor/panels/UploadsPanel.tsxindex 1a22546..b949757 100644--- a/src/components/editor/panels/UploadsPanel.tsx+++ b/src/components/editor/panels/UploadsPanel.tsx@@ -45,7 +45,7 @@ export function UploadsPanel() {force((n) => n + 1)}- const useGalleryItem = (item: UploadItem) => {+ const applyGalleryItem = (item: UploadItem) => {if (hasImageSelected) {replaceSelectedImage(item.src, item.w, item.h)toast({ title: 'Image replaced' })@@ -138,7 +138,7 @@ export function UploadsPanel() {{uploadGallery.items.map((item, i) => (<div key={i} className="group relative"><button- onClick={() => useGalleryItem(item)}+ onClick={() => applyGalleryItem(item)}className={cn('w-full rounded-lg overflow-hidden border transition-all aspect-square bg-[#0F1015]',hasImageSelecteddiff --git a/src/components/editor/tooltip.tsx b/src/components/editor/tooltip.tsxnew file mode 100644index 0000000..181f2d4--- /dev/null+++ b/src/components/editor/tooltip.tsx@@ -0,0 +1,51 @@+'use client'++import { useRef, useState } from 'react'++/** canva-style tooltip: dark chip, ~600ms delay, fixed positioning. */+export function Tip({+ label,+ children,+ side = 'bottom',+ delay = 600,+}: {+ label: string+ children: React.ReactNode+ side?: 'top' | 'bottom' | 'right'+ delay?: number+}) {+ const [pos, setPos] = useState<{ x: number; y: number; tx?: string } | null>(null)+ const timer = useRef<ReturnType<typeof setTimeout> | null>(null)++ const show = (e: React.MouseEvent) => {+ const r = (e.currentTarget as HTMLElement).getBoundingClientRect()+ if (side === 'right') {+ const y = Math.max(8, Math.min(r.top + r.height / 2, window.innerHeight - 30))+ timer.current = setTimeout(() => setPos({ x: r.right + 10, y, tx: 'translateY(-50%)' }), delay)+ return+ }+ const x = Math.max(8, Math.min(r.left + r.width / 2, window.innerWidth - label.length * 7 - 16))+ const y = side === 'bottom' ? r.bottom + 8 : r.top - 34+ timer.current = setTimeout(() => setPos({ x, y, tx: 'translateX(-50%)' }), delay)+ }+ const hide = () => {+ if (timer.current) clearTimeout(timer.current)+ setPos(null)+ }++ return (+ <span+ className="contents"+ onMouseEnter={show}+ onMouseLeave={hide}+ onMouseDown={hide}+ >+ {children}+ {pos && (+ <span className="cv-tip" style={{ left: pos.x, top: pos.y, transform: pos.tx }} role="tooltip">+ {label}+ </span>+ )}+ </span>+ )+}diff --git a/src/lib/types.ts b/src/lib/types.tsindex 8e2d385..647f14e 100644--- a/src/lib/types.ts+++ b/src/lib/types.ts@@ -135,12 +135,22 @@ export interface BrandKit {colors: string[]headingFont: stringbodyFont: string+ /** saved colour palettes (swatch rows) */+ palettes?: string[][]+ /** uploaded logo dataURLs */+ logos?: string[]}export const DEFAULT_BRAND: BrandKit = {colors: ['#7630D7', '#02C0CC', '#FF5C8A', '#1F142E', '#FFD166'],headingFont: 'Archivo Black',bodyFont: 'Inter',+ palettes: [+ ['#7630D7', '#02C0CC', '#FF5C8A'],+ ['#1F142E', '#6E717F', '#E0E1E6'],+ ['#FF5C8A', '#FFB84C', '#FFE066'],+ ],+ logos: [],}export type AnyElement =