Skip to content

Sheet: no Defaults layer in core (#497 stage 3) - #500

Merged
samitbasu merged 3 commits into
shadcn-style-497from
shadcn-defaults-497
Nov 25, 2026
Merged

samitbasu merged 3 commits into
shadcn-style-497from
shadcn-defaults-497

Conversation

@samitbasu

Copy link
Copy Markdown
Owner

Stage 3 of #497: no Defaults layer in core. It's stacked on #499, which is stacked on #498. Against #499 it deletes 2,561 lines and adds 868.

What changes

  • Core's 14 generated sheets move into core (src/sheets). This is its own commit, and the importer's --check passes.
    • Style::new writes the whole Vega look, so Style::default() really is Vega.
    • The extras' sheets stay in the shadcn crate until stage 4.
  • Audit: every part was resolved with and without its Defaults rules. Only 3 had live Defaults rules: the table's header, group and group-cell bands. They moved, with the same values, into write_table_exceptions.
  • Deleted:
    • legacy_defaults.rs, the 8 XDefaults writers and every Defaults-layer section writer;
    • core's 9 part_over(.., Defaults(..)) sites, which were dead under the generated sheets;
    • Style::write_look.
  • Renamed: Layer::Preset → Layer::Base, Sheet::defaults() → Sheet::new(), and as_preset → as_base.
  • Rule-only section fields leave the sections. Each value is computed from the tokens inside its rule body: the table's rules, stripe and inset; checkbox, radio and switch sizes; the segmented section; input icon sizes; and the stepper, slider and progress fills.
    • Unread fields are deleted.
    • For the table, apps use App rules on the new TablePart::last_row() and striped_row().
  • What remains for the extras only: Layer::Defaults, sheet::Defaults and part_over. They're marked for stage 5. A unit test asserts that core writes nothing at the Defaults layer.

Checks

  • cargo xtask integrate: green.
  • No golden moved (229 passed).
  • Harness: all 6,404 shared (config, part, key set) entries resolve identically before and after. 660 key sets dropped out, because only the deleted rules named them, and the audit had already shown them equal.

Tests

  • 8 deleted. They pinned the no-preset look's focus and disabled mechanisms.
  • Rewritten: the chevron test (onto an App descendant rule); table stripe, inset and last-row rule (onto App rules); and readers of the moved fields (onto tokens or the resolved part).

Prose

TODO(prose) placeholders on Sheet::new, as_base, Layer::Base/Defaults, TablePart::last_row/striped_row and part_over, plus the table and tabs exception docs.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PWiKKfuwuKXZxdwsSBxd76

samitbasu and others added 3 commits November 24, 2026 13:26
Stage 3 removes the Defaults layer, after which core's own
Style::default() would have no widget look while the generated sheets
live in the preset's crate. The sheets whose parts are core's
(eggshell_ui::owned: button, input, input group, select, dropdown menu,
tooltip, checkbox, radio group, switch, field, table, slider, progress,
tabs) move to src/sheets, and Style::write_look writes them; the
extensions' sheets stay in eggshell-ui-shadcn, which cannot be named
from core.

- xtask shadcn-import writes two roots by each widget's Home: core's
  sheets name core as `crate::`, the extensions' as `eggshell_ui::`;
  each root has its own generated index. The moved files differ from
  their old copies only in their `use` lines, and --check passes.
- The preset's own rules for core's parts move with them, in their order
  around the sheets: the dark choice-card label and the table's group
  band before, eggshell's sm/xs field sizes after
  (owned::write_dark_card_label, write_group_band, write_field_sizes).
- Shadcn::style() passes write_look only the extensions' sheets.

No behaviour change: every section, extras extension, egui style and
part's resolved classes are identical before and after
(Vega/Lyra x light/dark, style() and layout_style()), and no golden
moved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PWiKKfuwuKXZxdwsSBxd76
Stage 3 of the shadcn-only epic: core's widgets draw from the sheet
alone, the generated sheets and the recorded exceptions at one base
layer. Nothing core writes is under it any more.

Audit first: every part's classes, resolved with and without its
Defaults-layer rules for every key set its rules name (Vega/Lyra x
light/dark, style() and layout_style()), differed only for three of
eggshell's own table bands. Those move into write_table_exceptions:
- the header: transparent, ruled below in `border` at 1 pt;
- a group row: ruled below in `border` at 1 pt;
- a group cell: flex, items-center, 8 pt padding, nowrap.

Deleted:
- src/legacy_defaults.rs and the XDefaults writers it fed (button, menu,
  select, input, tabs, choice, table, tooltip), with their structs and
  TableDefaults::from_egui;
- the defaults-layer section writers (write_text_roles, the input, tabs,
  menu, table, field, checkbox, radio, switch and select rules) and the
  helpers only they used;
- core's part_over(.., Defaults(..)) in slider, progress and stepper,
  which the generated sheets replace: they are plain parts;
- Style::write_look: Style::new writes the whole core look;
  Shadcn::style() adds the extensions' sheets and exceptions;
- Sheet::defaults() (Sheet::new(), at the base layer) and Sheet::as_preset
  (renamed as_base);
- TableStyle's rule, rule_width, stripe, first_column_inset and
  rule_below_last: the exceptions read `border` and `muted/30`, and an app
  insets the first column or rules the last row with App rules on
  TablePart::first_column()/last_row().

Renamed: Layer::Preset is Layer::Base.

Kept for the extensions only, marked `#497 stage 4: delete`:
Layer::Defaults, sheet::Defaults and Builder::part_over. A unit test
pins that core writes no rule at Layer::Defaults.

The style-less fallback now carries the generated sheets, whose medium
text asked for faces egui does not have: its faces draw every weight in
egui's regular face, so it still installs no font and reports nothing.

Behaviour: under the preset nothing changes. All 6,404 (config, part,
key set) entries common to the dumps resolve to identical values; the
660 that go are key sets only the deleted rules named. No golden moved.
Without a preset, Style::default() now draws the generated shadcn look
(the core part of it) instead of the egui-derived one.

Tests deleted (they pinned the no-preset look's token mechanisms):
owned::without_the_preset_a_button_reads_focus_and_disabled_from_the_tokens,
owned_choice::the_tokens_ring_is_the_mechanisms_on_a_switch_and_a_cell,
field_box::a_field_box_without_a_ring_of_its_own_rings_in_the_tokens_focus,
sheet::a_select_trigger_reads_the_disabled_token,
sheet::a_presets_generated_looks_resolve_from_the_preset_layer_and_sections_from_the_defaults,
segmented_classes::they_fade_as_the_style_fades_disabled_controls,
contract_gaps::the_colors_form_still_draws_the_styles_disabled_colours,
owned_number::a_modified_style_changes_the_new_widgets_with_no_code_change.

Breaking: the deleted items above; Layer::Preset, Sheet::defaults and
as_preset renamed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PWiKKfuwuKXZxdwsSBxd76
A section field that only the recorded exceptions read did nothing when
an app changed it after Style::new. Each such field leaves its section:
its exception computes the value from the tokens inside the rule body,
from the same formula Style::new used, so density and style changes
still reach it. An app changes these with App rules on the part.

Moved into the exceptions, read from the tokens:
- CheckboxMetrics size, radius, glyph; RadioMetrics size, dot;
  SwitchMetrics track, thumb_off, thumb_on (choices_sheet; the switch's
  thumb scale reads the same track);
- the whole SegmentedStyle and SegmentedMetrics (tabs_sheet: the track
  fill is `input`, the sizes eggshell's default, sm and xs);
- InputMetrics icon_size, icon_gap;
- StepperMetrics padding_x, StepperStyle divider; the chevrons take
  `foreground`;
- SliderStyle track, range, thumb (their disabled blends) and the
  slider's and progress bar's track fill (`input`).

Deleted, read nowhere once the Defaults layer went: StepperStyle group
and transition, StepperMetrics height, SliderStyle transition,
ProgressStyle height and track.

Left for stage 5, each marked `#497 stage 5`: fields read only by the
extensions (the menu's six metrics, the select's sizes and chevron,
the input's icon colour, the label) and the toggle's unread size text,
whose type the select shares.

No behaviour change: all 6,404 resolved (config, part, key set) entries
are identical before and after, as are the extras' styles and the egui
style; no golden moved.

Tests: the ones that read a moved field as their expectation read the
tokens, or the resolved part, instead (contract, contract_gaps,
control_size, field_box, form, owned, owned_choice, owned_number,
progress, segmented_classes, eggshell-ui-shadcn styles).

Breaking: the deleted fields and types above.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PWiKKfuwuKXZxdwsSBxd76
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant