The panels subsystem concentrates three distinct problems (measured):
crates/signex-app/src/panels/mod.rs — 4,583 lines, 32 fns, of which two are pure data tables trapped in code: paper_dimensions (~935 lines) and label (~753 lines) are giant value-mapping match statements; plus a ~358-line Display impl and 13 view_* panel functions.
- Parallel property-panel family with copy-paste scaffolding:
panels/element_properties.rs (2,020), panels/properties_parameters.rs (1,912), panels/footprint_editor_properties/mod.rs (1,112, + pad_form 982 + subforms 979), panels/symbol_editor_properties.rs (821).
- ADR-0001 D6's Tier-2 (
library/shared/widgets/) is still empty while these panels re-implement the same row/label/field scaffolding privately.
Recipe
- Data out of code.
paper_dimensions and the label mega-match become const/static lookup tables (arrays of structs, or a small phf-style match-free helper) in a dedicated panels/data.rs — semantics identical, pinned by a test that iterates every variant and compares old vs new output (write the test against the CURRENT fn first, then swap).
- One file per panel. Each
view_* panel fn in panels/mod.rs moves to its own module (panels/components.rs, panels/sch_library.rs, …); panels/mod.rs becomes the index + shared kinds.
- Tier-2 widget extraction (D6, rule of three satisfied). The row/label/field/section scaffolding repeated across the four property panels is extracted once into shared stateless view helpers (
panels/widgets.rs or library/shared/widgets/ per D6's tier decision) — parameters in, Element out, zero state. Only extract what ≥2 panels actually share today; no speculative API.
footprint_editor_properties/ internal split stays within its folder (pad_form/subforms are already close to the cap — trim toward ≤800 with the shared widgets from step 3).
Ordering
Independent of #161–#164; can start immediately. Coordinate with #164 only on shared small helpers.
Acceptance criteria
- No file under
panels/ exceeds ~800 lines; paper_dimensions/label data covered by an exhaustive equivalence test.
- Property panels render identically (regression + manual smoke); shared scaffolding exists in exactly one place.
- No stateful widgets introduced (ADR-0001 A1 — reusable pieces are stateless view fns; state stays in the slice Model).
The panels subsystem concentrates three distinct problems (measured):
crates/signex-app/src/panels/mod.rs— 4,583 lines, 32 fns, of which two are pure data tables trapped in code:paper_dimensions(~935 lines) andlabel(~753 lines) are giant value-mappingmatchstatements; plus a ~358-lineDisplayimpl and 13view_*panel functions.panels/element_properties.rs(2,020),panels/properties_parameters.rs(1,912),panels/footprint_editor_properties/mod.rs(1,112, +pad_form982 +subforms979),panels/symbol_editor_properties.rs(821).library/shared/widgets/) is still empty while these panels re-implement the same row/label/field scaffolding privately.Recipe
paper_dimensionsand thelabelmega-match becomeconst/staticlookup tables (arrays of structs, or a smallphf-style match-free helper) in a dedicatedpanels/data.rs— semantics identical, pinned by a test that iterates every variant and compares old vs new output (write the test against the CURRENT fn first, then swap).view_*panel fn inpanels/mod.rsmoves to its own module (panels/components.rs,panels/sch_library.rs, …);panels/mod.rsbecomes the index + shared kinds.panels/widgets.rsorlibrary/shared/widgets/per D6's tier decision) — parameters in,Elementout, zero state. Only extract what ≥2 panels actually share today; no speculative API.footprint_editor_properties/internal split stays within its folder (pad_form/subforms are already close to the cap — trim toward ≤800 with the shared widgets from step 3).Ordering
Independent of #161–#164; can start immediately. Coordinate with #164 only on shared small helpers.
Acceptance criteria
panels/exceeds ~800 lines;paper_dimensions/labeldata covered by an exhaustive equivalence test.