Text chat 7: fluxer-platform files, dialogs, clipboard; SVG and thumbhash images #257

Closed
opened 2026-11-12 11:07:36 +00:00 by charles · 0 comments
Owner

Plan: docs/superpowers/plans/2026-11-12-textchat.md, section "Task 7". Spec: docs/superpowers/specs/2026-11-12-fluxer-native-textchat-design.md.

Task 7: fluxer-platform files, dialogs, clipboard; SVG and thumbhash images

Serialised across two crates (fluxer-platform, then the matching type in fluxer-ui::images) because the image loader's result type lives in the UI.

Issue: #TBD

Files:

  • Create: crates/fluxer-platform/src/{dialogs.rs,clipboard.rs,upload_files.rs,thumbhash.rs}, crates/fluxer-platform/tests/{upload_files.rs,thumbhash.rs,desktop_real.rs}
  • Modify: crates/fluxer-platform/{Cargo.toml,README.md,src/lib.rs,src/images.rs}, crates/fluxer-ui/src/{files.rs,images.rs}, CLAUDE.md (crate rules: dialogs and clipboard images as a sanctioned injected trait, worded like ImageLoader), workspace Cargo.toml (rfd with xdg-portal + tokio, arboard with wayland-data-control, thumbhash), deny.toml if needed
  • Test: as above; desktop_real.rs only with FLUXER_DESKTOP_TESTS=1

Interfaces:

  • Produces (ui traits): fluxer_ui::files::{Dialogs (fn pick_files(&self, multiple: bool) -> BoxFuture<Vec<PickedFile>>; fn save_file(&self, suggested: String) -> BoxFuture<Option<PathBuf>>), ClipboardImages (fn read_image(&self) -> BoxFuture<Option<PngBytes>>; fn write_image(&self, png: Vec<u8>) -> BoxFuture<Result<(), FileError>>), PickedFile { path, name, size, content_type }}; images::LoadedImage::Svg(Arc<[u8]>) (drawn with iced svg::Handle::from_memory), images::placeholder_from_thumbhash(&str) -> Option<RgbaImage>.

  • Produces (platform): dialogs::RfdDialogs: Dialogs; clipboard::ArboardClipboard: ClipboardImages (PNG in/out); upload_files::open(path) -> Result<(u64 size, String content_type, impl Stream<Item = io::Result<Bytes>>), FileError> (1 MiB chunks, content type from the extension then magic bytes); ImageCache returns LoadedImage::Svg for image/svg+xml; thumbhash::decode(base64) -> Option<RgbaImage>.

  • Checks and records in the README: whether winit delivers FileDropped on Wayland and on X11/Windows (manual, FLUXER_DESKTOP_TESTS=1); cargo deny result of rfd/arboard.

  • The soundboard upload dialog gets a "Browse…" button using Dialogs::pick_files (path field stays).

  • Step 1: Write failing tests: upload_stream_reads_in_1mib_chunks_and_reports_size, content_type_by_extension_then_magic, missing_file_is_error_not_panic, thumbhash_decodes_reference (reference value from the thumbhash test vectors), svg_response_becomes_svg_variant; real pick_and_paste_round_trip (FLUXER_DESKTOP_TESTS=1).

  • Step 2–5: FAIL → implement → PASS → commit feat(platform): file dialogs, clipboard images, upload streams, SVG and thumbhash.

🤖 Generated with Claude Code

Plan: `docs/superpowers/plans/2026-11-12-textchat.md`, section "Task 7". Spec: `docs/superpowers/specs/2026-11-12-fluxer-native-textchat-design.md`. ### Task 7: `fluxer-platform` files, dialogs, clipboard; SVG and thumbhash images Serialised across two crates (`fluxer-platform`, then the matching type in `fluxer-ui::images`) because the image loader's result type lives in the UI. **Issue:** #TBD **Files:** - Create: `crates/fluxer-platform/src/{dialogs.rs,clipboard.rs,upload_files.rs,thumbhash.rs}`, `crates/fluxer-platform/tests/{upload_files.rs,thumbhash.rs,desktop_real.rs}` - Modify: `crates/fluxer-platform/{Cargo.toml,README.md,src/lib.rs,src/images.rs}`, `crates/fluxer-ui/src/{files.rs,images.rs}`, `CLAUDE.md` (crate rules: dialogs and clipboard images as a sanctioned injected trait, worded like `ImageLoader`), workspace `Cargo.toml` (`rfd` with `xdg-portal` + `tokio`, `arboard` with `wayland-data-control`, `thumbhash`), `deny.toml` if needed - Test: as above; `desktop_real.rs` only with `FLUXER_DESKTOP_TESTS=1` **Interfaces:** - Produces (ui traits): `fluxer_ui::files::{Dialogs (fn pick_files(&self, multiple: bool) -> BoxFuture<Vec<PickedFile>>; fn save_file(&self, suggested: String) -> BoxFuture<Option<PathBuf>>), ClipboardImages (fn read_image(&self) -> BoxFuture<Option<PngBytes>>; fn write_image(&self, png: Vec<u8>) -> BoxFuture<Result<(), FileError>>), PickedFile { path, name, size, content_type }}`; `images::LoadedImage::Svg(Arc<[u8]>)` (drawn with iced `svg::Handle::from_memory`), `images::placeholder_from_thumbhash(&str) -> Option<RgbaImage>`. - Produces (platform): `dialogs::RfdDialogs: Dialogs`; `clipboard::ArboardClipboard: ClipboardImages` (PNG in/out); `upload_files::open(path) -> Result<(u64 size, String content_type, impl Stream<Item = io::Result<Bytes>>), FileError>` (1 MiB chunks, content type from the extension then magic bytes); `ImageCache` returns `LoadedImage::Svg` for `image/svg+xml`; `thumbhash::decode(base64) -> Option<RgbaImage>`. - Checks and records in the README: whether winit delivers `FileDropped` on Wayland and on X11/Windows (manual, `FLUXER_DESKTOP_TESTS=1`); `cargo deny` result of `rfd`/`arboard`. - The soundboard upload dialog gets a "Browse…" button using `Dialogs::pick_files` (path field stays). - [ ] **Step 1: Write failing tests**: `upload_stream_reads_in_1mib_chunks_and_reports_size`, `content_type_by_extension_then_magic`, `missing_file_is_error_not_panic`, `thumbhash_decodes_reference` (reference value from the thumbhash test vectors), `svg_response_becomes_svg_variant`; real `pick_and_paste_round_trip` (`FLUXER_DESKTOP_TESTS=1`). - [ ] **Step 2–5:** FAIL → implement → PASS → commit `feat(platform): file dialogs, clipboard images, upload streams, SVG and thumbhash`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
charles added this to the Text chat milestone 2026-11-12 11:07:36 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/fluxer-native#257
No description provided.