Phase D of docs/AFFINE.md (ADR-14).
The canvas lives in the page's Y.Doc next to its text, in
ydoc.getMap("surface"): one Y.Map per element, each field its own entry so
concurrent edits merge. The page's text is a note on the canvas bound to
the same "default" fragment, so typing on the canvas is typing in the page.
Canvas edits have their own undo history through a Y.UndoManager.
- New package @docwell/canvas: viewport with pan, zoom and pinch;
selection, marquee, snapping, resize and rotate; notes, text, shapes
(plain or scribbled), connectors (straight, curve, elbow, with arrowheads
and labels), pen and eraser, frames, groups, pictures, embeds and link
cards, and mind maps (right, left or both sides; Tab, Enter, arrows).
A style bar over the selection; the last style per kind is the default.
- Presentation through frames, stickers and templates, PNG and SVG export.
- Page/Edgeless switch in the header, ?mode= in page and share links, a
per-page default (pages.default_mode) and a per-device default for new
pages; share links show the canvas read-only.
- Server: yrs writes the canvas into the document JSON as "surface",
adds its text to search, and writes it back on restores and templates.
- Phone: the bridge draws the canvas read-only (protocol 3) and the page
screen has a canvas button.
Strings are translated into all five languages and the user guide covers
edgeless mode.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Phase C of docs/AFFINE.md (ADR-13).
A database is a block whose records live in the page's Y.Doc, in
ydoc.getMap("blocks") under the block's id: columns, rows (each cell its
own map entry, so concurrent edits to one row merge) and views. Order is
a fractional position per item, so moving a row keeps edits made to it at
the same time. Database edits share the page's undo history.
- Thirteen property types: title, text, number, checkbox, select,
multi-select, date, progress, link, attachment, member, created time
and created by. The column menu renames, changes type (converting the
values), sorts, filters, hides, inserts, moves, duplicates and deletes;
columns resize and drag.
- Table view: keyboard navigation, range selection, typing to edit,
copy and paste with spreadsheets (pasting adds rows as needed), row
dragging, bulk delete, grouping.
- Views in tabs, each with its own filters (all/any), sorts, grouping
and visible properties; kanban grouped by select, multi-select,
checkbox or member with cards dragged between columns; calendar by a
date property with records dragged between days.
- A record opens beside the page with its properties and a body of its
own (a Y.XmlFragment in the row, edited by a second editor).
- /database, Ctrl+G or "Group as database" turns a list into a database;
CSV export and import; a copied, pasted or duplicated database gets
its own copy of the records.
Server: yrs writes each database's records into its node as attrs.data
when it turns a document into JSON, adds them to the search text, and
writes them back on imports, restores and templates. Markdown, HTML,
PDF and Word exports show a database as a table of its first view's
columns. Notion database CSVs import as database blocks with guessed
types. Share links and history previews show databases read-only.
Strings are translated into all five languages, the user guide covers
databases, and the mobile editor bundle is rebuilt.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Repository basics:
- CONTRIBUTING.md and CODE_OF_CONDUCT.md (Contributor Covenant 2.1)
- SPDX AGPL-3.0-or-later headers on all hand-written sources, checked in CI
- golangci-lint (shared .golangci.yml), ESLint and Prettier, all run in CI
API codegen from api/openapi.yaml (npm run generate, drift fails CI):
- Go types via oapi-codegen in Server/internal/api
- a contract test that the router and the spec list the same routes
- Dart models via Phone-App/tool/generate_api.dart; the app uses them
Spike: shared Tiptap editor in a Flutter WebView (ADR-4)
- @docwell/editor-bridge builds the editor into one HTML page with a
versioned JSON protocol; Phone-App hosts it with webview_flutter and a
native toolbar. Integration test passes on an Android API 35 emulator.
- flutter_inappwebview dropped: its Android plugin fails on AGP 9.
Spike: Wails v3 desktop (ADR-11)
- system tray, docwell:// deep links (page and space only) with
single-instance hand-off, and the built-in updater with a required
ed25519 signing key. Verified on Windows.
- regenerated build assets register the scheme and drop template
placeholders.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pages are now shared Yjs documents. docwell-server relays the y-websocket
protocol at /collab (token sent as the first message), flushes updates to
page_yupdates every second, and compacts them into page_ydoc with yrs
compiled to WebAssembly under wazero (ADR-3) after 30 s idle or when the
last editor leaves. Compaction refreshes content_json/content_text and
records page_versions; versions can be listed, previewed and restored.
The editor connects through a small y-protocols provider with carets and
presence. Pages saved before this change are seeded from content_json.
The yrs module lives in Server/ycrdt-wasm and is built by go generate,
CI and the Dockerfiles rather than committed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>