Skip to content

owned: short names, one home per widget, and a prelude (#497 stage 7 follow-ups) - #506

Merged
samitbasu merged 8 commits into
mainfrom
short-names-497
Nov 25, 2026
Merged

samitbasu merged 8 commits into
mainfrom
short-names-497

Conversation

@samitbasu

Copy link
Copy Markdown
Owner

These are the stage 7 follow-ups of #497, with the user's naming decisions. Stage 7 itself merged as #505; these commits came after it and weren't included.

Moves

  • The text field moves to owned::text_field. The tooltip widget moves to owned::tooltip, together with its part.
  • Each core b.<widget>() method now lives in its widget's module. They're still inherent Builder methods, so apps need no import.

Short names (decided on #497)

  • The rule: each type drops its module's name. <W>Chain → Chain, <W>Ext → Ext, ButtonOptions → Options, and every widget's part enum and style become <mod>::Part and <mod>::Style.
    • Inside a widget's own files, the core types are written crate::Style and sheet::Part.
    • Enums of another component keep their names: dialog::AlertDialogPart/SheetPart/PopoverPart, command::ComboboxPart and form::CardPart.
  • Leftovers decided one by one: input::GroupPart, dialog::Node, dialog::Content, radio::Chain, toggle::ItemChain, menu::Chain, segmented::Rows, splitter::Start, form::SectionChain, hover_card::Trigger, command::List, drag_chip::Chip and toggle_group::Group.
  • Private enums: nine modules had a private node-key enum called Part. It's renamed Node there to avoid the clash: checkbox, command, menu, radio, select, slider, switch, table and tabs.
  • Importer: it emits module-qualified part names. The regenerated sheets differ only in their use lines.

Prelude

use eggshell_ui::prelude::*; brings in Builder, Style, Tw, tw and every compiled-in widget trait, imported anonymously (as _) and gated by feature. The examples, tests and doc examples use it.

Checks

  • cargo xtask integrate: green.
  • No golden moved (229/229).
  • Harness: 6,692/6,692 lines identical once the renames are applied to the baseline.
  • tests/ui stderr changes only in the type names rustc prints.

Prose for the user

  • prim's module doc still says it holds the text field.
  • The shadcn-import --help line about comparing against the preset is stale.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PWiKKfuwuKXZxdwsSBxd76

samitbasu and others added 8 commits November 24, 2026 18:34
One home per widget:

- prim/text_field.rs -> owned/text_field.rs: owned::text_field
  (b.text_field, Field, Select, Enter, ...); prim keeps the icon and
  the display primitives.
- tooltip.rs -> owned/tooltip/mod.rs, and the tooltip's part file
  owned/tooltip.rs -> owned/tooltip/sheet.rs: owned::tooltip holds the
  tooltip widget and TooltipPart. Its items stay crate-private but the
  part; three links in its module docs to crate-private items are code
  spans now, as a public module's docs may not link them.

Pure moves but for the module lines and the paths that name them.
No behaviour change; no golden moved.

Breaking: eggshell_ui::prim::text_field is eggshell_ui::owned::text_field.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PWiKKfuwuKXZxdwsSBxd76
b.button, b.toggle/toggle_item, b.custom, b.checkbox(_unlabelled),
b.switch(_unlabelled), b.radio_group, b.segmented, b.slider, b.select,
b.dropdown_menu, b.progress, b.splitter, b.table and b.stepper move out
of owned/mod.rs, each into an `impl Builder` in its widget's module,
beside the chain it returns, as b.number, b.field_box and b.text_field
already were. They stay inherent: an app still calls them with no import.

The doc comment that sat on the one impl block (a control starts from
the builder and ends in a terminating call) moves, word for word, into
owned's module docs, ahead of its section on classes.

Moved code only. No behaviour change; no golden moved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PWiKKfuwuKXZxdwsSBxd76
A widget's items drop the module's own name, as the user decided:
button::ButtonChain is button::Chain, badge::BadgeExt is badge::Ext,
button::ButtonOptions is button::Options. This commit does the names
whose short form is plain (every <Widget>Chain and <Widget>Ext); the
rest (Part, Style, and the names listed for the coordinator) follow once
decided.

Renamed: accordion, badge, button, checkbox, custom, disclosure,
field_box, number, progress, segmented, select, slider, spinner,
splitter, stepper, switch, table, tabs, toggle ::Chain; accordion,
badge, command, dialog, disclosure, form, hover_card, markdown, notify,
skeleton, spinner, tabs ::Ext; button::Options.

Inside its module an item is named bare; elsewhere it is named through
its module (button::Chain). A widget trait is imported `as _` where a
file imported it for its methods; the prelude, next, replaces those.

tests/ui/widget_needs_a_terminator.stderr: rustc now names each unused
chain by its path (eggshell_ui::owned::button::Chain), as several share
the name; the expectation follows, nothing else in it changed.

No behaviour change; no golden moved.

Breaking: the renamed items.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PWiKKfuwuKXZxdwsSBxd76
…497)

`use eggshell_ui::prelude::*` brings Builder, Style, Tw and tw, and the
extension trait of every compiled-in opt-in widget, unnamed (`Ext as _`,
behind its feature), so b.badge(..), b.tabs(..) and the rest resolve
without naming a trait: accordion, badge, command, dialog (and its
PopoverExt), disclosure (and its SectionExt), form, hover_card,
markdown, notify, skeleton, spinner, tabs. ShellExt is not in it: it
is the draw closure's shell, not a widget.

The examples, the tests and the doc examples that imported a widget
trait for its methods use the prelude instead.

No behaviour change; no golden moved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PWiKKfuwuKXZxdwsSBxd76
The rest of the module-prefix strip, as the user decided:

- Every widget part enum is <module>::Part: accordion, badge, button,
  checkbox, command, dialog, field, hover_card, input, menu, notify,
  progress, radio (RadioGroupPart), select, skeleton, slider, spinner,
  switch, table, tabs, tooltip; input::InputGroupPart is
  input::GroupPart. Enums of another component keep their names
  (dialog::AlertDialogPart, SheetPart, PopoverPart, command::ComboboxPart,
  form::CardPart).
- Every opt-in widget's style is <module>::Style: badge, command,
  dialog, disclosure, form, hover_card, markdown, notify, skeleton,
  spinner. Inside those modules the core style is crate::Style.
- dialog::DialogKey -> dialog::Node, dialog::DialogContent ->
  dialog::Content, radio::RadioGroupChain -> radio::Chain,
  toggle::ToggleItemChain -> toggle::ItemChain, menu::DropdownChain ->
  menu::Chain, segmented::SegmentedRows -> segmented::Rows,
  splitter::SplitterStart -> splitter::Start, form::FormSectionChain ->
  form::SectionChain, hover_card::HoverCardTrigger ->
  hover_card::Trigger, command::CommandList -> command::List,
  drag_chip::DragChip -> drag_chip::Chip, toggle_group::ToggleGroup ->
  toggle_group::Group.

Where a module now names its part enum Part, its private node-key
enum, which was also called Part, is Node (checkbox, command, menu,
radio, select, slider, switch, table, tabs). The sheet trait is
crate::sheet::Part in those modules.

The importer names a part enum as its module does (the component's
enum with the module's name stripped, or the widget's `parts`) and the
regenerated sheets import the module: `use dialog::AlertDialogPart::*`,
`use radio::Part::*`. tests/ui/widget_needs_a_terminator.stderr follows
rustc's path for radio::Chain.

No behaviour change: the harness dump is identical but for the names;
no golden moved.

Breaking: the renamed items.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PWiKKfuwuKXZxdwsSBxd76
@samitbasu
samitbasu merged commit b1d4c49 into main Nov 25, 2026
4 checks passed
@samitbasu
samitbasu deleted the short-names-497 branch November 25, 2026 05:31
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