Commit graph

18 commits

Author SHA1 Message Date
Fini
0629a99260 fix(canvas): support fit-content sizing and initial sync for layout containers
- add fitContentWidth/fitContentHeight to compute container size from children
- getNodeWidth/getNodeHeight fallback to fit-content for containers without explicit dimensions
- computeLayoutPositions always propagates resolved width/height to child nodes
- trigger initial document-to-canvas sync on mount so default frame renders
2026-02-19 01:21:34 +08:00
Fini
b9241db194 feat(canvas): add frame name labels for top-level elements 2026-02-19 01:21:18 +08:00
Fini
2ab2a1d074 feat(canvas): add theme-aware background and zoom-to-fit-content
- canvas background follows dark/light theme via MutationObserver
- add zoomToFitContent() to center viewport on document content
- call zoomToFitContent after canvas init, new document, and open file
- refactor top-bar theme init to useEffect for SSR hydration safety
2026-02-19 01:21:08 +08:00
Fini
0d0be80129 feat(editor): add top bar with file operations, theme toggle and fullscreen
- new TopBar component: layer panel toggle, new/open/save, centered filename, theme switch, fullscreen
- add layerPanelOpen state and toggleLayerPanel action to canvas-store
- add light theme CSS variables in styles.css, persisted via localStorage
- conditionally render LayerPanel based on toggle state
2026-02-18 23:46:17 +08:00
Fini
28b42e2abf feat(store): add default frame for new documents and target AI insertion
- new documents start with a 1920x1080 white root frame
- AI-generated content inserts into the root frame instead of document root
- export DEFAULT_FRAME_ID constant for cross-module access
2026-02-18 23:46:17 +08:00
Fini
892cc789e1 feat(panels): conditional property panel, layer expand/collapse and scoped hover
- property panel only renders when an element is selected
- layer items show eye/lock icons only on the hovered row (group/layer scope)
- replace drag handle with chevron expand/collapse for nodes with children
- track collapsed state in LayerPanel, default all expanded
- remove uppercase from panel section headers
2026-02-18 23:46:16 +08:00
Kayshen-X
f85bbe69dc feat(panels): enhance UI components with SectionHeader and improve layout
Introduce a new SectionHeader component for consistent section titles and action buttons across panels. Refactor existing sections (Appearance, Effects, Fill, Stroke, Text) to utilize SectionHeader, improving visual hierarchy and user experience. Update styles for better alignment and spacing in various input components, ensuring a cohesive design throughout the property panel.
2026-02-18 23:34:23 +08:00
Kayshen-X
eaf66d976a feat(toolbar): implement image upload functionality and enhance toolbar
Add a new toolbar component with tools for selecting, drawing shapes, and adding images. Implement image upload functionality that allows users to add images to the canvas, including handling file selection and scaling images to fit the canvas. Update layer item icons to include an image icon for better visual representation.
2026-02-18 22:35:17 +08:00
Kayshen-X
6cde80454e feat(ai): add model selection and fetching capabilities
Enhance AI chat and generation functionalities by introducing model selection. Update the chat and generation endpoints to accept an optional model parameter. Implement a new API endpoint to fetch available AI models from the server, and integrate model selection into the AI chat panel for improved user experience.
2026-02-18 22:35:17 +08:00
Kayshen-X
03c44e51b0 chore: update documentation and add MIT License
Enhance CLAUDE.md with detailed architecture, key modules, and AI configuration. Introduce LICENSE file with MIT License terms. Remove obsolete Header component to streamline the codebase.
2026-02-18 22:35:17 +08:00
Kayshen-X
515801ce26 docs: update CLAUDE.md with UI component design tokens and Git commit guidelines
Add section on using shadcn/ui design tokens for UI components and establish guidelines for Git commit messages following the Conventional Commits format. Include details on commit types, scopes, and rules for writing clear commit messages.
2026-02-18 22:35:17 +08:00
Kayshen-X
2dbfab49d3 refactor: rename PascalCase files to kebab-case
Rename all component files to kebab-case per project convention
(e.g. EditorLayout.tsx → editor-layout.tsx). Remove obsolete
PascalCase originals that were replaced by kebab-case versions.
2026-02-18 22:35:17 +08:00
Kayshen-X
23aa080979 feat(codegen): add React and HTML code generation
Implement code generators that convert PenNode trees to React+Tailwind
and HTML+CSS output. Add code panel with tab switching, syntax
highlighting, and copy-to-clipboard. Supports generating code for
selected elements or the entire document.
2026-02-18 22:33:41 +08:00
Kayshen-X
6a7a0d0019 feat(ai): integrate AI chat and design generation
Add floating AI assistant panel with streaming chat, design keyword
detection, and automatic PenNode JSON extraction to canvas. Server
endpoints use Anthropic SDK (with API key) or Claude Agent SDK (local
OAuth) as fallback. Panel supports minimize, drag-to-snap, and
quick action presets.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 21:49:41 +08:00
Kayshen-X
b425defdca feat(history): add undo/redo, keyboard shortcuts, and file operations
Implement history store with undo/redo stacks using structuredClone
snapshots. Add keyboard shortcuts for common operations (copy, paste,
delete, group, save, export). Implement save-as dialog (.pen file
download) and export dialog (PNG/SVG with scale options).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 21:49:31 +08:00
Kayshen-X
a56577ea85 feat(panels): add property inspector and layer management
Implement property panel with sections for size, fill, stroke, corner
radius, text, appearance, and effects. Add layer panel with drag-and-drop
reordering, visibility toggles, and right-click context menu. Shared
form components: color picker, number input, and dropdown select.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 21:49:24 +08:00
Kayshen-X
01cc22412e feat(editor): scaffold core canvas engine and editor layout
Set up the Fabric.js v7 canvas integration with bidirectional sync
to a Zustand document store. Includes drawing tools (select, rectangle,
ellipse, line, text, frame, hand), viewport pan/zoom, smart guides,
dimension labels, and the main editor layout with toolbar and status bar.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 21:49:16 +08:00
Kayshen-X
c009ab7925 Initialize OpenPencil project with essential files and configurations
- Added .cta.json for project settings including TypeScript, Tailwind, and Bun as package manager.
- Created .gitignore to exclude common build and environment files.
- Introduced bun.lock for dependency management.
- Added CLAUDE.md for guidance on using Claude Code with the project.
- Set up package.json with scripts for development, build, and testing.
- Created README.md outlining project features, tech stack, and getting started instructions.
- Configured TypeScript with tsconfig.json for strict type checking.
- Established Vite configuration in vite.config.ts for project bundling.
- Added VSCode settings to exclude generated files from linting.
- Included public assets such as favicon and logos.
- Implemented initial routing structure in src/router.tsx and generated route tree in src/routeTree.gen.ts.
- Developed canvas functionality with multiple files for object management and event handling in src/canvas.
- Styled the application using Tailwind CSS in src/styles.css.
2026-02-17 21:14:16 +08:00