Skip to content

Epic: shadcn-only — remove the design-neutral look and the second Tokens type #497

Backlog

Description

@samitbasu

Decided by the user (2026-11-24, on #496): eggshell is shadcn-only. The generated shadcn sheets plus the recorded exceptions are the base look. Code that only exists to keep a second, design-neutral look, or to leave room for another design system, goes.

#496 sizes it at about 2.4–2.8k library lines, ~35–40 tests, 130–220 public items, and no goldens. The rule for every stage below: no golden moves. Goldens are all drawn with the preset or are layout-only, so a moved golden means a live rule was deleted, not a dead one.

Target

Stages

Each stage is one PR, cut from main, with cargo xtask integrate green and no golden moved.

  1. One Tokens.
    • Move shadcn's Tokens, Palette, ThemeColor, ShadcnStyle, TextScale/spacing/radius, fonts and the contrast check into core. The shadcn crate re-exports them until the crate split.
    • Delete core contract::Tokens, Tokens::from_egui and Shadcn::core_tokens.
    • Rule bodies keep Fn(Tw, &Tokens) -> Tw, now over the one type.
  2. The base style from the tokens.
    • Section filling moves from Shadcn::style() into core: Style::new(&Tokens), with Style::default() = Vega light.
    • Delete:
      • Style::from_egui and Style::derived's egui path;
      • the from_egui of ScrollStyle, SplitterStyle, TableStyle and Tones;
      • the restyle setters, restyle and the public rewrite_rules.
    • The tests that pin the egui-derived look go (listed in Analysis: cost of staying theme-neutral vs. a shadcn-only eggshell #496 §1).
  3. No Defaults layer.
    • Delete:
      • Layer::Defaults, sheet::Defaults, Sheet::defaults/as_preset/has_rules_at and Builder::part_over;
      • the XDefaults structs and writers in src/owned (button, menu, select, input, tabs, table, tooltip, choice);
      • the Defaults-layer rule writers (write_rules, write_select_rules, write_field/checkbox/radio/switch_rules, write_text_roles).
    • Audit first: any Defaults rule for a part the generated sheets don't replace is live under the preset. Move it into the recorded exceptions rather than lose it.
    • Layer::Preset becomes the base layer (renamed Base). With nothing under it, replace is only needed for App rules.
  4. The extras on the sheet.
    • Delete each extra's from_style look and its part_over(.., Defaults(..), ..) sites. Badge, command, dialog, alert dialog, sheet, hover card, accordion, sonner, skeleton and spinner draw from their generated sheets; markdown, form and notify's own parts get recorded exceptions.
    • The style structs keep behaviour and layout fields only.
    • The shadcn crate's extras mappings (notify, badge, command, disclosure, form, hover_card, markdown, dialog, typeset_ink) go. So does the rest of preset_dump and the xtask compare step that checked hand-mapped values.
  5. The crate split, as revised on One crate: merge eggshell-ui-extras and eggshell-ui-shadcn into eggshell-ui (features for opt-in widgets) #366: one move PR.

Out of scope

🤖 Generated with Claude Code

https://claude.ai/code/session_01PWiKKfuwuKXZxdwsSBxd76

Activity

  1. samitbasu commented on Nov 24, 2026

    @samitbasu
    OwnerAuthor

    Stage 1 is #498, stage 2 is #499 (stacked on #498). This is the stage 3 worklist that came out of stage 2. In src/contract.rs, each item is marked // #497 stage 3:.

    Delete:

    • src/legacy_defaults.rs, with the XDefaults writers it feeds;
    • StepperStyle::group and StepperMetrics::height, which nothing reads.

    Move out of the sections (into the writers as constants, onto Tokens, or into App-rule features on the part):

    Field Read by
    Style::label write_field_rules, plus the form and markdown extras (only rest.text and disabled.text)
    CheckboxMetrics size, radius, glyph rules only
    RadioMetrics size, dot rules only
    SwitchMetrics track.x, thumb_off, thumb_on rules only; track.y is read at draw only as a ratio
    SegmentedStyle rules only, except the size keys
    SelectStyle sizes (height, gap, radius, text) rules only; padding_x is read by the command extra; min_width and glyph by nothing
    SelectStyle chevron the select's own is rules only; the dropdown trigger's is read at draw
    MenuStyle padding, item_padding, item_gap, text, shortcut_text, indicator rules only in core; the command extra reads them
    InputMetrics icon_size, icon_gap; InputStyle::icon rules only (the command extra reads icon)
    TableStyle first_column_inset, rule_below_last, stripe rules only
    TableStyle rule, rule_width the form and disclosure extras
    StepperMetrics::padding_x rules only
    ToggleStyle::sizes' text nothing

    Stays as draw-time fields:

    • menu.offset;
    • the dropdown trigger's chevron;
    • table.group_end, group_text_size and group_weight;
    • tooltip, kbd, mount, rich, selection, scroll and splitter;
    • most of toggle, slider, progress and stepper.

    Caveat: slider, progress and stepper read some colours at draw through Defaults(..) under the sheet. Those go with part_over.

  2. samitbasu commented on Nov 24, 2026

    @samitbasu
    OwnerAuthor

    Plan change (user, 2026-11-24): one crate (#366, reversed). The stages after stage 3:

    1. Merge the crates.
      • eggshell-ui-extras and eggshell-ui-shadcn move into eggshell-ui as modules.
      • The extras' generated sheets join src/sheets, and the importer goes back to one output root.
      • Cargo features gate the opt-in widgets, each with its sheet.
      • This stage is mechanical: no look changes, and the harness and goldens must be identical.
    2. The extras on the sheet, and the plumbing goes.
      • Each extra's from_style look becomes generated sheet rules or recorded exceptions.
      • Deleted:
        • part_over, Layer::Defaults and sheet::Defaults;
        • the shadcn mappings for the extras;
        • preset_dump and the compare step;
        • the Extension type map: each widget's style becomes a plain, feature-gated Style field;
        • Tokens::disabled, if nothing outside shadcn's own fading needs it.
      • Shadcn folds into Style/Tokens construction.

    Doing the merge before stage 5 means the extras' looks never need cross-crate plumbing.

  3. samitbasu commented on Nov 24, 2026

    @samitbasu
    OwnerAuthor

    Decided (user, 2026-11-24): stage 5 removes the Extension type map entirely. There is no public hook for third parties.

    A third-party widget:

    • declares a Part enum;
    • writes its rules over the standard Tokens (installed by the app through sheet.as_base());
    • takes any values of its own as builder options at the call site, or as rule constants that apps override with App rules.

    A typed map can come back later without breaking anything, if it's needed.

  4. samitbasu commented on Nov 24, 2026

    @samitbasu
    OwnerAuthor

    Stage 3 is #500 (stacked on #499 ← #498). Below are the worklists for stages 4 and 5, from worker-bee.

    Stage 4: one crate (mechanical; the harness and goldens must be identical)

    1. Move crates/eggshell-ui-extras/src/* into core as modules. Also move crates/eggshell-ui-shadcn/src/{preset.rs, drag_chip.rs, sheets/*}.
    2. Features on eggshell-ui:
      • today's extras features plus fonts;
      • the extras' dependencies (pulldown-cmark, unicode-normalization) become optional;
      • extras and the shadcn crate's features are dropped.
    3. The importer goes back to one root (src/sheets), one index and crate:: paths. Each extension widget's sheet is gated by that widget's own feature.
    4. Undo the crate-boundary leftovers:
      • the importer's two roots from stage 3;
      • the cfg(feature = "extras") split in preset.rs;
      • the eggshell_ui_shadcn re-exports;
      • pub on FontSet::declared/install/inserts, Elevation::shadow and theme::warn_low_contrast, which go back to pub(crate).
    5. Re-point the imports across tests, examples, benches, docs and the README.
    6. Merge the tests into tests/it, and the shadcn crate's examples into examples/.
    7. Delete both crates and their workspace members. The shadcn README's fonts/licence section moves into the root README (prose for the user).
    8. xtask: LIBRARY_SOURCES, the clock and spacing-units checks, the features step and the compare paths.

    Stage 5: the extras' looks on the sheet

    1. Each extension's look becomes sheet rules at Base:
      • its generated sheet: badge, command/combobox, dialog/alert/sheet/popover, hover card, accordion, sonner, skeleton, spinner, card;
      • plus recorded exceptions for eggshell's own parts: markdown, form, notify, disclosure.
    2. Delete part_over, sheet::Defaults and Layer::Defaults, with the extras' ~60 part_over sites.
    3. Delete the Extension type map and every extra's from_style/derive. Widget styles become feature-gated Style fields, holding behaviour and layout only.
    4. Delete Shadcn's extras mappings and layout_style's extension block, so Shadcn::style is Style::new. preset_dump and the xtask compare step go too.
    5. Section fields only the extras read:
      • MenuStyle padding/item_padding/item_gap/text/shortcut_text/indicator;
      • SelectStyle sizes, chevron and chevron_opacity;
      • InputStyle.icon;
      • Style.label;
      • toggle size text;
      • stepper.button.
    6. Delete Tokens::disabled and Disabled::{Faded, Colors}. Their remaining users follow shadcn's opacity-50. Tokens::focus() stays, for the generic node ring.
  5. samitbasu commented on Nov 24, 2026

    @samitbasu
    OwnerAuthor

    Decided (user, 2026-11-24): the cargo features for the one crate.

    • Default-on: badge, dialog, disclosure+accordion, skeleton, spinner, tabs, fonts.
    • Opt-in: markdown, command, notify, form, hover-card.
  6. samitbasu commented on Nov 25, 2026

    @samitbasu
    OwnerAuthor

    Decided (user, 2026-11-24): the layout is the one source of the look.

    • LayoutState::new(theme) requires the light+dark style. The layout gives egui its visuals and fonts from it.
    • Deleted: Shadcn::apply, the context's token store (theme::tokens(ctx), Shadcn::applied/of), with_style and Style::fallback. set_style stays for switching.
    • The contrast warning moves to where a layout is given its style.
    • A debug build reports two layouts on one context that give egui different styles.
    • The layout-only goldens (kaolin_*, chrome_stacked_by_z) re-render in Geist, for the user to review.

    This is its own PR after stage 5a (stage 6).

  7. samitbasu commented on Nov 25, 2026

    @samitbasu
    OwnerAuthor

    Decided (user, 2026-11-24): every widget is nested. Core widgets move into submodules too (owned::button::ButtonChain, owned::menu::…), matching the former extras (owned::badge::…). The flat pub use re-exports in owned go.

    This is its own mechanical PR (stage 7). Anything that has to move between modules (e.g. AccordionPart, from disclosure to accordion) is listed in it.

  8. samitbasu commented on Nov 25, 2026

    @samitbasu
    OwnerAuthor

    Decided (user, 2026-11-24), for stage 7 (#505):

    1. Short names. Each type drops its module's name: button::Chain, table::Part, badge::Style, badge::Ext, and so on. Callers that use two widgets in one file qualify them (button::Part).
    2. One home per widget. The text field goes to owned::text_field, the tooltip widget to owned::tooltip, and each b.<widget>() builder method moves beside its widget.
    3. A prelude. use eggshell_ui::prelude::* brings in every compiled-in widget trait anonymously (as _, feature-gated), plus the common types (Builder, Tw, tw, Style).

    All three land in #505.

  9. added a commit that references this issue on Nov 25, 2026
  10. samitbasu commented on Nov 25, 2026

    @samitbasu
    OwnerAuthor

    Short names, decided (user, 2026-11-24), for #505:

    • <widget>::Style and <widget>::Part as the rule gives. Inside a widget's own files, the core types are written crate::Style / sheet::Part.
    • DialogKey → dialog::Node, DialogContent → dialog::Content.
    • radio::Chain/Part; toggle::ItemChain; menu::Chain (was DropdownChain), with menu::ItemChain kept; segmented::Rows; splitter::Start; input::Part/GroupPart; form::SectionChain; hover_card::Trigger; command::List. Combobox* and AutosuggestChain keep their names.
    • drag_chip::Chip and toggle_group::Group. dialog::Dialog, menu::Menu, markdown::Markdown, hover_card::HoverCard and choice::Choice stay.
  11. added a commit that references this issue on Nov 25, 2026
  12. samitbasu commented on Nov 25, 2026

    @samitbasu
    OwnerAuthor

    Decided (user, 2026-11-24), stage 6: one shared style. A new SharedStyle handle (SharedStyle::new(themed)) is the single source. Every LayoutState::new(&shared) / named(name, &shared) shares it, and shared.set(..) switches every layout at once. LayoutState::set_style goes.

    The clash report remains only as a guard against two different SharedStyles on one context; its name is still open.

  13. samitbasu commented on Nov 25, 2026

    @samitbasu
    OwnerAuthor

    Decided (user, 2026-11-24), stage 6:

    • The 8 layout-only goldens re-rendered in Geist are approved.
    • A style whose tokens carry no font quietly uses egui's regular face for every weight, with no MissingFace.
    • The clash warning is dropped: a second SharedStyle is deliberate.
  14. added 2 commits that reference this issue on Nov 25, 2026
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