Integrate the new canvas modules into CanvasWorkspace and the layer
panel:
- Capture debounced history snapshots per operation and show them in
the layer panel's History section with row preview, a restore
button, and an edit-blocking shield while previewing; saving is
paused during preview and restore truncates newer states
- Copy nodes through the lossless clipboard payload alongside the
PNG/HTML/plain-text representations, and prefer it when pasting from
the context menu, keyboard, or system clipboard
- Apply boolean operations as flattened path result nodes (replacing
the operand group) and route path-editor commits through
applyEditedPathToNodes so operand children are dropped
- Drive the Pen tool controls from the selected path node's style and
keep the Pen tool active after committing a draft
- Add history i18n strings (en-US, zh-CN) and layer-history styles
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add pathPenSettingsForNode / pathPenSettingsToShapeStyle so the Pen
tool controls can display and edit the selected path node's stroke
color and width in screen space, and let CanvasPathEditor re-apply
fill/stroke/opacity to the mounted leafer path when the node's style
changes during editing.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Serialize canvas nodes into a versioned JSON payload carried on a
custom clipboard MIME type, with the same payload embedded in the
copied SVG markup as a text/html and text/plain fallback. Parsing
prefers the internal format over PNG previews and plain text, restores
path data from the SVG fallback, rejects malformed payloads, and
creates pasted nodes at the paste anchor without rasterizing them.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add canvasHistory helpers that diff two node snapshots into a labeled
operation (boolean, add, delete, path edit, move, resize, style,
rename, reorder), keep the five most recent states, and truncate newer
entries when an older state is restored. Workspace wiring lands in a
follow-up commit.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add a booleanShapePath engine that runs union/subtract/intersect/
exclude/flatten through paper.js and returns normalized result path
data plus per-operand stroke segments, so boolean results are real
vector paths instead of SVG mask approximations.
- Store the computed pathData on boolean groups and recompute it when
the operation changes; flatten legacy groups into ordinary path nodes
- Render previews and SVG/PSD exports from the computed result path,
keeping each operand's stroke style on the boundary it contributes
- Open boolean results in the path editor and flatten them on commit
- Add paper 0.12.18 with a paper-core type shim and mark it as a
server-external package for the standalone Next build
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Implemented CanvasPathEditor component for editing paths on the canvas.
- Created editablePath module to handle path data manipulation and conversion to SVG.
- Introduced pathPen module for managing path drawing with a pen tool, including anchor management and path data generation.
- Added tests for editablePath and pathPen functionalities to ensure correctness of path editing and drawing behavior.
Show a localized "Generating" label on the artboard generation skeleton
while keeping the planned title as the aria-label, so in-progress nodes read
as a status instead of prematurely displaying their eventual name.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Resolve the most recent canvas-node reference from the prompt's reference
images (by node id or matching asset URL) and append it as a hidden
"reference anchor node:" settings directive on agent submissions, so the
server can place generated images beside the source. Keep the persisted
user-visible copy unchanged.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Read a "reference anchor node:" agent directive and lay newly generated
image nodes immediately to the right of that node, inheriting its row and
falling back to its size, for planned, follow-up, and incremental flows.
Generalize the directive parser shared with the image-generator target.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Introduce a leafer-ui canvas layer that mirrors rendered nodes and drives
viewport, node-drag, and alignment-guide updates imperatively, committing
React state on idle via startTransition to keep pan/zoom/drag at 60fps. Wire
the imperative viewport through wheel zoom, zoom-to, fit-view, and panning.
Add a dedicated crop tool: click a node to auto-detect a color-boundary crop
region or drag to preselect one, previewed with an on-canvas draft overlay
before entering the crop editor. Route uploads through renderContent so the
transparent WebP texture feeds the fast display path. Add node --test
coverage for the leafer renderer and color-boundary detection.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Rasterize imported SVG/CAD sources to a transparent WebP render texture and
carry it as an optional renderContent alongside the original content through
the domain node, snapshot normalization, and reference images. Add
canvasNodeRenderContent and prefer it for artboard, layer, generated-file,
and project thumbnail previews while keeping content as the crop/download/
model-reference source. Generalize the SVG rasterizer with a render purpose
and add upload/reference coverage.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add an optional renderContent field to canvas nodes across the go-zero API
type, domain node, SQLC models/queries, PostgreSQL schema, and mappers so a
lightweight transparent-WebP display texture persists alongside the original
content. Prefer renderContent for project thumbnails and main-canvas
previews, and treat both content and renderContent as protected/deletable
asset URLs during canvas asset cleanup. Extend round-trip coverage.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Extend CAD conversion to emit bounded semantic metadata (units, layers,
blocks, entity types, labels, crop-indexed bounds) alongside the derived
SVG, tag imported drawings as cad-vector nodes, and carry semanticContext
through canvas nodes, snapshot normalization, and reference images. Agent
Chat forwards this metadata as hidden cad-context reference parts.
Add non-destructive vector cropping: cropping a vector/CAD node keeps the
source SVG and spawns a transparent WebP sibling with crop-scoped semantic
context, wired through the vectorized image toolbar and the workspace crop
tool. Include node --test coverage for CAD semantics and vector crop.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a semantic_context column to canvas_nodes (schema, sqlc queries,
generated models, repository upserts) and thread SemanticContext through the
domain node, API type, and mappers so CAD-derived context survives canvas
saves.
Treat agent text parts with textSource "cad-context" like settings: keep
them for planning, memory, and image-generation prompts but exclude them
from the persisted user-visible message copy. Add coverage for the CAD
context visibility and mapper behavior.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Move canvas wheel zoom off the React onWheel prop into a manually attached
non-passive listener so preventDefault reliably suppresses page scroll, and
read the viewport from the ref to keep the handler referentially stable.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Accept DWG and DXF files (up to 24 MB) through the canvas asset picker and
drag-and-drop. Conversion runs locally in a browser worker via acad-ts,
uploads a sanitized derived SVG, and leaves the source file untouched. DXF
covers ASCII and binary drawings; DWG covers AutoCAD R14 through 2018.
Rename the image-only upload input/handler to a generic canvas asset flow,
add vector-image node detection, tag imported SVGs as vector-image nodes,
localize CAD import status/error messages, and switch the Next build to the
webpack compiler so the worker bundles correctly. Add a node --test suite
covering CAD conversion and vector image helpers.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add modelImageReferences to preprocess agent contents, uploading local
image references and surfacing their names in the prompt so the model can
cite them. Wire the preparer into the canvas agent submission path, pass
imageName through the floating composer references, and relax the prompt
directive parser to accept names containing arbitrary characters.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drive the drop-target border radius from --image-drop-radius, enlarge the
overlay radius, and widen the composer editor padding.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a VisualAnnotationPanel letting users mark regions on an image (brush,
circle, rectangle, cross) with per-mark edit instructions, composited into
an annotation guide image. The new "visual-annotation" node action sends
the unmarked source plus the annotated guide to the image model, editing
only numbered regions. Server validates the annotation image/instructions
and threads them through the generator task.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Clarify in API/README that device limits are enforced independently per
normalized device type with atomic overflow revocation, and add a mapper
test covering the RFC3339 UTC timestamp contract.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add an ImageDropOverlay component and useImageDropTarget hook that let
users drop an image onto the home prompt card or canvas agent composer to
upload it as a reference, with a localized drop overlay.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Track authenticated sessions per device (parsing user-agent for desktop
vs mobile via mileusna/useragent), enforce configurable concurrent device
limits (Auth.DeviceLimits), and surface device status and "remove other
devices" management in the account dialog. Adds device/session context to
the auth module stores and exposes limits through the API.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Track agent history loading in the workspace and render a spinner with a
localized "loading conversation history" message in the assistant feed,
so the empty state no longer flashes before history resolves.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Condense the settings-chip summary to quality, ratio, and image count
(dropping resolution and pixel size), wrap the label in an ellipsized
span, and swap the up/down chevron for a single rotating ChevronDown
across the canvas agent and image generator composers.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Render a CanvasAgentEmptyState in the Agent panel that fetches localized
starter content from the new agent-starters endpoint, with local defaults
as fallback. Clicking a starter focuses the prompt composer (new focus
handle). Includes accompanying UI polish: side-nav cleanup, animated
prompt examples, and canvas panel spacing tweaks.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a public GET /api/ui/agent-starters endpoint returning localized
empty-state content (title, description, preview images, and starter
prompts) for the canvas Agent panel. Content is server-configurable via
AgentStarter config with built-in zh-CN/en-US fallbacks, and the route is
exempt from authentication so shared canvases render the same content.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a brand kit domain model, repository, and dedicated page/route for
managing brand kits, plus a BrandKitSelector used on the home page and
canvas workspace. Home project creation and the workspace can attach a
brand kit to a project, with new i18n strings and a side-nav entry.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a brand kit domain with memory and postgres stores, a BrandKitService
for CRUD and resolution, and REST endpoints to list, upsert, and delete
brand kits. Projects can bind a brand kit whose resolved context and
reference images feed into the agent's long-term memory and design prompts.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Introduce sm/md/lg sizes on the Switch component driven by CSS custom
properties, move switch styling into a dedicated switch.css, and remove
the duplicated overrides from styles.css and ToolbarCustomizeDialog.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Move PSD generation off the server. The image-generation API only
produces raster formats, so drop the PSD request path, the oov/psd
decoder, and the LayeredDocumentGenerator wiring. Layer separation now
returns clean background, foreground, and text_render_data artifacts
into a transparent frame.
Export that frame (or any image node) as PSD from the canvas context
menu: ag-psd assembles layers, rotation/flip, opacity, editable text,
and stroke effects from the current canvas state at download time.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>