Donner 0.5.1
Embeddable browser-grade SVG2 engine
Loading...
Searching...
No Matches
editor Directory Reference
Directory dependency graph for editor:

Directories

 
app
 
gui
 
repro
 
sandbox

Files

 
AsyncRenderer.h
 AsyncRenderer owns a svg::Renderer and runs its draw() + takeSnapshot() on a dedicated worker thread so heavy renders don't block the UI thread.
 
AsyncSVGDocument.h
 AsyncSVGDocument is the editor-owned wrapper around svg::SVGDocument that gates DOM mutations through the CommandQueue and provides the snapshot hand-off to the render thread described in the M1.5 design note in docs/design_docs/editor.md.
 
AttributeWriteback.h
 Builds a TextPatch that updates an SVG element's attribute in the source text. This is the bridge between a canvas tool mutation (e.g. a drag that changes transform) and the source pane.
 
ChangeClassifier.h
 Classifies a text edit as either an attribute-value change on a specific element (fast path → SetAttributeCommand) or a structural change (fallback → ReplaceDocumentCommand). This is the M5 gate: when structured editing is enabled, the main loop calls classifyTextChange instead of unconditionally emitting a ReplaceDocumentCommand.
 
ClipboardInterface.h
 Abstract clipboard interface used by the editor's text-editor core (see text_editor_refactor.md). Decouples copy/cut/paste from ImGui so headless unit tests can inject an in-memory implementation instead of requiring an ImGui context.
 
CommandQueue.h
 CommandQueue is the per-frame EditorCommand queue described in the "AsyncSVGDocument: single-threaded command queue" section of docs/design_docs/editor.md. It accumulates editor-initiated DOM mutations on the UI thread and coalesces them at flush time.
 
DialogPresenter.h
 
DocumentSyncController.h
 
EditorApp.h
 EditorApp is the editor's top-level shell — the mutation-seam frontend that tools and the main loop interact with. Owns the AsyncSVGDocument, the active selection, and (eventually) the active tool dispatcher.
 
EditorCommand.h
 EditorCommand is the discriminated union of every UI-thread→DOM mutation in the M2 scope of the editor. New tools (path, node-edit, etc.) extend this variant in their own follow-up milestones — one new case per logical operation, NOT one per ECS write.
 
EditorInputBridge.h
 
EditorShell.h
 
ExperimentalDragPresentation.h
 
GlTextureCache.h
 
ImGuiBackendIncludes.h
 
ImGuiClipboard.h
 Production ClipboardInterface implementation backed by ImGui's clipboard functions (ImGui::GetClipboardText / SetClipboardText).
 
ImGuiIncludes.h
 
ImGuiInternalIncludes.h
 
InMemoryClipboard.h
 Header-only in-memory implementation of ClipboardInterface. Stores a single std::string in the object — no OS / ImGui interaction.
 
KeyboardShortcutPolicy.h
 
MenuBarPresenter.h
 
OverlayRenderer.h
 OverlayRenderer draws editor chrome (currently selection path outlines) directly into the renderer's existing frame buffer using the canvas primitives RendererInterface already exposes. It is not a separate compositing layer and not a fabricated SVG subtree — chrome and document share one render target so there is no subpixel drift between them.
 
PinchEventMonitor.h
 Platform-specific render-pane pinch gesture capture. On macOS this installs a local magnify-event monitor and feeds synthetic zoom scroll events into the existing editor queue.
 
RenderCoordinator.h
 
RenderPaneGesture.h
 Headless classification for render-pane scroll gestures. main.cc feeds raw GLFW scroll events into this helper so tests can cover pan vs. zoom routing without depending on ImGui or GLFW.
 
RenderPanePresenter.h
 
SelectionAabb.h
 
SelectTool.h
 SelectTool is the editor's first and (in this milestone) only tool. It dispatches three different gestures off onMouseDown:
 
SidebarPresenter.h
 
SourceSync.h
 Helpers for keeping the source pane, command queue, and DOM parse state in sync when editor-owned code writes bytes back into the text buffer.
 
TextBuffer.h
 
TextEditor.h
 
TextEditorCore.h
 Headless editing substrate for the ImGui TextEditor widget.
 
TextPatch.h
 The TextPatch type and applyPatches function form the editor's canvas-to-text writeback sideband. When a tool mutates an attribute via EditorApp::applyMutation, it also produces a TextPatch that describes the corresponding byte-level splice in the source text. The main loop drains pending patches after flushFrame() and before rendering the source pane.
 
Tool.h
 Tool is the abstract interface for editor pointer tools (Select, future Path, future Node-edit, etc.). Tools observe the editor state via the EditorApp& parameter and produce DOM mutations exclusively by calling EditorApp::applyMutation() — they never touch the DOM directly.
 
TracyWrapper.h
 Conditional Tracy profiling macros for the editor. When ENABLE_TRACY is defined, the real Tracy profiler client is included; otherwise the macros expand to no-ops so editor code can be instrumented unconditionally.
 
UndoTimeline.h
 
ViewportGeometry.h
 
ViewportInteractionController.h
 
ViewportState.h
 ViewportState is the single source of truth for the editor render pane's screen↔document coordinate mapping. See docs/design_docs/0025-editor_ux.md for the full design rationale; this header is the public API.

Detailed Description

Donner Editor

The Donner editor is a browser-based and desktop SVG editor built on top of the Donner SVG engine. It uses a sandbox architecture to isolate the parser child from the host, communicating via a wire format that the ReplayingRenderer decodes onto whatever RendererInterface backend was selected at build time.

Building

Desktop (default — tiny-skia backend)

bazel build //donner/editor/gui:donner_editor_gui
bazel run //donner/editor/gui:donner_editor_gui

Desktop — Geode (WebGPU) backend

bazel build --config=geode //donner/editor/gui:donner_editor_gui
bazel run --config=geode //donner/editor/gui:donner_editor_gui

WASM (default — tiny-skia backend)

bazel build --config=editor-wasm //donner/editor/wasm:wasm
bazel run --config=editor-wasm //donner/editor/wasm:serve_http

WASM — Geode (WebGPU) backend

bazel build --config=editor-wasm-geode //donner/editor/wasm:wasm
bazel run --config=editor-wasm-geode //donner/editor/wasm:serve_http

Renderer backend selection

The editor uses the backend-agnostic Renderer wrapper (donner/svg/renderer/Renderer.h). The active backend is selected entirely at build time via the --//donner/svg/renderer:renderer_backend flag. No runtime flags or C++ code branches are needed:

Config Backend
(default) TinySkia — lightweight software rasterizer
--config=geode Geode — experimental WebGPU + Slug

Running tests

bazel test //donner/editor/...