How xachary/konva-designer-sample works
Project Type and Purpose
• This is a frontend single‐page application built with Vue 3, Vite, and TypeScript.
• It provides an interactive designer canvas using the Konva.js library.
High-Level Architecture
A. Browser / Client
• Vue Application (App.vue, PlayPage.vue)
• UI Components (AssetBar, MainHeader, settings panel)
B. Domain Logic Layer
• State Management (Vue reactive state in main.ts + log.ts)
• Tools (src/Render/tools/*) – AlignTool, AssetTool, LinkTool, etc.
• Handlers (src/Render/handlers/*) – DragHandlers, ZoomHandlers, SelectionHandlers, etc.
C. Rendering Engine
• Graph definitions (src/Render/graphs/*) define geometric primitives
D. Data Persistence & I/O
• ImportExportTool for loading/saving JSON design files
• Public/docs directories hold sample JSON and assets for docs
E. Build & Deployment
• Vite (vite.config.ts) for bundling dev/prod builds
• Husky & commitlint for pre-commit hooks
• GitHub Actions (deploy.yml) for CI/CD to GitHub Pages
Relationships and Data Flow
1. UI Components dispatch user events (click/drag/keyboard).
2. Handlers receive events, update reactive state & invoke Tools.
3. Tools modify Models (graph nodes, links) or call Import/Export logic.
6. Preview window subscribes to the same state and renders a secondary Konva view.
Architectural Patterns & Design Principles
• Separation of Concerns: UI vs. business logic (Tools & Handlers) vs. rendering code.
• Reactive State: Vue’s reactivity drives canvas updates without manual DOM manipulation.
Technologies & Frameworks
• Vue 3 + Composition API for UI and reactivity
• TypeScript for type safety (env.d.ts, tsconfig.json)
• Vite for fast dev server & production build
• Husky & commitlint for code hygiene
• GitHub Actions for automated deployment