Skip to content

feat(dioxus): flower's page editor on Dioxus's native renderer - #2

Merged
adammharris merged 2 commits into
mainfrom
cc/optimistic-bardeen-4l74x4
Oct 16, 2026
Merged

adammharris merged 2 commits into
mainfrom
cc/optimistic-bardeen-4l74x4

Conversation

@adammharris

Copy link
Copy Markdown
Member

Flower on dioxus-native 0.8.0-alpha.2 (Blitz on wgpu, no webview), split into a widget and an app the way leaf's Dioxus editor is.

crates/flower-dioxus: the widget

  • It draws the same page view as flower-ratatui and the Swift FlowerPages:
    • one or two panes along the lineage (the parent page and the current one, or the current one and a preview of what it would open)
    • groups under captions and short lists as chips
    • names in one column and values in another, with comments shown
    • markers for findings the host passes in
    • the picker as an overlay, and the footer as the edit line
  • Keys: the terminal's table (j/k/l/h, e/E, a/A, c/C, x, u/U), plus ⌘Z/⇧⌘Z, ⌫/⌦/⌘⌫ and ⌥↑/⌥↓ for moving an entry.
  • Mouse: a press selects a row and a second press opens it. A press in the left pane backs out onto that row; a press in the preview opens it. The wheel moves the cursor.
  • Host: Save, Save As, zoom and the clipboard are requests to a Host, so the widget never touches a file, same as flower-core.
  • Code layout: layout.rs (panes, entries, placement, line text) uses no Dioxus types, so it is unit-tested without a window. Keys are read from winit, not DOM focus; leaf-dioxus documents why.

apps/flower-dioxus: the app

  • Opens the file named on the command line, or the sample when there isn't one.
  • ⌘S / ⇧⌘S save with rfd sheets, ⌘O opens with an unsaved-changes prompt.
  • Zoom, ⌘V from the system clipboard, and the window title shows "— Edited" for unsaved changes.

Workspace

Both crates are standalone workspaces and are excluded from the root one. The alpha pins a winit beta and a wgpu tree that the root shouldn't resolve. Their lockfiles are committed, as leaf's are.

Verification

  • fmt, clippy -D warnings and tests pass for both crates: 20 widget tests and 2 app tests. Root cargo fmt --all --check and the xtask tests still pass.
  • I ran the app on Linux under Xvfb with Mesa's software Vulkan driver and drove it with xdotool. These all worked:
    • the inlined single page and the two-pane split, including after a resize
    • Return to open a page and clicking in either pane
    • editing, appending, deleting and ⌘Z
    • ⌘S: the saved file differed only in the edited line
  • Running it this way found one real bug, a RefCell double borrow on open. It is fixed.
  • Not tried: macOS, a real GPU, or dark mode.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LXrGKAEfBBD8Kg3GR3M7Ej


Generated by Claude Code

crates/flower-dioxus is the page view of flower-ratatui and the Swift
FlowerPages, drawn by dioxus-native 0.8.0-alpha.2 (Blitz on wgpu, no
webview): one or two panes along the lineage, groups under captions,
short lists as chips, the picker over the page and the footer as the
edit line. The terminal's key table, plus a window's ⌘Z/⇧⌘Z, ⌫/⌦ and
⌥↑/⌥↓; presses and the wheel as the terminal's mouse. Save, Save As,
the zoom and the clipboard are asked of a Host, so the widget, like
flower-core, never touches a file.

apps/flower-dioxus hosts it in a window: open, save, save as, the
unsaved-changes question, the zoom and the window title.

Both are workspaces of their own, excluded from the root one, for the
reason leaf's crates/leaf-dioxus is: the alpha pins a winit beta and a
wgpu tree nothing in the root workspace should resolve.
apps/flower-dioxus/src/menu.rs builds Flower, File, Edit, Go, View and
Window through muda, the native NSMenu on macOS. Every item is a key
chord replayed through the same handler as the keyboard (Shell::chord:
the editor's table, then the shell's ⌘O), so the menu cannot disagree
with the keys; a test replays every item's chord against a model.

A chord with ⌘ or ⌥ is its item's shortcut; the editor's single
letters are not, since AppKit hands a shortcut to the menu before the
view and Edit Value would take every `e` typed into a value. Items are
enabled for what the editor is doing: the page's commands off while a
value is open (replayed then, `e` would be typed), Paste only then,
Undo and Redo by the journal.

The widget gains the Finder's ⌘↓ and ⌘↑ (Go ▸ Open, Enclosing Page),
and its doc no longer claims a bare ⌫ deletes. muda is built without
GTK, so the menu compiles and is tested on Linux, where none is shown.
@adammharris
adammharris force-pushed the cc/optimistic-bardeen-4l74x4 branch from 1486f3d to 9664f91 Compare October 16, 2026 17:21
@adammharris
adammharris merged commit 7868e03 into main Oct 16, 2026
8 checks passed
@adammharris
adammharris deleted the cc/optimistic-bardeen-4l74x4 branch October 16, 2026 17:23
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