Repository navigation
Shadcn-only stages 2–4: base style from tokens, no Defaults layer, one crate (#497) - #502
Merged
Merged
Conversation
Tokens hold one theme's colours, but nothing said which: with_palette took the theme as an argument that "must be the theme they were made for", and Shadcn kept its own theme beside its tokens. Stage 2 builds a Style from tokens alone and needs the theme for shadcn's `dark:` classes (input fill, ghost hover, the kbd on a tooltip). - Tokens::theme, set by light() and dark(). - Tokens::with_palette(palette) reads it; its theme argument goes. - theme::warn_low_contrast(ctx, tokens) reads it; its theme argument goes. - Shadcn's `theme` field goes; Shadcn::theme() reads the tokens'. No behaviour change: every section and every part's resolved classes are identical before and after (checked with a throwaway dump). Breaking: Tokens::with_palette, theme::warn_low_contrast and the Shadcn::theme field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PWiKKfuwuKXZxdwsSBxd76
Stage 2 of the shadcn-only epic. Core fills every section from shadcn's
tokens; the preset only writes its generated look over them.
- Style::new(&Tokens) fills every section the way Shadcn::style() did
(it moves here from the preset), in the tokens' theme, and writes the
widgets' own rules once, at the defaults layer. It carries the tokens'
font as the Fonts extension. Style::default() is Vega neutral light.
- Style::write_look(|sheet| ..) sets the preset layer, runs the closure,
then writes the recorded exceptions; write_exceptions is private.
Shadcn::style() is Style::new, write_look over the generated sheets,
the field sizes and its two own rules, and the disclosure exceptions.
- A layout with no style of its own draws with Style::default() in
egui's fonts (no font, control and label weights Normal), built once;
it gives egui nothing, as before.
- The 10 sections that had only getters and setters (label, checkbox,
radio, switch, segmented, select, menu, tooltip, input, table) are pub
fields; their getters go.
- size::{ICON, SM, XS, ..} move to eggshell_ui::theme::size; the shadcn
crate re-exports them.
- TablePart::last_row() and TablePart::striped_row(), beside
first_column(), so an app can rule the last row or a stripe.
- src/legacy_defaults.rs feeds the XDefaults writers from egui's default
visuals, so the Defaults layer under the preset is unchanged; it is
marked `#497 stage 3: delete`. 31 section fields that only feed rule
writers or exceptions are marked `#497 stage 3: move`/`delete`.
Deleted: Style::from_egui, the from_egui of ScrollStyle, SplitterStyle,
TableStyle and Tones, Style::derived's egui path, restyle,
rewrite_rules, the 10 section setters (set_select, set_input, set_menu,
set_table, set_label, set_checkbox, set_radio, set_switch,
set_segmented, set_tooltip), and the unused Sheet::set_layer and
has_rules_at.
Behaviour: under the preset nothing changes. 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. Without a preset, a style is now Vega light, not egui's
look: its sections, motion and tones are shadcn's.
Tests deleted (they pinned the egui-derived look or the restyle path):
contract::core_draws_a_button_with_no_preset,
contract::the_neutral_input_maps_to_egui_s_own_text_edit_style,
numbers::an_infinite_egui_tooltip_delay_is_the_longest_duration,
tone::the_egui_style_takes_egui_s_warning_colour,
tone::the_egui_style_s_tones_pass_aa_but_for_the_listed_misses,
tooltips::the_neutral_style_takes_its_timing_and_width_from_egui,
owned_choice::the_neutral_style_draws_the_chosen_cell_in_egui_s_active_fill,
owned_choice::a_modified_style_changes_every_owned_widget,
menu_sheet::without_a_preset_the_highlighted_item_takes_egui_s_selection_fill,
modal::style::the_neutral_scrim_is_egui_modals_and_the_presets_is_black_at_half,
style::a_new_text_role_reaches_the_widgets_own_looks,
style::a_section_metric_an_exception_reads_lands_after_the_preset.
Breaking: the deleted items above; the sections' getters (now fields);
eggshell_ui_shadcn::size is a re-export.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PWiKKfuwuKXZxdwsSBxd76
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
Pure renames, so history follows each file; the next commit wires them up (this one does not build on its own). - eggshell-ui-extras/src/<widget> -> src/owned/<widget> (accordion, badge, command, dialog, disclosure, form, hover_card, markdown, notify, skeleton, spinner, tabs, styles); - eggshell-ui-shadcn/src/preset.rs -> src/theme/preset.rs, drag_chip.rs -> src/owned/drag_chip.rs, the extensions' generated sheets -> src/sheets; - eggshell-ui-shadcn/tests -> tests/it (contrast, registry and its themes.ts, styles as preset_styles, tones); - eggshell-ui-shadcn/examples/preset_dump.rs -> examples/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PWiKKfuwuKXZxdwsSBxd76
Stage 4 of the shadcn-only epic: eggshell-ui-extras and
eggshell-ui-shadcn are modules of eggshell-ui. The previous commit moved
their files; this one wires them in.
- The extensions are public modules of `owned`, each behind its feature:
owned::{accordion, badge, command, dialog, disclosure, form,
hover_card, markdown, notify, skeleton, spinner, tabs}. Flattening them
into `owned` would rename public types (Unset, Items, ItemChain clash),
so they keep their modules for now. DragChip and drag_chip are in
`owned`.
- The preset is theme::{Shadcn, tokens}; `variant` is beside `size` in
`theme`, and the preset crate's documentation is the theme module's,
unchanged but for its code paths.
- Features: default = clipboard, fonts, accordion, badge, dialog,
disclosure, skeleton, spinner, tabs; opt-in: command, form, hover-card,
markdown, notify. pulldown-cmark and unicode-normalization are optional
deps of markdown and command.
- One sheets index: the importer writes every sheet to src/sheets with
`crate::` paths, each extension's behind its own feature (Home::Feature
replaces Home::Extension and the two output roots).
- Style::new writes the extensions' sheets and the disclosure's
exceptions, so Shadcn::style() is Style::new(&tokens); layout_style
gates each extension's mapping on its feature.
- Undone, as they existed only for the crate boundary: the public
FontSet::{declared, install, inserts}, Elevation::shadow,
theme::warn_low_contrast, Builder::keyed_under and report() are
pub(crate) again; the preset's `extras` feature and its cfg splits.
- xtask: the clock and spacing-units sources, the `features` step
(eggshell-ui with no default features) and preset_dump's features.
- The preset crate's README section on fonts is the root README's,
verbatim but for the licence link's path.
- The workspace is eggshell-ui and xtask.
No behaviour change under the preset: every section, extension style,
egui style and part's resolved classes are identical to 728349d, and no
golden moved. Without a preset, Style::default() now has the opt-in
widgets' generated sheets too.
Tests: the preset crate's tests are tests/it modules (contrast, registry,
preset_styles, tones). Deleted, as they pinned the combobox's look
without a preset (#496 §1):
combobox_sheet::without_a_preset_the_box_takes_the_menus_radius_from_the_sheet,
combobox_sheet::the_presets_look_replaces_the_combobox_defaults.
theme_toggle skips preset_dump, which draws nothing.
Breaking: eggshell_ui_extras::X is eggshell_ui::owned::X,
eggshell_ui_shadcn::* is eggshell_ui::theme::* (DragChip in owned).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PWiKKfuwuKXZxdwsSBxd76
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stages 2–4 of #497, landing on main. They were reviewed and merged as #499, #500 and #501. Those PRs were stacked, so each merged into the branch below it rather than into main; only #498 (stage 1) reached main. This branch carries all three stages unchanged.
eggshell-ui-extrasandeggshell-ui-shadcnmerge intoeggshell-ui, behind cargo features.Bringing it up to date with main is a merge commit that changes no files.
cargo xtask integratepassed on 8b1bb58, with no golden moved.🤖 Generated with Claude Code
https://claude.ai/code/session_01PWiKKfuwuKXZxdwsSBxd76