- Tauri v2 desktop shell with 1280x800 window - CanvasKit WASM (Skia) rendering via WebGL2 - Scene graph with typed nodes (Frame, Rectangle, Ellipse, Line, etc.) - Skia renderer with fills, strokes, rounded corners, opacity, rotation - Selection system with resize handles - Undo/redo manager (inverse command pattern with batching) - Bottom toolbar (Select, Frame, Rect, Ellipse, Line) matching Figma UI3 - Left layers panel, right properties panel - Pan (scroll), zoom (Ctrl+scroll toward cursor) - Keyboard shortcuts: V/F/R/O/L for tools, Cmd+Z undo, Backspace delete - 5 demo shapes rendered on canvas
46 lines
1.1 KiB
TypeScript
46 lines
1.1 KiB
TypeScript
import { defineConfig } from "vite";
|
|
import react from "@vitejs/plugin-react";
|
|
import { copyFileSync, existsSync } from "fs";
|
|
|
|
// @ts-expect-error process is a nodejs global
|
|
const host = process.env.TAURI_DEV_HOST;
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig(async () => ({
|
|
plugins: [
|
|
{
|
|
name: "copy-canvaskit-wasm",
|
|
buildStart() {
|
|
const src = "node_modules/canvaskit-wasm/bin/canvaskit.wasm";
|
|
const dest = "public/canvaskit.wasm";
|
|
if (existsSync(src) && !existsSync(dest)) {
|
|
copyFileSync(src, dest);
|
|
}
|
|
},
|
|
},
|
|
react(),
|
|
],
|
|
|
|
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
|
|
//
|
|
// 1. prevent Vite from obscuring rust errors
|
|
clearScreen: false,
|
|
// 2. tauri expects a fixed port, fail if that port is not available
|
|
server: {
|
|
port: 1420,
|
|
strictPort: true,
|
|
host: host || false,
|
|
hmr: host
|
|
? {
|
|
protocol: "ws",
|
|
host,
|
|
port: 1421,
|
|
}
|
|
: undefined,
|
|
watch: {
|
|
// 3. tell Vite to ignore watching `src-tauri`
|
|
ignored: ["**/src-tauri/**"],
|
|
},
|
|
},
|
|
}));
|