Skip to content

Style structs: move the no-preset looks into Defaults-layer sheets, and delete the look fields #482

Done

Description

@samitbasu

From #446's Phase 2 audit. The epic's checklist says each migrated control "deletes its style struct". Phase 2 ships with only ButtonStyle deleted. Every other control's struct (SelectStyle, MenuStyle, SliderStyle, TableStyle, …) still holds:

  • (A) the control's own no-preset look, written as the Defaults layer by write_*_rules or passed through part_over;
  • (B) metrics and behaviour: sizes, transitions, delays, list heights, and the values the recorded exceptions read.

Proposal:

  • move (A) into Defaults-layer sheets (as code, or generated from a neutral base), so the look lives only in sheets;
  • shrink each struct to (B), or fold (B) into tokens and part metrics where that's natural;
  • the preset's redundant look writes are removed in Phase 2 itself.

After Phase 2 merges. Breaking: it removes the public look fields.

Activity

  1. samitbasu commented on Nov 22, 2026

    @samitbasu
    OwnerAuthor

    Scoped during Phase 2. This also absorbs removing the shadcn preset's dead look writes, which was planned for Phase 2 but moved here because it's the same analysis:

    • The writes: the preset writes look values for 17 families (about 800 lines of preset.rs). Under the preset, its own generated replace cuts most of them.
    • Not all are dead: some look fields are also metrics or sources. MenuStyle's row metrics feed virtual-list estimates and the disclosure, hover card, skeleton and command list (from_style); SelectStyle feeds the text field and the command palette.
    • Tests that assert struct values ("the preset gives the skeleton shadcn's look", slider style(theme).slider) must be rewritten to assert the drawn node before a write goes.
    • Fields the recorded exceptions read stay: Known differences from CSS: no rounded clipping, no group opacity #40, Slider and segmented tracks vanish on bg-muted panels #132, table, input sizes, choices, accordion gap/nudge, form padding, notify's card.
    • Plan:
      • one family per commit, leaf families first: tooltip, table, the choices, tabs, progress;
      • then input, select and menu;
      • then extras.
      • No golden may move; a moved golden means the write wasn't dead.
    • Size: about a day for the dead writes alone, before the field deletion itself.
  2. samitbasu commented on Nov 23, 2026

    @samitbasu
    OwnerAuthor

    From #487: at a non-default density, a text field's height still comes from control_height (fed to egui's interact_size.y in map_input_as), not from the generated h-9/h-8 × spacing. #487 pins it at 36 as a known gap. #482 must resolve it, so the consumer's 28 pt controls apply to fields as well as buttons.

  3. samitbasu commented on Nov 23, 2026

    @samitbasu
    OwnerAuthor

    Plan approved by the user (2026-11-23). The full plan is in the coordinator's notes; in summary:

    1. Field height, padding and radius come from the resolved InputPart::Root classes (h-9/h-8 × spacing), so fields follow the density. control_height, button_padding, input_padding, control_gap, toggle_padding_x, cell_padding, popup_padding and item_padding are deleted from the shadcn Tokens. The remaining metrics move to units.
    2. The no-preset look stays in code: crate-private XDefaults built from egui's visuals in Style::from_egui, written as Defaults rules (the ButtonStyle precedent).
    3. The public look setters are removed (set_tooltip, set_table, set_menu, set_input, set_select, set_label, set_checkbox, set_radio, set_switch, set_segmented). A setter stays only for behaviour, and Style::at_current_layer goes if nothing needs it. Apps restyle with App/Scope sheet rules.
    4. ToggleStyle is split out as Toggle: a generated look, and sizes that follow the spacing #490.

    Shape: one PR, one commit per family:

    1. tooltip
    2. table
    3. choices
    4. tabs
    5. progress and slider
    6. stepper
    7. input
    8. select
    9. menu, with a shared helper for extras that read core looks
    10. the extras structs
    11. the shadcn Tokens cleanup

    The guard: no golden moves at the default tokens. A moved golden stops the work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions