Skip to content

feat!: merge leaf into flower - #8

Merged
adammharris merged 928 commits into
mainfrom
merge-leaf
Nov 11, 2026
Merged

adammharris merged 928 commits into
mainfrom
merge-leaf

Conversation

@adammharris

Copy link
Copy Markdown
Member

Flower becomes one project: leaf's document editor and flower's data editor in one workspace, and one app that opens either kind of file.

  • History: leaf's main (dc2e9b0) is merged in, so both histories are here. Merge this PR with a merge commit, not a squash, or leaf's history is lost.
  • Crates: every leaf crate takes a flower- name (leaf-core → flower-doc, leaf-dioxus → flower-doc-editor), and the data crates move aside (flower-core → flower-data, flower-dioxus → flower-data-editor). Callers must update their imports.
  • App: apps/flower (bin Flower, org.diaryx.flower) opens HTML, Markdown and Djot as documents, and JSON, YAML, TOML, ZON and figl as data. A document with frontmatter can show it in the data editor.
  • Kept as leaf: the icon, the .leaf CSS class and --leaf-* variables, and the Blitz branch name.
  • Build: corgi.toml added; scripts/cargo.sh uses corgi where it is installed and cargo elsewhere.
  • Linux: scripts/install-linux.sh installs a dev build with its icon, desktop entry and file types.

Not verified

The Mac app's data windows and frontmatter view are type-checked and linted from Linux but have never run on a Mac (docs/tasks/the-mac-apps-data-windows-have-not-been-run-on-a-mac.md).

Checks

ship ci passes locally (all 6 jobs). CI job names change: the Dioxus and MSRV jobs are gone and a Web host job is new.

The Settings form moves to its own file and serves both platforms: the
Settings window on the Mac, and on iOS a sheet. A phone's navigation bar
held two of the four display tools and folded the rest into its own More
menu, so on iOS the four go into one menu at the end of the bar, with
Settings last; it holds the Mac's appearance menu too. The Mac's bar is
unchanged.

SettingsUITests opens the sheet from that menu, chooses a font and a line
spacing, checks that the open document redraws, and restores the defaults,
keeping a screenshot of each state in the result bundle.
Set Claude Code's `attribution` to empty for commits and pull requests,
so a session started in this repository adds no co-author trailer or
generated-by line. It is the setting the org repository already carries.
`doc.rs` had grown to 23k lines, with one `impl Doc` block running nearly
9,000 of them. Move it into `doc/` as one file per concern — editing,
newline, delete, splice, marks, presentation, blocks, tables, caret, undo,
file and so on — each its own `impl Doc` block, cut along the section
headings the file already carried. The free helpers at the bottom go to
`doc/text.rs`.

A pure move: no behaviour changes and no public API changes. The one
visible difference is that a private method another file now calls is
`pub(super)` — still private to `doc`. The tests stay in `doc/mod.rs` for
now.
The 12,700 lines of `Doc` tests move out of `doc/mod.rs` into one file per
topic under `doc/tests/`, cut along the section headings the test module
already had. A few headings had gathered tests on other subjects over
time, so those are cut again where the subject changes: the thematic-break
section yields tasks, rules and enter; the directive section yields atoms,
links, click, rich view and table keys.

The fixtures and harnesses more than one file uses (`doc_in`, `golden`,
`reference_map`, ...) live in `doc/tests/mod.rs`; a helper only one file
uses stays in that file. `verse_tests` becomes `doc/tests/verse.rs`.

No test changes: the same 869 run and pass, now under `doc::tests::<topic>`.
`wysiwyg.rs` was 12,200 lines: the map's types, its queries, three build
paths, the block cache, a 3,000-line `Builder`, the glyph helpers and
4,600 lines of tests. Give each its own file:

  mod.rs         the public types (Glyph, VRow, the marks)
  visual_map.rs  VisualMap's queries
  spans.rs       reading rows back into the spans the map publishes
  map_build.rs   Surface, Reveal, build / build_cached / build_spliced
  cache.rs       BlockCache
  queries.rs     AST queries the builds share
  builder/       the AST → glyph walker: blocks, verse, table, embeds,
                 inline, rows
  width.rs, info.rs, glyphs.rs, nodes.rs   the helpers
  tests/         the tests, one file per topic

Every public item is re-exported from `wysiwyg`, so `wysiwyg::VisualMap`,
`wysiwyg::build` and the rest keep their paths. An item another file now
reaches is `pub(super)`, or `pub(in crate::wysiwyg)` for a `Builder`
method called from outside `builder/`, which is the same reach it had as
a private item of the old single module. No behaviour changes; the same
869 tests pass.

Also point the docs and comments that named `doc.rs` or `wysiwyg.rs` at
the files that now hold what they describe. Closed tasks keep their
history as written.
refactor(leaf-core): split doc.rs and wysiwyg.rs into modules
Could one Dioxus widget be leaf's web, desktop and mobile frontend at once?
The question that decides it is narrow enough to measure, so this spike
measures it: what a keystroke costs through a virtual DOM, when leaf already
knows exactly which row changed.

Its own Cargo workspace, as spikes/mermaid-native is, so leaf takes no
dependency on Dioxus. It path-deps leaf-core, because the cost being measured
is the cost of leaf's own rows.

The bench is headless — no browser, no `dx`. A virtual DOM's output is a list
of mutations, and dioxus_core hands them to a `WriteMutations` of the caller's
choosing, so a keystroke is both timed and counted exactly.

Handed leaf's frame delta as pointer-compared row handles, Dioxus emits the
minimum 2 mutations per keystroke at any document length, and the wasm module
is smaller than leaf-wasm's. But its *time* is O(document) unless the rows are
virtualized (8.88 ms against 0.16 ms a keystroke at 5199 rows), a reflow is
O(rows below) either keyed or not (27 416 mutations), and source offsets in
the DOM rebuild every row under the caret. Virtualized it is viable;
unvirtualized it is not. README.md has the numbers, the gaps — dioxus-html has
no `onbeforeinput`, which is what leaf-web is built on, and its ClipboardData
is empty — and what it would take.

Claude-Session: https://claude.ai/code/session_01FN2Cu62HsdQSTKC7tRbt9w
The virtual-DOM measurements apply to every target; this is the other half —
what it looks like and what it costs to run.

Two renderers, both from the same widget: `dioxus-desktop` (wry, so WebKitGTK
here and WKWebView on Apple) and `dioxus-native` (Blitz, on wgpu, no browser
engine). Blitz is published only for 0.8.0-alpha.2, so native-alpha/ is a
workspace of its own pinning that alpha while the rest stays on 0.7.10.

It reuses this crate with `default-features = false`, which is the finding
worth keeping: `style`, `rows` and `frame` — the whole bridge from leaf's rows
to a virtual DOM's nodes — name no Dioxus type, so they compile against either
version. Only the `rsx!` had to be written twice. The components move behind a
`widget` feature to prove it.

They render the same picture: RMSE 0.11, 4.4% of pixels differing by more than
5%, confined to text antialiasing and the caret. They part on cost — 3
processes and 497 MB against 1 and 223 MB, both debug under llvmpipe, so the
shape rather than the magnitude.

leaf-gpui could not be captured: it builds and runs here, and software Vulkan
is available, but under Xvfb it opens no window and holds no X11 connection at
all. That is a container finding, not a gpui one, and it leaves the comparison
against leaf's own native frontend open. The repository's leaf-gpui.png is the
reference meanwhile, and the typography differs there because this spike is
monospace by its own caret decision — not because a webview cannot do better.

scripts/shoot.sh captures either binary the same way, so the pair is
reproducible on any machine with Xvfb, xdotool and ImageMagick.

Claude-Session: https://claude.ai/code/session_01FN2Cu62HsdQSTKC7tRbt9w
spike(dioxus): what a keystroke costs through a virtual DOM
Alignment, line spacing, size, face and text colour go into the node's own
`style` attribute as `text-align`, `line-height`, `font-size`, `font-family`
and `color`, so a browser, Obsidian, Typora or pandoc draws them with no
stylesheet. fig-css reads and edits the CSS, keeping every declaration leaf
did not write.

The names and exact values are unchanged. A named colour is written as the
ink presentation.css falls back to and read back as the name, so the theme
keeps both of its inks for it. A family name is single-quoted; one with a
quote or a backslash in it is refused with a status, since no spelling
survives every format. The `class` tokens and `data-` keys leaf wrote before
are still read, and a gesture moves its own property out of them. AsciiDoc
keeps that spelling.

Behavioural-change: the six presentation gestures write CSS into `style` (`<div style="text-align: center">`, `{style="font-size: large"}`) instead of a `class` token or a `data-` key, and take the property's old spelling off the node as they write. AsciiDoc is unchanged.
Behavioural-change: a `style` declaring a presentation property is read in preference to the `class` token or `data-` key beside it, and a `style` fig-css cannot parse makes a gesture refuse with a status rather than write.
feat(core): write the presentation vocabulary as CSS in style
native-alpha/ was a first paint for the screenshot: rows built once, the caret
parked at offset 0, no handlers. It is now the editor the parent's LeafEditor
is — the same key mapping (copied as input.rs, since Key and Modifiers are
0.8 types here), the same Frame, so a keystroke renders one row and the rest
memoize on their Rc — plus a click, which LeafEditor never had: x over an
approximate 0.6em cell, into Doc::click.

Two things Blitz does that a browser does not, both worked around here:

- A click focuses only form controls, and *clears* focus on anything else, so
  keys fell to the root element and never reached a tabindex div. The editor
  takes focus on mount and cancels the mouse's default actions, which also
  stops Blitz's own text selection drawing over leaf's. Cancelling
  `pointerdown` instead suppresses `mousedown` entirely.
- An absolutely positioned caret is laid out on the first paint and not when a
  later frame inserts it, so a moved caret vanished. The caret is now an
  inline zero-width span spliced into the run at its column, which also puts
  it after a heading's wider glyphs with no scale factor.

Checked on macOS, release build: a click lands the caret at the column under
the pointer, in body text and in a heading, and arrow keys move it.
README's "What it would take", item 1. Every row rendered was the slow
scrolling on macOS: Blitz restyled and repainted the whole document each
frame. Now `.leaf` is the scroll container, and only the rows in its viewport
plus 20 either side are rendered, between two spacers standing in for the
rest.

The spacers need heights for rows Blitz never laid out, so viewport.rs
estimates one: a line of the row's largest font, exact for every row the
corpus holds but a wrapped heading. A wrong estimate drifts the scrollbar's
thumb, never misplaces a drawn row.

`.leaf` and not the window scrolls because Blitz sends the root's scroll
event to the root element, which no component owns. After a key the caret's
row is scrolled into view — follow_caret in pixels, and only after a key, so a
reader can still scroll past a caret sitting still.

The Row component and its caret splicing move to row.rs.
The Swift editor's keyboard, the clipboard, save, and the mouse, each mostly a
line calling the Doc method Swift calls through leaf-ffi:

- input.rs: apps/leaf-editor's bindings — marks, headings (⌃0–6), lists,
  quotes, code blocks, tasks, indent, word and line deletes, block moves,
  table-aware Return/Tab, page motion, Emacs keys.
- host.rs: copy/cut/paste with the HTML flavor through arboard, plain
  paste, save. The file is opened with Doc::open, so ⌘S has a path.
- Pointer: double- and triple-click select the word and block, drag
  selects, a task box ticks without moving the caret, a click under the last
  row is click_past_end.
- A status line: file, unsaved dot, view, word count, core's status.

What took the time was Blitz, and README.md now has a table of it. The
editor reads keys from winit, because Blitz clears DOM focus on clicks and
keydown then goes to the root; matches ⌘ as SUPER; scrolls itself, because
MountedData::scroll from a handler panics on a borrowed document; and keeps
`overflow: hidden` and a fixed height off `.leaf`, because Blitz stops
repainting the one and culls the overflow of the other.

Doc::counts() is 130 ms at 5 200 rows, which stalled painting when asked per
keystroke; the count now waits for 400 ms without an edit.

LEAF_TRACE=1 logs keys, pointer events and repaint timings to stderr.

Checked on macOS, release build, on the corpus and on it repeated 200 times:
scroll, click, double-click, ⌘B, ⌘↓ following the caret to row 5 200.
Clipboard and save were not exercised from here.
…ditor

README's "What it would take", item 4, the way the Swift editor does it:
core builds one unwrapped row per block (build_visual_unwrapped), and the
frontend wraps and hit-tests it.

text.rs lays each row out with parley 0.12 — the engine and version Blitz
shapes with, over the same system fonts, in the same CSS family lists (Iowan
Old Style body, Menlo for code and tables) — breaking at the column's pixel
width. Each visual line renders as its own `white-space: pre` div, so Blitz
never wraps: parley's breaks are the truth. A click is Cursor::from_point on
its line → byte → display column → Doc::click. ↑/↓, Home/End and ⌘←/→ move
by visual line from the caret's x with a sticky goal x, since core's own
motion knows only its rows. List items hang under their text, a quote's
gutter repeats per line, code and tables stay monospace and unwrapped.

Layouts are cached by row handle, so a keystroke lays out the rows it
changed — a Return on the 200× corpus lays out 3 of 4 601; the full layout
is 70 ms, once and on a width change.

Two traps, both noted in place: parley gives empty text a few pixels of
width, which had indented every wrapped paragraph line; and Blitz paints
nothing while macOS reports the window occluded, so a capture of a covered
window looks like a hang. The README's claim that the 130 ms word count
stopped Blitz painting was that trap, and is corrected — the count's cost is
input lag, which the debounce still fixes. LEAF_TRACE logs occlusion now;
LEAF_OUTLINE=1 outlines lines and runs.

Checked on macOS, release build: a click lands between the letters under the
pointer on a wrapped line, ↑ keeps its x, End stops at the wrapped line's
end, ⇧↓ selects across the wrap; on the 200× corpus too.
winit reports the input method directly — Ime::Preedit with the marked text
and a cursor in it, then Ime::Commit — and on macOS that covers dead keys
too: ⌥E opens a composition of `´`, the E after it commits `é`. Blitz only
enables IME for its own <input>s and routes its IME event to the focused
node, so the editor allows IME on the window itself (with a cursor area) and
reads WindowEvent::Ime beside the keys.

ime.rs writes the marked text into the document as it is composed with
Doc::edit_composing, each step replacing the last one's provisional bytes,
and end_composition on commit, so a composition is one undo step — the
Swift editor's replaceRange model. A withdrawn composition ends its run on
the next key or click.

Moving core's caret, even to where it already is, ends the edit run, so
placing it at the IME cursor after each step split every step into its own
undo. The caret is drawn at the IME cursor instead, and core's is left where
edit_composing put it.

The parent crate's Marks gains a `composing` range beside the selection:
it touches its rows and classes their glyphs `ime`, which the editor
underlines. The caret's window rect is reported to the input method after
each repaint, for the candidate window.

Unit-tested; not yet exercised with a real input method in the app.
release.toml becomes ship.figl, and the five checks xtask's `ci` table ran
(versions, fmt, clippy, test, package-isolation) are its `job` list under
the same names, which a release runs before it cuts. The versions check is
`cargo xtask sync-versions --check`, and package isolation stays a
`cargo xtask package-isolation` task; the workspace tests that lived beside
it (every member isolated, the two bindings level) move with it.

ci.yml never ran `cargo xtask ci` and is unchanged.

Behavioural-change: cargo xtask ci is gone; run CI locally with ship ci.
The exact crate dioxus-native pins, copied from crates.io and wired in with
[patch.crates-io], so the next commit's changes to its text input client read
as a diff against upstream.
…cker

winit's NSTextInputClient answered nothing about the text around the caret
(selectedRange NSNotFound, attributedSubstring nil), ignored every
replacementRange, and reported insertText only when it ended a composition.
So press-and-hold could not see the letter it offers accents for and never
opened, and the emoji picker's insertion — no keystroke behind it — was
dropped.

The patch (patches/winit-appkit/PATCH.md; every change marked "leaf patch"):
keeps the surrounding text the app reports through winit-core's existing
ImeRequestData::with_surrounding_text and answers both queries from it;
turns a replacementRange into Ime::DeleteSurrounding before the commit or
preedit; reports insertText from outside keyDown as Ime::Commit; and drops a
key repeat the input system swallowed, which is press-and-hold holding the
key under its menu.

The editor asks for the surrounding-text capability, reports the caret's
source line (none while composing, since the preedit is in the document)
after every key, IME event and click, and handles DeleteSurrounding inside
the composition, so a chosen accent undoes back to the letter held.

Unit-tested on the editor side; the patched AppKit paths need a person at the
keyboard.
…ns the picker

Press-and-hold worked, but the key that picks an accent leaked: the menu
inserts its choice after keyDown: returns, so winit saw a key that reached
nothing and forwarded it as typing — and the accent's DeleteSurrounding then
took that digit instead of the letter (`e3eé`). The patch now remembers that
the menu is up once a repeat is swallowed, and swallows the keys that reach
nothing until it inserts; a key the input system passes on ends it.

⌃⌘Space is the key equivalent of Edit ▸ Emoji & Symbols, and this app has
no Edit menu, so the editor opens the Character Viewer itself
(NSApplication::orderFrontCharacterPalette). Its insertion already arrived,
as Ime::Commit.

Emoji still draw as nothing on the default vello-hybrid renderer: glifo can
decode Apple Color Emoji's sbix bitmaps only with its `png` feature, and with
it on, vello_gpu panics ("pixmap image sources are not supported by Vello
GPU"). Not fixed here.
Blitz's default vello-hybrid renderer cannot draw a bitmap glyph, and Apple
Color Emoji is all sbix PNGs: without glifo's `png` feature an emoji was laid
out and drawn as nothing, and with it vello_gpu panics ("pixmap image
sources are not supported by Vello GPU"). dioxus-native's defaults with
`vello` in place of `vello-hybrid` draw them.

Checked on macOS: emoji, a flag and a ZWJ family render inline with text.
… cluster

The patch marked the accent menu's insertion `Committed`, which tells
keyDown: the key it is handling belongs to the input method. But the menu
inserts after the key that picked from it has returned, so the flag sat
waiting for the next key, which vanished: the first letter typed after an
accent, or the ⌘Z meant to undo it — the "undo does nothing first" was that
⌘Z. Now `Committed` only when the insertion happens during a keypress.

The editor counted display columns per codepoint; core counts them per
grapheme cluster (leaf_core::text_width). A family emoji is five codepoints
and one 2-column character, which summed to 6 here, so a caret core placed
after it mapped to a byte inside it: the run split there, the halves were
shaped apart (👨👩□), and the caret looked to stop inside the emoji. Columns
are now unicode-width's string width, and a column always names a cluster
boundary.
LEAF_TRACE=1 now logs, from inside winit's macOS text input client, what each
keyDown did (IME state, whether the input system touched it, whether the
accent menu was up, whether it was forwarded) and what each insertText was
taken as — the layer the editor's own trace cannot see.
⌘E: one row per source line from core's SourceMap, so delimiters dim and a
fence keeps its syntax colours. Core's click, motion and caret already work
in source rows and columns, so source.rs only builds RowViews and the rest of
the editor draws them as it draws rendered rows — in Menlo, wrapped, every
run at body size (text.rs gains a Kind: Prose, Cells, Source). With no
VisualMap for Frame to diff, a source row is reused by content, so a Return
relays out one line. The column widens to 82 cells in the source view.

⌘F / ⌥⌘F / ⌘G / ⇧⌘G: find.rs — incremental, ASCII-case-insensitive,
wrapping, a match count, the match as the selection in either view; Replace
and Replace All, the latter one undo group. The fields are the editor's own,
fed by the same winit key path, not Blitz <input>s, which need DOM focus.
The bar sits above the text and pushes it down.

Also: ⌥ chords now match by physical key, since ⌥ changes the character a
Mac key types — ⌥⌘C (code block) never matched before; and the layout cache
keeps each row's handle alive, since a freed Rc's address can be reused.

Checked on macOS: ⌘E both ways; "row" found 1 of 5, ⌘G to 2 of 5 across a
switch of view; Replace All of 5 and one ⌘Z restoring them.
menu.rs builds the menu bar with muda — app menu, File, Edit, Format, View,
Window — as the Swift editor lays it out. Each editor item is one of
input.rs's key bindings, given as its chord: shown as the item's shortcut,
replayed through the same key handler when chosen. macOS hands a shortcut
that names an item to the menu before the view, so the chord arrives once,
through the menu; nothing is defined twice, and the find bar still gets ⌘V.
AppKit fills the menu titled Edit with Emoji & Symbols and Start Dictation.

file.rs: New, Open, Save As and the unsaved-changes question, as rfd's async
dialogs — window sheets with completion handlers, since a modal's nested
event loop inside a Dioxus task would hit Blitz's borrowed document. ⌘S on an
untitled document is Save As. The window title is the file's name, with
"— Edited" while it is unsaved.

An empty document maps to no rows, which left the caret nowhere: it gets the
one empty line a text view shows.

Checked on macOS: the menus; View ▸ Source View and Format ▸ Heading 2 from
the menu; ⌘E arriving once; the Save As sheet; New on an edited document
asking, Don't Save, and the empty untitled document. Closing the window
with unsaved changes still quits without asking.
Core spells a table twice: the map's box-drawn monospace picture, and
TableInfo — each cell's glyphs with source offsets and styles, its range and
alignment, the head rows. table.rs draws from the second, as leaf-gpui and
leaf-swift do. Columns fit their widest cell and are squeezed only when the
grid will not fit, cells wrapping into what is left. Each cell is a RowView
laid out by text.rs at its column's width and aligned there (text.rs gains
layout_aligned and a row's natural width), so cells wrap, draw the caret and
selection, and hit-test as text: a click resolves to the glyph under it and
its source offset. Lines now carry a Target — a row, or a cell — and an
origin for their x.

The picture rows stay in the row list at zero height, so indices still match
core's map; the first draws the grid. A table whose view and width are
unchanged keeps its layout. ↑/↓ in a table are core's cell_move_vertical.
A quote's gutter is drawn on every grid row, with the table's top border and
head shading on its cells so they start where the grid does.

Checked on macOS: left and right alignment, a wrapping cell, a shaded bold
head, a table in a quote; clicking into a word in a cell, typing, ↓ into the
cell below, and the saved source.
adammharris and others added 26 commits October 29, 2026 21:32
build(deps): take the Blitz fork's ce3cc6b2, with its anyrender_svg
…d in the view

`Area::column` is how wide the reflowed page is set, centred in the area.
The view still spans the whole area, so its scroll bar stays at the area's
right edge rather than the column's, and a wheel or a press either side of
the page is the view's. `None` is the area's own width, as before.

Behavioural-change: `Area` has a new public field, `column`; a host that
builds one with a struct literal must name it (`None` keeps the old layout).
…ds them to the same pages

print.rs: on_paper and job, which the page view (Pages::update) and a host's
Export as PDF both ask, so a host cannot set the PDF in one size, paper or
supply and the page view in another. Pages::print for a host with a page
view; Leaf's own Export as PDF and Print now set through it.

parity.rs: ten documents (headings, inline marks, lists, quotes, rules,
fences, tables, alignment, emoji, a long one over three pages, front matter,
a small picture and one larger than the views draw) set both ways, the page
view's pieces painted where view.rs places them (resvg, from the usvg tree
Blitz reads) and the PDF rasterised (hayro), compared pixel by pixel at two
pixels a point. A second test checks the comparison catches a size change
and a room the screen did not leave.
… at its own size

leaf_dioxus::Host::print_directive: the card under a directive as it prints, a
picture's file, since no markup draws on paper. print::job asks for it for every
directive that has a room and hands it to twig-export's Hooks::room_drawing
(Supply::drawings), so the PDF shows the card the page view shows, in the same
room. Leaf's typesetter process carries the drawings too.

Choices::paper_size: the body size the page view and its PDF set paper at, where
it is not the reflowed view's (a phone reads reflowed text larger than a page
prints). None keeps paper at size, as Leaf's own app does.

Needs twig-export's Hooks::room_drawing (diaryx-org/twig-export#12); the lock
moves to it once that merges.
A room inside a quote or a list is narrower than the text, so the host
now draws its card at the room's own width, measured from the layout,
not the page's. The parity test reads blended edge pixels (a picture set
at a fraction of a pixel) as the two rasterisers' smoothing, and each
call gets its own folder of pictures.
The page view sets each empty table cell with a stand-in, as it does the
caret's empty line, but moved the host's rooms past the caret's alone. A
card after such a table was asked for at bytes it no longer had, and the
page view drew neither its room nor the card, though the PDF did. Rooms
and drawings now move past every stand-in before them.
feat(pages): one place sets the page view and its PDF, with a test that holds them to the same pages
parley reads a box that opens a layout as wrappable, whatever white-space
says, so a quoted line that overflowed by less than its trailing space
was broken after its bar and drawn two lines tall. A line's leading bars
now stand in a box of their own beside the box that holds its text.

Every line is a flex line, quoted or not: Blitz panics on a node whose
display changes, and a line gains a bar when a `>` is typed.

Behavioural-change: every leaf-dioxus `.line` is now a flex container holding `.bars` and `.flow`, so a host's CSS over `.line`'s children needs to look inside `.flow`.
Behavioural-change: off a Mac's keys, Ctrl+Y in the leaf-dioxus editor now redoes; it was ignored.
…indows-do-not-do-yet

fix(dioxus): Ctrl+Y redoes off a Mac's keys
…aks-a-line-blitz-was-told-not-to-wrap

fix(dioxus): a quote's bars stand beside its line's text, not in it
A composition went through edit_composing, a raw splice, so an armed Bold
never took the word and, where typing is literal, a composed `*` opened a
mark. Doc::insert_composing is the composing form of insert: each step puts
the document back as the composition found it, caret and armed marks
included, and types the text there, folded into the composition's one undo
step. Composer composes through it.

insert with an armed mark also left the caret between the closing delimiters
when the text ended in whitespace; it now stands past that whitespace.

Behavioural-change: in the leaf-dioxus editor, a composition now takes an armed mark and, where typing is literal, is escaped as typing is; a withdrawn composition leaves the mark armed.
Behavioural-change: Doc::insert with an armed mark and text ending in whitespace leaves the caret past that whitespace, not inside the closing delimiters.
…undo

fix(core): a composition writes what typing writes
…trace

`std::time::Instant::now` panics on wasm32-unknown-unknown, and
`Editor::key_taken` called it on every key, so the first key pressed in a
browser ended the page. Found in Diaryx's browser build.
fix(dioxus): read the time through `clock` on a key press and in the trace
…itor and flower-data-tui

flower is about to hold leaf's document editor too, under flower's name, so
the crates that edit a config file say which half they are: flower-core is
flower-data, flower-dioxus is flower-data-editor, and the ratatui terminal
app is apps/flower-data-tui (its binary is still `flower`). flower-ratatui
and flower-ffi keep their names.

Behavioural-change: the crate `flower-core` is `flower-data` (`flower_data` in code) and `flower-dioxus` is `flower-data-editor` (`flower_data_editor`); a manifest or a `use` naming the old ones no longer resolves.
leaf and flower become one project, named flower and mostly leaf's code.
This takes leaf's main (dc2e9b0) whole, as an unrelated history, so both
logs and blame survive. Where the two repositories had a file at the same
path (the root manifest and lockfile, README, changelog, task index, ship
and CI configuration, xtask, vocab, www), this commit takes leaf's; flower's
is in the first parent, and the commits after this one fold it back in. The
prov workspace stays flower's: its config and registry are flower's own.

Nothing is renamed here and the root workspace does not yet name flower's
crates.
…ce with the data editor

The document editor that was leaf is flower's now:

  leaf-core        flower-doc           leaf-dioxus      flower-doc-editor
  leaf-pages       flower-pages         leaf-math        flower-math
  leaf-math-edit   flower-math-edit     leaf-mermaid     flower-mermaid
  leaf-raster      flower-raster        leaf-session     flower-session
  apps/leaf-dioxus      apps/flower      (package flower-app, binary Flower)
  apps/leaf-dioxus-tui  apps/flower-tui  (binary flower-dtui)
  apps/leaf-dioxus-web  apps/flower-web

No crate says `dioxus`: Dioxus is what flower is drawn with. The root
manifest is leaf's with the data editor's dependencies added, so
flower-data, flower-data-editor, flower-ratatui, flower-ffi and
flower-data-tui are members of the one workspace, on the one lockfile and
the Blitz fork's patches; flower-data-editor is no longer a workspace of its
own. The workspace version is flower's, 0.6.4.

What keeps leaf's name: the app's icon (leaf.icon), the editor's CSS class
and custom properties (`.leaf`, `--leaf-*`), which a host's stylesheet
names and which `.flower` already means in the data editor, the Blitz
fork's `leaf` branch, and everything under archive/.

Behavioural-change: every leaf crate has a flower name (`leaf_core` is `flower_doc`, `leaf_dioxus` is `flower_doc_editor`, `leaf_pages` is `flower_pages`, and so on), and they are in the flower repository; a dependency on `https://github.com/diaryx-org/leaf` gets none of this.
Behavioural-change: the app is Flower (`org.diaryx.flower`), so it reads none of what Leaf kept under `org.diaryx.leaf`: its settings, saved window frames, installed templates (`Application Support/Leaf`, `<config>/leaf`) and panic log.
Behavioural-change: the environment variables the editor and the app read are `FLOWER_TRACE`, `FLOWER_OUTLINE`, `FLOWER_DRIVE`, `FLOWER_THEME`, `FLOWER_BUNDLE_ID` and `FLOWER_DTUI_LOG`, not `LEAF_*`.
Behavioural-change: flower-data and flower-ratatui no longer declare `rust-version = "1.88"`; the workspace builds with the org's pinned toolchain, as leaf's did.
… document's

One app for both halves. A file's extension says which editor its window
holds: Markdown, Djot and HTML under flower-doc-editor's caret, as before;
JSON, YAML, TOML, ZON and figl as a tree, under flower-data-editor
(`apps/flower/src/data.rs`), with its bar's Fit/Pages/Roomy/Flat, Undo, Redo
and Delete. The file is the platform document's either way: on the Mac an
NSDocument, which now declares the data types and refuses text that does not
parse; elsewhere the app's own, which writes beside the file and renames
over. Save, Save As, Close, the zoom and Undo and Redo reach a data window
from the menus and their keys; a document's commands are off there.

The app the data editor had to itself, apps/flower-dioxus, goes: one window,
its own menu bar through muda, and the sandbox. ship's configuration is the
two repositories' together: leaf's jobs with the Swift binding check, and a
tag starts the Mac app, the `flower` formula and the web build. The cask is
`flower-editor`.

The Mac's half is type-checked and linted for aarch64-apple-darwin and has
not been run on a Mac.

Behavioural-change: Flower.app is the document app: a window per file, autosave and Versions through NSDocument, and no sandbox, where the data editor's app had one window and ran sandboxed (its container, `~/Library/Containers/org.diaryx.flower`, is no longer what it reads).
Behavioural-change: CI no longer has the `Dioxus widget and app` and `MSRV` jobs; `Web host` is new, and Clippy, Test and Package isolation now build the Dioxus crates.
…here it has some

A document's views draw none of its frontmatter, and its source view draws
it as text. View ▸ Frontmatter, and a toolbar button beside Source that is
there only for a document with frontmatter, put flower-data-editor over the
document's area on the YAML (or TOML) between the fences: fields, switches,
chips for a short list, as a data file's window has them.

The frontmatter stays the document's text. Each edit is written back
between the fences as one edit to the document, so the title shows it
unsaved and Save writes it; while the view is shown the keys, Undo and Redo
are the structural editor's, and afterwards its edits are steps in the
document's history. Frontmatter that does not parse is not shown, and the
status line says why.
The README introduces the one project: what it opens, that it was leaf and
flower, the crates and apps of both halves, and how a release reaches the
tap and the browser. flower's README as it was is the guide to the data
half, beside its model (crates/flower-data/README.md). The changelog is
flower's, since the tags here are; leaf's, to its 0.5.1, is kept whole as
docs/CHANGELOG-leaf.md. The task indexes list both repositories' tasks, the
workspace's root and site page keep flower's ids, and `prov check` is clean.

Three tasks for what this leaves: the terminal and the browser open one half
each, the Mac app's data windows have not been run on a Mac, and the next
generated changelog would list leaf's whole history.
One checksum moved; `scripts/gen-bindings.sh --check` passes again.
A corgi.toml, with unit's and diaryx's libraries and Python to the hash, so
Blitz, Stylo and wgpu are built once for the three of them and a new
worktree here builds from the machine's store, not into a target/ of its
own: the cargo target this work grew was 10 GB, and the gate under corgi
leaves none. scripts/cargo.sh is unit's: corgi where it is installed, cargo
where it is not, as on GitHub's runners; the lanes in .config/ship.figl and
`cargo xtask package-isolation` go through it. The browser's lint has two
feature roots, since corgi otherwise resolves the workspace as one.

What corgi asked of the code: no binary names its checkout, so the app, the
terminal editor's tests and the xtask read their package's directory at run
time; the files a compile or a test reads beyond its `.rs` are declared; and
the vendored wgpu-hal allows one clippy lint newer than it, because corgi
lints a path dependency with the workspace's flags.

AGENTS.md is new: the gate, corgi, and that the Mac's half is type-checked
from Linux.
…desktop entry

`scripts/install-linux.sh` builds Flower (through scripts/cargo.sh, so under
corgi where it is installed) and installs it for the user: the binary and
the sample beside it under ~/.local/share/flower, `flower-app` on PATH, the
leaf as `org.diaryx.flower.svg`, and a desktop entry that offers Flower for
Markdown, JSON, YAML and TOML files. `--release` and `--no-build` are its
flags, and `PREFIX` moves it.

Every window now carries the app's id on Linux, a Wayland app id or an X11
class of `org.diaryx.flower`, which is what the desktop entry is named for:
without it a dock or a switcher has no icon for the window.
…ares Djot's and figl's types

`scripts/install-linux.sh --default` makes Flower the user's default for
Markdown, Djot, JSON, YAML, TOML and figl, through `xdg-mime default`. It is
a flag because it changes what the user's other files open in; without it
the desktop entry only offers Flower in Open With.

shared-mime-info has no type for Djot or figl, so a `.dj` or a `.figl` was
plain text and opened in whatever opens that. The script installs a package
declaring `text/x-djot` (`*.dj`, `*.djot`) and `application/x-figl`
(`*.figl`), and the desktop entry lists both.
@adammharris adammharris reopened this Nov 11, 2026
@adammharris
adammharris merged commit 14437f6 into main Nov 11, 2026
@adammharris
adammharris deleted the merge-leaf branch November 11, 2026 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant