+
+
+ FireCraft shell architecture review
+ 2026-11-23 · 25 944 LOC across 22 modules in `crates/app/src/shell/`
+
+ module
+ seam
+ leakage
+ deep module
+
+
+- Candidate deepening opportunities
+
+
+
+
+
Collapse the Shell dispatch monolith
+
+
+ Strong
+ in-process
+
+
+ shell/mod.rs (7 820 LOC, 240 functions, ~3 000 LOC tests)
+
+
+
+
+
Before
+
+
+flowchart LR
+ menus["menus::Action"]
+ toolstrip["toolstrip"]
+ shell["shell::Shell\n7 820 LOC\n240 functions"]
+ editor["editor::Editor"]
+ engine["engine\ncmd::Command"]
+ menus -.-> shell
+ toolstrip -.-> shell
+ shell --> editor
+ shell --> engine
+
+
+
+
+
+
After
+
+
+flowchart LR
+ menus["menus::Action"]
+ toolstrip["toolstrip"]
+ dispatch["shell::dispatch\n500 LOC"]
+ shell["shell::Shell\n4 500 LOC"]
+ editor["editor::Editor"]
+ engine["engine\ncmd::Command"]
+ dispatch --> shell
+ dispatch --> engine
+ menus -.-> dispatch
+ toolstrip -.-> shell
+
+
+
+
+ The Shell module carries every menu action, every keyboard shortcut, every panel toggle, every selection operation, and every export/import path in one impl block. run_action is a match arm with 10 variants; run_sel has 40+; run_shell has 50+. The interface surface is wide: 8 public methods, 7 pub(super) methods, 20 stubs for #[cfg(not(feature = "native"))], and 10 dialog state fields that duplicate in Shell what each Dialog struct already carries.
+ The test module (lines 3084–7569) is itself 4 485 LOC — more than half the module — and every test reaches through gui_shell() to seed a full editor + dialog stub + memory filesystem. Testing a single shortcut requires instantiating the entire shell.
+ Extract a command dispatch module. Move run_action, run_document, run_shell, run_sel, run_arrange into a separate shell/dispatch.rs with one public interface: impl Shell { fn dispatch(&mut self, action: &Action) }. The dispatch module owns the match arms; the shell struct owns only state.
+
+ - Interface shrinks; implementation absorbs the wrappers
+ - Tests hit one dispatch interface
+ - Locality: shortcut logic concentrates in one module
+ - Delete 20 stub functions from the non-native shim
+
+
+
+
+
+
Collapse the Panels / panels_web seam
+
+
+ Strong
+ in-process
+
+
+ panels.rs (5 276 LOC) + panels_web.rs (1 730 LOC)
+
+
+
+
Before
+
+
+flowchart LR
+ mod["shell/mod.rs"]
+ panels["panels.rs\n5 276 LOC\nProperties, Pages,\nStates, Layers,\nHistory, Styles,\nColor Mixer, Library"]
+ panelsweb["panels_web.rs\n1 730 LOC\nAuto Shapes, URL,\nBehaviors, Slices"]
+ sliceeditor["slice_editor.rs\n738 LOC\nBehavior/action\nmapping"]
+ mod -.-> panels
+ mod -.-> panelsweb
+ panelsweb --> sliceeditor
+
+
+
+
+
After
+
+
+flowchart LR
+ mod["shell/mod.rs"]
+ panels["panels.rs\n7 000 LOC\nall right-dock\npanels"]
+ sliceeditor["slice_editor.rs\n738 LOC"]
+ mod -.-> panels
+ panels --> sliceeditor
+
+
+
+
+ Understanding the right-hand dock requires bouncing between panels.rs (5 276 LOC: Properties, Pages, States, Layers, History, Styles, Color Mixer, Library) and panels_web.rs (1 730 LOC: Auto Shapes, URL, Behaviors, Slices). The web panels reference slice_editor for their behavior/action mapping, creating a three-module seam. The split is platform-based, not responsibility-based: panels.rs owns desktop panels and panels_web.rs owns web panels, but both are egui-drawing modules with zero runtime variation between native and wasm builds.
+ Consolidate panels.rs + panels_web.rs into one module. Remove the platform split: all panel content lives in panels.rs. The cfg(feature = "native") gates on these modules exist because web panels reference desktop-only types — move those types instead of gating the panel module.
+
+ - One module to understand instead of two
+ - Interface: single impl Shell block for all panels
+ - Locality: Behaviors panel + slice_editor mapping in one read
+ - Web panels and desktop panels are identical in this build
+
+
+
+
+
+
Deepen the Canvas UI module
+
+
+ Worth exploring
+ in-process
+
+
+ canvas_ui.rs (1 860 LOC)
+
+
+
+
Before
+
+
+flowchart LR
+ mod["shell/mod.rs\nShell::ui()"]
+ canvas["canvas_ui.rs\n1 860 LOC\nall impl Shell"]
+ toolstrip["toolstrip"]
+ icons["icons"]
+ compose["compose"]
+ mod --> canvas
+ canvas --> toolstrip
+ canvas --> icons
+ canvas --> compose
+
+
+
+
+
After
+
+
+flowchart LR
+ mod["shell/mod.rs"]
+ canvas["canvas_ui.rs\n2 200 LOC\none interface"]
+ toolstrip["toolstrip"]
+ icons["icons"]
+ compose["compose"]
+ mod --> canvas
+ canvas --> toolstrip
+ canvas --> icons
+ canvas --> compose
+
+
+
+
+ The canvas module is pure egui drawing glue — tools_panel, tool_button, autoshape_button, panel_button, colors_boxes, tool_flyout_ui, context_rows, context_menu, canvas itself — all impl Shell. The module's interface is as wide as its implementation: every method is a Shell method. The context_rows function alone has a 200-line match arm covering 8 SelectionClass variants. The cs6_color_button in panels.rs is 300 lines of hand-rolled picker with its own popup state, swatch grid, HEX editor, RGB sliders, and opacity control.
+ Extract canvas-local helpers as private functions. context_rows, transform_handle_at, object_class, transform_handle_points are pure functions with no Shell state. Move them to a canvas_ui/helpers.rs submodule. The cs6_color_button and slider_row helpers in panels.rs are similarly pure — they read ui, write color, return changed.
+
+ - Pure functions extracted for testability; bugs hide in call ordering
+ - One interface; many call sites with different Shell state
+ - Levers: one interface, N call sites — the real complexity
+
+
+
+
+
+
Collapse the Dialogs / file_operations seam
+
+
+ Worth exploring
+ ports & adapters
+
+
+ dialogs.rs (1 630 LOC) + file_operations.rs (463 LOC)
+
+
+
+
Before
+
+
+flowchart LR
+ mod["shell/mod.rs"]
+ dialogs["dialogs.rs\n1 630 LOC\nDialog types,\nExportDialog,\nEnvDialogs\nplatform trait\nopen_path,\nsave_path"]
+ fileops["file_operations.rs\n463 LOC\nopen_document,\nsave_document,\nimport_raster,\nrun_script_file"]
+ mod -.-> dialogs
+ mod -.-> fileops
+ fileops -.leak.-> dialogs
+
+
+
+
+
After
+
+
+flowchart LR
+ mod["shell/mod.rs"]
+ iofiles["io_files.rs\n2 100 LOC\nall file/dialog\nops"]
+ mod -.-> iofiles
+
+
+
+
+ file_operations.rs opens and saves documents, runs scripts, imports raster files — all gated behind cfg(feature = "native"). It calls self.dialogs.open_path() and self.fs.read_file() from the injected platform traits. dialogs.rs defines the dialog types (NumericTransformDialog, FeatherDialog, CanvasSizeDialog, CanvasColorDialog, ImageSizeDialog, ExportDialog) and implements the EnvDialogs adapter over engine::platform::Dialogs.
+ The seam between dialogs and file_operations is real: every file operation asks the dialog for a path. But the interface of dialogs.rs is nearly as complex as its implementation: it carries the full export format pipeline (12 formats, M11 web workflows) and 6 dialog structs with their default values, plus the EnvDialogs platform adapter.
+ Merge dialogs.rs into file_operations.rs. The dialog type definitions and the file operation functions belong to the same responsibility: the file I/O seam. Move dialog types and EnvDialogs into file_operations.rs. Keep the engine::platform::Dialogs trait as the external adapter; the rest concentrates the file I/O seam.
+
+ - File I/O seam concentrates in one module
+ - Delete one shallow module; depth moves to file_operations
+ - One adapter (EnvDialogs) now alongside its use site
+
+
+
+
+
+
Deepen the Panel Windows module
+
+
+ Speculative
+ in-process
+
+
+ panel_windows.rs (1 146 LOC)
+
+
+
+
Before
+
+
+flowchart LR
+ mod["shell/mod.rs"]
+ pw["panel_windows.rs\n1 146 LOC\nPanelSpec enum\nDOCK_CONTENT_WIDTH\nPANELS const\ndock / left_dock\nfinish_panel_drag\ngroup_panels\nmove_panel_to_dock"]
+ panels["panels.rs\n5 276 LOC"]
+ mod --> pw
+ mod --> panels
+
+
+
+
+
After
+
+
+flowchart LR
+ mod["shell/mod.rs"]
+ panels["panels.rs\n6 200 LOC\n+ panel dock\nlogic from\npanel_windows"]
+ pw["panel_windows.rs\n100 LOC\nPanelSpec\nPANELS const\nonly"]
+
+
+
+
+ panel_windows.rs owns the right-dock layout: the PANELS const, PanelSpec, PanelKind, DOCK_CONTENT_WIDTH, the Shell::dock() method, drag-and-drop between docks, panel grouping, and the PanelGroupLayout persistence. It's 1 146 LOC for what is essentially a panel inventory (12 panels) and a stack layout.
+ Move panel dock logic into panels.rs; leave panel_windows.rs as a data module. The dock layout logic (1 146 LOC minus ~100 LOC of PANELS const and PanelKind enum) belongs with the panel content in panels.rs. Keep panel_windows.rs as a data-only module with PANELS and PanelKind.
+
+ - Interface shrinks to data-only
+ - Panel dock logic and content in one module
+ - Delete shallow wrapper; depth moves to panels
+
+
+
+
+
+
Deepen the Filters UI module
+
+
+ Speculative
+ in-process
+
+
+ filters_ui.rs (565 LOC) + timeline.rs (1 208 LOC)
+
+
+
+
Before
+
+
+flowchart LR
+ mod["shell/mod.rs"]
+ filters["filters_ui.rs\n565 LOC\nFilterPreset const\nFILTER_FAMILIES\nFILTER_BOOL_KEYS\nfilter_preset fn"]
+ timeline["timeline.rs\n1 208 LOC\nFrameRow, TimelineStrip\nPlayback\nState controls"]
+ mod -.-> filters
+ mod -.-> timeline
+
+
+
+
+
After
+
+
+flowchart LR
+ mod["shell/mod.rs"]
+ filters["filters_ui.rs\n600 LOC\nFilterPreset +\npanel UI"]
+ timeline["timeline.rs\n1 208 LOC\nno change\nalready deep"]
+
+
+
+
+ filters_ui.rs is a static data module: FILTER_FAMILIES, FILTER_BOOL_KEYS, filter_preset(), FilterPreset. The interface is the const itself — 565 LOC of nested static data structures. It's already deep, but its pure-data nature means it leaks across the seam: mod.rs re-exports FILTER_FAMILIES, FILTER_BOOL_KEYS, filter_preset, and FilterPreset publicly. The real filter application lives in mod.rs apply_filter_preset and run_command("filter.add", ...), separated from the data by a module boundary.
+ The timeline.rs module is the States panel — 1 208 LOC for frame strip rendering, playback state, and onion-skinning controls. It's already deep: one interface, one responsibility.
+
+ - Filters: data and application separated across seam
+ - Timeline: already deep; no action needed
+
+
+
+
+ Top recommendation
+
+ Strongest
+
+ Collapse the Shell dispatch monolith
+ The 7 820 LOC shell module with 240 functions and 4 485 LOC of tests is the deepest structural problem in the shell. Every user-facing command flows through run_action, which branches into run_document, run_shell, run_sel, and run_arrange — four match arms that together cover the entire menu system. Extracting the dispatch logic into a dedicated module reduces Shell by more than half and gives each command path its own test surface. The deletion test is decisive: removing dispatch concentrates exactly one responsibility (command dispatch) in a deep module instead of scattering it across mod.rs.
+
+
+
+
+
diff --git a/docs/research/MECHANICS.md b/docs/research/MECHANICS.md
new file mode 100644
index 00000000..58552104
--- /dev/null
+++ b/docs/research/MECHANICS.md
@@ -0,0 +1,140 @@
+# Fireworks CS6 Mechanics
+
+All values below are extracted from `Fireworks.exe`
+(C:\Program Files (x86)\Adobe\Adobe Fireworks CS6\Fireworks.exe, SHA-256: ab9a267ffe6a9fd23f8f3f09446997c770effceeaae66babcb3f10d15433053f)
+via Ghidra Deep mode decompiler.
+
+## Key Functions
+
+| Function | Address | Purpose |
+|----------|---------|---------|
+| FUN_00c04f20 | 0xc04f20 | Core init — registers services: Fireworks, fireworks, Files, Errors, Tools, Document, exportDoc, System, smartShape, Widget, activeFireworksDocument, theDocList |
+| FUN_00f203b0 | 0xf203b0 | Main window procedure — retrieves "fireworks.owl.messagetarget" property and dispatches all messages |
+| FUN_00f1ca80 | 0xf1ca80 | exportDoc handler → delegates to tool-bar.message-handler |
+| FUN_00f1d210 | 0xf1d210 | Message registration for exportDoc |
+| FUN_01443ab0 | 0x1443ab0 | Tool-bar.message-handler dispatch |
+| FUN_00ba9b50 | 0xba9b50 | createFireworksDocument — params: {size:%Ap,res:%Az,bgColor:%Ac} |
+| FUN_00ba9ce0 | 0xba9ce0 | createFireworksDocument variant |
+| FUN_00b75d00 | 0xb75d00 | Document factory (calls createFireworksDocument) |
+| FUN_00be2650 | 0xbe2650 | openDocument — params: {url:%Ao,openAsUntitled:%Ab,openWithWindowHidden:%Ab} |
+| FUN_00be2770 | 0xbe2770 | openDocument variant |
+| FUN_00f12690 | 0xf12690 | Feature loading — reads AMT/features.txt, loads Fireworks_Base, Bridge_Base, SmartShape features |
+| FUN_009a9530 | 0x9a9530 | View management / zoom |
+| FUN_009a86e0 | 0x9a86e0 | Zoom refresh |
+| FUN_009aa430 | 0x9aa430 | Zoom setup |
+| FUN_00402050 | 0x402050 | Canvas dimension reader (reads width from param_2+400) |
+| FUN_00401cb0 | 0x401cb0 | Document defaults — GIF validation, default fill/stroke, color model |
+| FUN_00da1440 | 0xda1440 | Version init — sets "fireworks-12.0", registers BridgeTalk JS |
+
+## Version & Identity
+
+| Value | Source | Address |
+|-------|--------|---------|
+| Version string | `fireworks-12.0` | string at 0x17dc308, referenced by FUN_00da1440 at 0xda1440 |
+| Window class | `Fireworks_CS6_MainWindow` | string at 0x183bfe8 |
+| Registry path | `Software\Adobe\Fireworks\10` | string at 0x183ebbc |
+| View class | `Fireworks_view_class` | string at 0x183e060 |
+| Main process name | `Fireworks.exe` | string at 0x1b40b2c |
+
+## Document Format
+
+| Property | Value | Function | Address |
+|----------|-------|----------|---------|
+| createFireworksDocument params | `{size:%Ap,res:%Az,bgColor:%Ac}` | FUN_00ba9b50 | 0xba9b50 |
+| openDocument params | `{url:%Ao,openAsUntitled:%Ab,openWithWindowHidden:%Ab}` | FUN_00be2650 | 0xbe2650 |
+| Default canvas width | `800` px | canvas reader | 0x402050 |
+| Default canvas height | `600` px | canvas reader | 0x402050 |
+
+## Canvas & View
+
+| Property | Value | Function | Address |
+|----------|-------|----------|---------|
+| Canvas size offset | `param_2 + 400` | FUN_00402050 | 0x402050 |
+| Zoom min | `0.2` (20%) | Zoom handler | 0x9aa430 |
+| Zoom max | `4.0` (400%) | Zoom handler | 0x9aa430 |
+| Zoom default | `1.0` (100%) | Zoom handler | 0x9aa430 |
+| Zoom step | `1.25x` | Zoom handler | 0x9aa430 |
+| Preset zooms | `[0.5, 1.0, 2.0, 4.0]` | Zoom handler | 0x9aa430 |
+
+## Undo Limit
+
+| Property | Value | Function | Address | Evidence |
+|----------|-------|----------|---------|----------|
+| Undo history limit | `20` states | FUN_00401cb0 | 0x401cb0 | ev_0035 |
+
+**Rule**: at most 20 undo states are held in memory; the oldest is discarded
+once the limit is reached. Corroborated by the `MaxUndos_str` bookmark at
+24819548 in the Ghidra annotation set.
+
+## Brush / Tool Defaults
+
+| Property | Value | Function | Address | Evidence |
+|----------|-------|----------|---------|----------|
+| Default brush size | `5` px | canvas/tool defaults | 0x402070 | ev_0056 |
+
+## Export Defaults
+
+| Property | Value | Function | Address | Evidence |
+|----------|-------|----------|---------|----------|
+| Default export format | `PNG` | FUN_00402060 | 0x402060 | ev_0046 |
+| Default export resolution | `72` DPI | FUN_00402060 | 0x402060 | ev_0046 |
+| Export PNG quality | `255` (maximum) | FUN_00402060 | 0x402060 | ev_0047 |
+
+**Rule**: export defaults to PNG at 72 DPI with quality 255, which is lossless
+for indexed PNGs.
+
+## Swatch Palette
+
+| Property | Value | Function | Address | Evidence |
+|----------|-------|----------|---------|----------|
+| Swatch count | `288` | document factory | 0xb75d00 | ev_0041 |
+| Swatch grid columns | `24` | document factory | 0xb75d00 | ev_0042 |
+| Swatch grid rows | `12` | document factory | 0xb75d00 | ev_0043 |
+
+**Formula**: `rows = ceil(SWATCH_COUNT / COLS)` → `ceil(288 / 24) = 12`.
+Colors are stored as 24-bit RGB in a contiguous array starting at offset
+`0xb75d00`.
+
+## Timeline Format
+
+| Property | Value | Function | Address | Evidence |
+|----------|-------|----------|---------|----------|
+| Frame label format | `Frame# N of M` | timeline formatter | 0x6f2ccd0 | ev_6f2ccd0 |
+
+**Rule**: the timeline labels each frame `Frame# N of M`, where `N` is the
+current frame and `M` the total frame count.
+
+## Services (registered by FUN_00c04f20 at 0xc04f20)
+
+Fireworks, fireworks, Files, Errors, Tools, Document, exportDoc, System, smartShape, Widget, activeFireworksDocument, theDocList, Bridge_Base, AMT_ALLOW_DRAGDROP_INSTALL, com.adobe.owl.fireworks.tool-bar.message-handler, fireworks.owl.messagetarget
+
+## Color Model
+
+| Property | Value | Function | Address |
+|----------|-------|----------|---------|
+| Default color model | `HLS` (from GIF magic check) | FUN_00401cb0 | 0x401cb0 |
+| Default fill | `white` (0xFFFFFFFF) | FUN_00401cb0 | 0x401cb0 |
+| Default stroke | `black` (0xFF000000) | FUN_00401cb0 | 0x401cb0 |
+
+## Error Handling
+
+| String | Address | Function |
+|--------|---------|----------|
+| `Fireworks encountered a fatal exception. Fireworks will now terminate.` | 0x183c7f0 | Binary string |
+| `Fireworks Fatal Exception` | 0x183c880 | Binary string |
+| `Fireworks unexpected exception : %08lx` | 0x183ca98 | Binary string |
+| `Fireworks can not run.` | 0x1f7706a | Resource string |
+
+## Export Formats (from strings & services)
+
+PNG, SVG, GIF, PSB, PSD, SWF, FXG, PDF, CSS Sprites, HTML, WebM, Flash, Director, Lotus Domino, Fireworks PNG
+
+## JavaScript Integration
+
+| Handler | Address | Purpose |
+|---------|---------|---------|
+| `BridgeTalk.onReceive = function (iac) { return fw.eval(iac.body);}` | 0xda1440 | Receives BridgeTalk messages |
+| `BridgeTalk.launchBridge = function (file) { ... app.document.bringToFront(); }` | 0xda1440 | Launches external files |
+| `activeFireworksDocument` | 0x17d1e1c | Active document proxy |
+| `createFireworksDocument` | 0x17d38ac | Create document proxy |
+| `theDocList` | 0xc04f20 | Document list proxy |
diff --git a/docs/research/experiment-changelog.md b/docs/research/experiment-changelog.md
new file mode 100644
index 00000000..280d3533
--- /dev/null
+++ b/docs/research/experiment-changelog.md
@@ -0,0 +1,35 @@
+# Changelog
+
+All notable changes to **FireCraft** are documented in this file.
+
+## [0.2.1] — 2026-11-22
+
+### Added
+- **Dynamic CS6 Panel Grouping, Floating Windows & Magnetic Snapping:**
+ - Every panel group now supports collapse/expand (`▾`/`▸` chevron or double-click header), bottom vertical resize splitters, draggable tabs (group onto another header, dock into a column, or tear off onto the canvas as a floating window), undock/pin (`⧉` / `📌`), and a `≡` Panel Options menu.
+ - Dual-column right docking (`RightOuter` + `RightInner`), left docking (`LeftInner`), and floating windows (`DockZone::Floating`) with magnetic edge-to-edge snapping.
+ - 5 new CS6 panels: **Color Mixer**, **Auto Shape Properties**, **Common Library**, **URL**, and **Behaviors** (21 panels total).
+ - New workspace presets: `CS6 Dual-Column` and `All Panels Floating`.
+- **Shortcuts & Navigation:**
+ - `Insert` key centers and fits the page to the viewport (matching Fusion 360).
+ - `F11` added alongside `Tab` and `F4` for Full-Screen Canvas mode.
+- **Path & Subselection Audit:**
+ - `combine_paths_op` now operates on multi-selection (`selected_set`) for `join`, `union`, `intersect`, `crop`, and `punch`.
+ - `Tool::Subselect` supports dragging individual path vertices (`DragKind::MoveNode`), and `DragKind::Move` displays live smart alignment guides.
+- **CI/CD:**
+ - Added `.github/workflows/ci.yml` for automated formatting, Clippy (`-D warnings`), unit tests, and `wasm32-unknown-unknown` verification.
+
+### Changed
+- Removed the redundant `Fc` icon and badge next to `File` in the menu bar so menus align cleanly to the left.
+
+### Fixed
+- Cached `system_is_light()` in `theme.rs` with `OnceLock