Repository navigation
feat(Icon): a theme maps a component's own icon role by slot, starting with CodeBlock's copy button - #9828
Conversation
…g with CodeBlock's copy button
defineTheme({componentIcons}) maps a component icon slot to a shared icon
name, null, a partial {icon, variant, size} request, or a pure function of
the slot's state. One shared resolution applies caller content, then the
theme's slot, then the component's fallback, field by field, and ignores a
malformed field with one development warning. CodeBlock's copy button is the
first slot, code-block-copy, with state {copied}. The static view reads back
through theme.componentIcons; theme build carries static slot values and
fails on a slot function. Component docs, the CLI, and the docsite registry
list a component's slots.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
… values DefinedTheme['componentIcons'] keeps the same shape as a Partial<Record>, so documentation that names DefinedTheme does not have to enumerate every icon name a slot may hold.
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Markdown | 154.5 kB (+576 B) · 19.2 kB CSS (0) | — | — · — · — |
| lab/Comments | 274.4 kB (+548 B) · 2.5 kB CSS (0) | — | — · — · — |
| lab/CommentThread | 268.9 kB (+534 B) · 2.4 kB CSS (0) | — | — · — · — |
108 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| CodeBlock · Storybook | 61.3 kB (+492 B) · 10.0 kB CSS (0) | 2,215 (+8) | — · — · — |
| CheckboxInput | 53.8 kB (+11 B) · 8.9 kB CSS (0) | — | — · — · — |
| BreadcrumbItem | 71.5 kB (+9 B) · 11.3 kB CSS (0) | — | — · — · — |
| TextInput | 54.6 kB (+9 B) · 9.9 kB CSS (0) | — | — · — · — |
| RadioList | 43.4 kB (+8 B) · 6.4 kB CSS (0) | — | — · — · — |
| Link | 44.3 kB (+7 B) · 6.8 kB CSS (0) | — | — · — · — |
| ContextMenuItem | 25.9 kB (+6 B) · 6.1 kB CSS (0) | — | — · — · — |
| DropdownMenuCheckboxItem | 21.1 kB (+6 B) · 6.4 kB CSS (0) | — | — · — · — |
| Thumbnail | 51.1 kB (+5 B) · 10.2 kB CSS (0) | — | — · — · — |
| TimeInput | 140.8 kB (+5 B) · 14.5 kB CSS (0) | — | — · — · — |
| FieldLabel | 38.0 kB (+4 B) · 4.8 kB CSS (0) | — | — · — · — |
| FileInput | 55.4 kB (+4 B) · 9.6 kB CSS (0) | — | — · — · — |
| Lightbox | 55.0 kB (+4 B) · 9.1 kB CSS (0) | — | — · — · — |
| MobileNav | 56.7 kB (+4 B) · 9.3 kB CSS (0) | — | — · — · — |
| Toast | 60.8 kB (+4 B) · 9.0 kB CSS (0) | — | — · — · — |
| ChatComposer | 63.3 kB (+3 B) · 10.5 kB CSS (0) | — | — · — · — |
| ChatToolCalls | 26.1 kB (+3 B) · 8.2 kB CSS (0) | — | — · — · — |
| DialogHeader | 49.7 kB (+3 B) · 10.2 kB CSS (0) | — | — · — · — |
| DrawerHeader | 49.9 kB (+3 B) · 11.6 kB CSS (0) | — | — · — · — |
| DropdownMenuRadioItem | 21.1 kB (+3 B) · 6.4 kB CSS (0) | — | — · — · — |
| DropdownMenuSubMenu | 59.7 kB (+3 B) · 9.3 kB CSS (0) | — | — · — · — |
| NumberInput | 58.0 kB (+3 B) · 10.1 kB CSS (0) | — | — · — · — |
| TabMenu | 58.3 kB (+3 B) · 9.8 kB CSS (0) | — | — · — · — |
| Token | 27.2 kB (+3 B) · 4.7 kB CSS (0) | — | — · — · — |
| ChatLayoutScrollButton | 47.3 kB (+2 B) · 8.9 kB CSS (0) | — | — · — · — |
| DateInput | 164.0 kB (+2 B) · 15.5 kB CSS (0) | — | — · — · — |
| InputGroup | 44.1 kB (+2 B) · 7.3 kB CSS (0) | — | — · — · — |
| ListItem | 58.9 kB (+2 B) · 10.7 kB CSS (0) | — | — · — · — |
| MultiSelector | 80.3 kB (+2 B) · 15.6 kB CSS (0) | — | — · — · — |
| SideNavCollapseButton | 47.7 kB (+2 B) · 8.7 kB CSS (0) | — | — · — · — |
| Step | 29.6 kB (+2 B) · 5.6 kB CSS (0) | — | — · — · — |
| Table | 92.6 kB (+2 B) · 16.9 kB CSS (0) | — | — · — · — |
| TableHeaderCell | 84.0 kB (+2 B) · 16.5 kB CSS (0) | — | — · — · — |
| TabList | 35.8 kB (+2 B) · 6.3 kB CSS (0) | — | — · — · — |
| TextArea | 49.3 kB (+2 B) · 8.8 kB CSS (0) | — | — · — · — |
| lab/ChatEmojiPicker | 69.1 kB (+2 B) · 773 B CSS (0) | — | — · — · — |
| ChatComposerInput | 61.3 kB (+1 B) · 10.0 kB CSS (0) | — | — · — · — |
| Collapsible | 24.6 kB (+1 B) · 4.5 kB CSS (0) | — | — · — · — |
| DateTimeInput | 186.6 kB (+1 B) · 17.2 kB CSS (0) | — | — · — · — |
| InfoTip | 38.3 kB (+1 B) · 5.1 kB CSS (0) | — | — · — · — |
| MobileNavToggle | 47.2 kB (+1 B) · 8.7 kB CSS (0) | — | — · — · — |
| Overlay | 21.6 kB (+1 B) · 3.9 kB CSS (0) | — | — · — · — |
| Selector | 83.2 kB (+1 B) · 16.2 kB CSS (0) | — | — · — · — |
| Switch | 90.2 kB (+1 B) · 9.5 kB CSS (0) | — | — · — · — |
| Timestamp | 22.9 kB (+1 B) · 8.9 kB CSS (0) | — | — · — · — |
| TopNav | 58.3 kB (+1 B) · 9.6 kB CSS (0) | — | — · — · — |
| TopNavHeading | 61.1 kB (+1 B) · 9.8 kB CSS (0) | — | — · — · — |
| lab/ChatReactionBar | 69.6 kB (+1 B) · 1.1 kB CSS (0) | — | — · — · — |
| lab/EmojiPicker | 72.5 kB (+1 B) · 722 B CSS (0) | — | — · — · — |
| richtext/RichTextView | 264.1 kB (+1 B) · 2.3 kB CSS (0) | — | — · — · — |
| AlertDialog | 90.2 kB (0) · 13.1 kB CSS (0) | — | — · — · — |
| Banner | 48.8 kB (0) · 9.2 kB CSS (0) | — | — · — · — |
| Button | 46.8 kB (0) · 8.7 kB CSS (0) | — | — · — · — |
| ChatComposerTokenElement | 61.3 kB (0) · 10.0 kB CSS (0) | — | — · — · — |
| ChatMessageMetadata | 19.9 kB (0) · 4.1 kB CSS (0) | — | — · — · — |
| ChatSendButton | 47.3 kB (0) · 8.7 kB CSS (0) | — | — · — · — |
| CheckboxListItem | 59.8 kB (0) · 10.7 kB CSS (0) | — | — · — · — |
| CommandPalette | 58.7 kB (0) · 12.3 kB CSS (0) | — | — · — · — |
| ComplexSelector | 57.6 kB (0) · 10.4 kB CSS (0) | — | — · — · — |
| ContextMenu | 83.2 kB (0) · 16.3 kB CSS (0) | — | — · — · — |
| DateRangeInput | 75.9 kB (0) · 11.2 kB CSS (0) | — | — · — · — |
| DropdownMenuItem | 20.3 kB (0) · 6.0 kB CSS (0) | — | — · — · — |
| Icon · Storybook | 7.8 kB (0) · 681 B CSS (0) | 921 (+208) | — · — · — |
| IconButton | 46.9 kB (0) · 8.7 kB CSS (0) | — | — · — · — |
| SideNav | 76.3 kB (0) · 10.1 kB CSS (0) | — | — · — · — |
| SideNavHeading | 61.7 kB (0) · 10.0 kB CSS (0) | — | — · — · — |
| TableSelectionToolbar | 56.4 kB (0) · 11.8 kB CSS (0) | — | — · — · — |
| ToggleButton | 47.7 kB (0) · 8.8 kB CSS (0) | — | — · — · — |
| TopNavMegaMenu | 56.2 kB (0) · 10.6 kB CSS (0) | — | — · — · — |
| lab/Schedule | 63.9 kB (0) · 3.9 kB CSS (0) | — | — · — · — |
| lab/TransferList | 80.0 kB (0) · 1.7 kB CSS (0) | — | — · — · — |
| lab/TransferListSelector | 87.1 kB (0) · 1.9 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditor | 283.7 kB (0) · 2.6 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditorToolbar | 234.1 kB (0) · 454 B CSS (0) | — | — · — · — |
| AppShell | 76.3 kB (−1 B) · 12.2 kB CSS (0) | — | — · — · — |
| BaseTypeahead | 57.2 kB (−1 B) · 9.6 kB CSS (0) | — | — · — · — |
| ChatLayout | 50.1 kB (−1 B) · 9.2 kB CSS (0) | — | — · — · — |
| CheckboxList | 45.6 kB (−1 B) · 7.5 kB CSS (0) | — | — · — · — |
| Pagination | 93.2 kB (−1 B) · 16.6 kB CSS (0) | — | — · — · — |
| Popover | 55.4 kB (−1 B) · 12.8 kB CSS (0) | — | — · — · — |
| Stepper | 48.5 kB (−1 B) · 8.8 kB CSS (0) | — | — · — · — |
| Tokenizer | 74.8 kB (−1 B) · 17.1 kB CSS (0) | — | — · — · — |
| TopNavMenu | 61.0 kB (−1 B) · 9.9 kB CSS (0) | — | — · — · — |
| TreeList | 40.8 kB (−1 B) · 5.4 kB CSS (0) | — | — · — · — |
| Carousel | 52.8 kB (−2 B) · 9.5 kB CSS (0) | — | — · — · — |
| MoreMenu | 78.2 kB (−2 B) · 16.4 kB CSS (0) | — | — · — · — |
| RadioListItem | 56.8 kB (−2 B) · 9.5 kB CSS (0) | — | — · — · — |
| TableCell | 84.4 kB (−2 B) · 16.7 kB CSS (0) | — | — · — · — |
| lab/SelectableCardGroup | 52.0 kB (−2 B) · 162 B CSS (0) | — | — · — · — |
| ChatDictationButton | 47.4 kB (−3 B) · 8.8 kB CSS (0) | — | — · — · — |
| CheckIndicator | 8.0 kB (−3 B) · 681 B CSS (0) | — | — · — · — |
| Citation | 20.2 kB (−3 B) · 4.4 kB CSS (0) | — | — · — · — |
| SelectorOption | 19.3 kB (−3 B) · 5.8 kB CSS (0) | — | — · — · — |
| SideNavItem | 56.8 kB (−3 B) · 9.8 kB CSS (0) | — | — · — · — |
| lab/CommentComposer | 109.0 kB (−3 B) · 1.9 kB CSS (0) | — | — · — · — |
| lab/ListInput | 85.5 kB (−3 B) · 1.6 kB CSS (0) | — | — · — · — |
| CommandPaletteInput | 27.0 kB (−4 B) · 7.4 kB CSS (0) | — | — · — · — |
| Field | 41.9 kB (−4 B) · 6.3 kB CSS (0) | — | — · — · — |
| Slider | 92.4 kB (−4 B) · 8.3 kB CSS (0) | — | — · — · — |
| FieldStatus | 9.5 kB (−5 B) · 3.6 kB CSS (0) | — | — · — · — |
| lab/DiffViewer | 73.1 kB (−5 B) · 2.1 kB CSS (0) | — | — · — · — |
| lab/TourStep | 61.3 kB (−5 B) · 590 B CSS (0) | — | — · — · — |
| Typeahead | 65.1 kB (−7 B) · 11.2 kB CSS (0) | — | — · — · — |
| Calendar | 57.7 kB (−8 B) · 9.3 kB CSS (0) | — | — · — · — |
| DropdownMenu | 77.9 kB (−8 B) · 16.4 kB CSS (0) | — | — · — · — |
| PowerSearch | 260.4 kB (−8 B) · 22.6 kB CSS (0) | — | — · — · — |
| charts/Chart | 168.8 kB (−9 B) · 494 B CSS (0) | — | — · — · — |
| lab/CommentPin | 48.4 kB (−13 B) · 1.2 kB CSS (0) | — | — · — · — |
Package size:
- @astryxdesign/cli 3.37 MB packed (+2.4 kB); no new dependencies
- @astryxdesign/core 6.59 MB packed (+10.0 kB); no new dependencies
API changes: cli +6 · ~4 · −0; core +15 · ~0 · −0
Committed API report behind this build: cli 19 rows, core 23 rows; run pnpm api:report.
25 API changes (advisory)
| Package | Where | Signature | Usage | |
|---|---|---|---|---|
| + | cli |
./authoring · Types · interface ComponentIconSlotDoc |
interface ComponentIconSlotDoc |
import type {ComponentIconSlotDoc} from '@astryxdesign/cli/authoring' |
| + | cli |
./authoring · Types · interface ComponentIconSlotStateDoc |
interface ComponentIconSlotStateDoc |
import type {ComponentIconSlotStateDoc} from '@astryxdesign/cli/authoring' |
| + | cli |
./doc · Also exported from an earlier entry point · ComponentIconSlotDoc |
ComponentIconSlotDoc (./authoring) |
import {ComponentIconSlotDoc} from '@astryxdesign/cli/doc' |
| + | cli |
./doc · Also exported from an earlier entry point · ComponentIconSlotStateDoc |
ComponentIconSlotStateDoc (./authoring) |
import {ComponentIconSlotStateDoc} from '@astryxdesign/cli/doc' |
| + | cli |
./template · Also exported from an earlier entry point · ComponentIconSlotDoc |
ComponentIconSlotDoc (./authoring) |
import {ComponentIconSlotDoc} from '@astryxdesign/cli/template' |
| + | cli |
./template · Also exported from an earlier entry point · ComponentIconSlotStateDoc |
ComponentIconSlotStateDoc (./authoring) |
import {ComponentIconSlotStateDoc} from '@astryxdesign/cli/template' |
| ~ | cli |
./authoring · Types · interface MultiComponentDoc |
theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } |
import type {MultiComponentDoc} from '@astryxdesign/cli/authoring'; const x: MultiComponentDoc = {theming: …} |
| ~ | cli |
./authoring · Types · interface SingleComponentDoc |
theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } |
import type {SingleComponentDoc} from '@astryxdesign/cli/authoring'; const x: SingleComponentDoc = {theming: …} |
| ~ | cli |
./doc · Types · interface ComponentBaseDoc |
theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } |
import type {ComponentBaseDoc} from '@astryxdesign/cli/doc'; const x: ComponentBaseDoc = {theming: …} |
| ~ | cli |
./doc · Types · interface SubComponentDoc |
theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[] } → theming?: { container?: boolean; targets: ComponentThemingTarget[]; vars?: ComponentThemingVar[]; derived?: ComponentThemingDerivedVar[]; componentIcons?: ComponentIconSlotDoc[] } |
import type {SubComponentDoc} from '@astryxdesign/cli/doc'; const x: SubComponentDoc = {theming: …} |
| + | core |
. · Types · type ComponentIconMap |
type ComponentIconMap<Variant extends string = IconVariant> = { [Slot in ComponentIconSlotName]?: ComponentIconSlotMap[Slot] extends true ? IconName | null | ComponentIconRequest<Variant> : ComponentIconValue<ComponentIconSlotMap[Slot], Variant> } |
import type {ComponentIconMap} from '@astryxdesign/core' |
| + | core |
. · Types · type ComponentIconRequest |
type ComponentIconRequest<Variant extends string = IconVariant> = Readonly<{ icon?: IconName | null; variant?: Variant; size?: IconSize }> |
import type {ComponentIconRequest} from '@astryxdesign/core' |
| + | core |
. · Types · interface ComponentIconSlotMap |
interface ComponentIconSlotMap |
import type {ComponentIconSlotMap} from '@astryxdesign/core' |
| + | core |
. · Types · type ComponentIconSlotName |
type ComponentIconSlotName = keyof ComponentIconSlotMap & string |
import type {ComponentIconSlotName} from '@astryxdesign/core' |
| + | core |
. · Types · type ComponentIconStaticMap |
type ComponentIconStaticMap = Partial<Record<ComponentIconSlotName, IconName | null | ComponentIconRequest<string>>> |
import type {ComponentIconStaticMap} from '@astryxdesign/core' |
| + | core |
. · Types · type ComponentIconValue |
type ComponentIconValue<State, Variant extends string = IconVariant> = IconName | null | ComponentIconRequest<Variant> | ((state: Readonly<State>) => ComponentIconRequest<Variant> | null | undefined) |
import type {ComponentIconValue} from '@astryxdesign/core' |
| + | core |
. · Types · interface DefineThemeInput |
componentIcons?: ComponentIconMap<ThemeIconEntryVariant<IconVariants, Base>> |
import type {DefineThemeInput} from '@astryxdesign/core'; const x: DefineThemeInput = {componentIcons: …} |
| + | core |
. · Types · interface DefinedTheme |
__componentIcons?: Partial<Record<string, StoredComponentIconValue>> @internal |
import type {DefinedTheme} from '@astryxdesign/core'; const x: DefinedTheme = {__componentIcons: …} |
| + | core |
. · Types · interface DefinedTheme |
componentIcons?: ComponentIconStaticMap |
import type {DefinedTheme} from '@astryxdesign/core'; const x: DefinedTheme = {componentIcons: …} |
| + | core |
./Icon · Also exported from an earlier entry point · ComponentIconMap |
ComponentIconMap (.) |
import {ComponentIconMap} from '@astryxdesign/core/Icon' |
| + | core |
./Icon · Also exported from an earlier entry point · ComponentIconRequest |
ComponentIconRequest (.) |
import {ComponentIconRequest} from '@astryxdesign/core/Icon' |
| + | core |
./Icon · Also exported from an earlier entry point · ComponentIconSlotMap |
ComponentIconSlotMap (.) |
import {ComponentIconSlotMap} from '@astryxdesign/core/Icon' |
| + | core |
./Icon · Also exported from an earlier entry point · ComponentIconSlotName |
ComponentIconSlotName (.) |
import {ComponentIconSlotName} from '@astryxdesign/core/Icon' |
| + | core |
./Icon · Also exported from an earlier entry point · ComponentIconStaticMap |
ComponentIconStaticMap (.) |
import {ComponentIconStaticMap} from '@astryxdesign/core/Icon' |
| + | core |
./Icon · Also exported from an earlier entry point · ComponentIconValue |
ComponentIconValue (.) |
import {ComponentIconValue} from '@astryxdesign/core/Icon' |
Wide change (shared styles: packages/core/src/theme/defineTheme.ts): add ci:run-visual, ci:run-a11y or ci:run-rtl to run them.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Waiting on one spec decision; nothing else blocks.
- Spec approval needed: this pull request adds FR14 to the current
component:CodeBlockrecord, which the component icon slot system spec leaves to CodeBlock's own contract, so an engineering owner must approve or amend FR14 at this head (as written, a themenullleaves the copy button invisible at rest and without a visible copied confirmation).
An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner. Two non-blocking notes:
astryx theme buildrefuses every slot function, imported ones included, although the theme-compilation architecture expects built themes to carry them; declaring the follow-up as a stack (Stack: #9828 → #<follow-up>) or using a static value in the theme template's example avoids a failing copy-paste.- The icon-resolution architecture record still says no Core slot has shipped.
[Automated review]
| const slotFunction = Object.entries(componentIcons ?? {}).find( | ||
| ([, value]) => typeof value === 'function', | ||
| ); | ||
| if (slotFunction) { |
There was a problem hiding this comment.
Non-blocking: the theme-compilation architecture (item 7) expects a built theme to carry its componentIcons functions, and this refuses imported ones too. It is a safe fail-closed step if the follow-up that carries them lands with this change; a Stack: #9828 → #<follow-up> line in both bodies would let the pair be judged together.
| * pure function of the slot's state that returns one. | ||
| * Reference: `astryx docs icons`; each component's docs list its slots. | ||
| */ | ||
| // componentIcons: {'code-block-copy': ({copied}) => ({icon: copied ? 'checkDouble' : 'copy'})}, |
There was a problem hiding this comment.
Non-blocking: this example is a slot function, which astryx theme build refuses on this head (ERR_THEME_INVALID). A static value such as {'code-block-copy': 'clock'} builds; the function example can return once built themes carry slot functions.
…template's componentIcons example builds The icon slot architecture record's baseline points to ComponentIconSlotMap and each owning component's docs for Core's slots. The theme template's componentIcons example is a static value, which astryx theme build carries.
|
Addressed the non-blocking notes in 3e836bb:
|
There was a problem hiding this comment.
Waiting on one spec decision; nothing else blocks.
- Spec approval needed: this pull request adds FR14 to the current
component:CodeBlockrecord, which the component icon slot system spec leaves to CodeBlock's own contract, so an engineering owner must approve or amend FR14 at this head (as written, a theme value ofnullleaves the copy button with nothing visible at rest and no visible copied confirmation).
An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner. Non-blocking notes:
astryx theme buildrefuses every slot function until #9829 lands, and the stack line here does not tie the two together (#9829 targets this branch and does not carry the same line), so land #9829 right after this one.- No test covers the new slot rows in
astryx componentoutput; one golden fixture with atheming.componentIconsentry would guard them. packages/core/src/theme/defineTheme.tsline 911: the first comment sentence restatesmergeComponentIcons; keep only the reason.
[Automated review]
| iconVariants, | ||
| ); | ||
|
|
||
| // Component icon slots merge by slot. The base's values include its slot |
There was a problem hiding this comment.
Non-blocking (comment style): "Component icon slots merge by slot." restates mergeComponentIcons. Keep only the reason, for example: "The base's static componentIcons view omits its slot functions. Read __componentIcons first."
…states only its reason
|
Took the non-blocking notes in d8b606b: |
There was a problem hiding this comment.
Waiting on one spec decision; nothing else blocks.
- Spec approval needed: this pull request adds FR14 to the current
component:CodeBlockrecord, which the component icon slot system spec leaves to CodeBlock's own contract, so an engineering owner must approve or amend FR14 at this head (as written, a theme value ofnullleaves the copy button with nothing visible at rest and no visible copied confirmation).
An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner. The new astryx component slot-row tests and the reworded merge comment settle the earlier notes. One non-blocking note:
astryx theme buildrefuses every slot function until #9829 lands, and #9829 targets this branch, so merge it right after this one.
[Automated review]
…de-block # Conflicts: # docs/specs/components/CodeBlock/CodeBlock.spec.md # packages/cli/test/__golden__/no-icon-set/search-icon-set.json # packages/cli/test/__golden__/no-icon-set/search-icon-set.txt
There was a problem hiding this comment.
Waiting on an engineering owner's spec decision, plus two fixes to the last merge from main.
Spec decision needed: CodeBlock's copy glyph now resolves through the code-block-copy slot, but at this head no component:CodeBlock clause states that, so the icon slot system spec (AST-087 FR15) still has CodeBlock pick its own icon. Approval needs an engineering owner to approve or amend that clause (the glyph, its copy/check fallback, the copied state, what null and a size request do) by commenting /approve-spec <full head SHA> on the head that contains it; the author may do this as an engineering owner.
Blocking:
- The merge from
mainreplaceddocs/specs/components/CodeBlock/CodeBlock.spec.mdwith main's file and reverted the sentence indocs/architecture/icon-resolution-and-component-slots.md, so the copy-slot clause and its rows are gone and the record again says no Core slot has shipped, while the description still lists both edits; restore them, renaming the clause to FR15 because main's FR14 now coversstartLineNumber. - The merge's brace-only reformat of
internal/interaction-harness/src/busy.tsis unrelated to slots and is the only change that puts this pull request in thepr-interaction-webkitlane, which fails here on main's new WebKit container setup; drop it.
Built themes refuse slot functions until #9829, so merge the two back to back.
[Automated review]
| <ComponentIcon | ||
| slot="code-block-copy" | ||
| state={{copied}} | ||
| fallback={{icon: copied ? 'check' : 'copy', size: 'sm'}} | ||
| color="inherit" | ||
| /> |
There was a problem hiding this comment.
This renders the copy glyph through code-block-copy, but at this head no component:CodeBlock clause states the slot: the merge from main replaced CodeBlock.spec.md with main's file (whose FR14 is now startLineNumber). Restore the copy-slot clause as FR15 so an engineering owner can approve it on that head.
| if (f.t >= window.from) { | ||
| break; | ||
| } |
There was a problem hiding this comment.
Unrelated to component icon slots, and the only file here inside pr-interaction-webkit's scope (.github/workflows/ci.yml:2672), whose leg 1/2 fails on the shader-cache check. Please drop this reformat.
The merge commit's lint hook reformatted this unrelated file; it now matches main again.
|
Responding to the review of b9ea752 (new head 489f5c6):
|
There was a problem hiding this comment.
Waiting on one spec decision; the two blockers from the last review are fixed.
Spec decision needed: CodeBlock's copy glyph resolves through the code-block-copy slot, but the clause that allows it, component:CodeBlock FR15, exists only in #10045, so on main the icon slot system spec (AST-087 FR15) still has CodeBlock pick its own icon. Approval needs an engineering owner to approve or amend that FR15 (the glyph, its copy/check fallback, the copied state, what null and a size request do) by commenting /approve-spec <full head SHA> on #10045, and #10045 to land first; the author may do this as an engineering owner. This pull request already implements FR15 as #10045 states it.
busy.tsnow matchesmain, and the description now routes both record edits through #10045, which settles the two earlier blockers.- Built themes refuse slot functions until #9829 lands, so merge the two back to back.
[Automated review]
| size="sm" | ||
| icon={<Icon icon={copied ? 'check' : 'copy'} size="sm" color="inherit" />} | ||
| icon={ | ||
| <ComponentIcon |
There was a problem hiding this comment.
Waiting on one spec decision; nothing else blocks.
Spec decision needed: CodeBlock's copy glyph resolves through the code-block-copy slot, but the clause that allows it, component:CodeBlock FR15, exists only in #10045, so on main the icon slot system spec (AST-087 FR15) still has CodeBlock pick its own icon. Approval needs an engineering owner to approve or amend that FR15 (the glyph, its copy/check fallback, the copied state, what null and a size request do) by commenting /approve-spec <full head SHA> on #10045, and #10045 to land first; the author may do this as an engineering owner. This pull request already implements FR15 as #10045 states it.
- Built themes refuse slot functions until #9829 lands, so merge the two back to back.
[Automated review]
…de-block # Conflicts: # packages/cli/test/__golden__/no-icon-set/search-icon-set.json # packages/cli/test/__golden__/no-icon-set/search-icon-set.txt
There was a problem hiding this comment.
Waiting on one spec decision; nothing else blocks.
- Spec decision needed: CodeBlock's copy glyph now resolves through the
code-block-copyslot (CodeBlock.tsx:1143), but onmainnocomponent:CodeBlockclause adds that slot, so the icon slot system spec (spec:AST-087FR15) still has CodeBlock pick its own icon. The clause that would cover it,component:CodeBlockFR15 in #10045, matches this code: the{copied}state,copythencheckas the fallback,nullhiding only the glyph while the button keeps its size, name, tooltip and copy action, and a requestsizechanging only the glyph. Approval needs an engineering owner to approve or amend that clause by commenting/approve-spec <full head SHA>on #10045 (the author may do so as an engineering owner), and #10045 to land first.
Everything else matches the current icon slot, theme-authoring and theme-compilation records, and the tests and CI pass on this head. Built themes refuse every slot function until #9829 lands, so merge the two back to back.
[Automated review]
There was a problem hiding this comment.
Approved pending CI: CI's required checks have not finished on this head yet. The first run stopped at admission because CI was full, and a re-run is in progress.
CodeBlock's copy slot now has current authority (component:CodeBlock FR15), and the shared slot model, theme normalization and static build output match the icon-slot, theme-authoring and theme-compilation specs. Non-blocking: merge #9829 right after this one so built themes can carry slot functions, and consider dropping the header paragraph in globalIconRegistry.tsx that repeats resolveComponentIcon's JSDoc.
[Automated review]
| * `resolveComponentIcon` is the only caller of a theme's `componentIcons` | ||
| * slot functions. It turns a slot, its state, and the component's own | ||
| * fallback into the request the component renders through `Icon`. |
There was a problem hiding this comment.
Non-blocking (comment style): this paragraph repeats resolveComponentIcon's JSDoc ("This is the only caller of a theme's slot functions"), and the file header now runs 25 lines. The @output and @position lines already name the resolver, so the paragraph can go.
|
Post-merge follow-ups from an exact-head review of
The earlier authority and stack-order blockers are resolved: #10045 landed before this PR, and #9829 landed immediately afterwards. The resolution, inheritance, |
Specified by #10045 (the record PR for the first component icon slots); this PR merges after it.
Stack: #9828 → #9829 (built themes carry slot functions; review and merge as a pair). #9830, #9831, and #9834 each add one slot on top of #9828.
User need
A theme author can replace the artwork behind a shared icon name (
icons), but cannot change which icon one component uses for its own role without changing that name everywhere. For example, a brand that wants a double check for CodeBlock's "copied" feedback must today remapcheckfor every checkbox, menu, and toast. Theme authors need a per-component, per-role mapping that keeps shared names shared, can follow the component's state, and works in built themes too.Problem and solution fit
@astryxdesign/core/Icon):ComponentIconSlotMapis declared in the public module, so augmentation widens it. Also exported:ComponentIconSlotName,ComponentIconRequest,ComponentIconValue,ComponentIconMap, andComponentIconStaticMap.defineTheme({componentIcons}): normalization and inheritance follow the theme-authoring contract.undefinedentry is inherited.theme.componentIconsis the static view: names,null, and static requests. Slots resolved by a function are left out.defineTheme,variantis typed as the theme's listed names.resolveComponentIconis the only caller of slot functions. The client hook isuseComponentIcon, and the internalComponentIconrenderer draws the result.icon,variant, orsizekeeps the component's own value.nullhides the icon; returningundefinedchanges nothing.code-block-copy, with state{copied: boolean}. CodeBlock's copy button resolves through it.copy, andcheckwhile copied.nullhides only the glyph. The button keeps its size, name, tooltip, and copy action.sizechanges only the glyph.theming.componentIcons(slot, role, fallback per state, state fields, whatnulldoes).astryx componentlists slots in full, compact, and brief output.ComponentIconSlotMap, the render sites, and the docs in agreement, and checks each slot's<component-kebab>-<semantic-role>prefix.ERR_THEME_INVALIDbefore anything is written. FR19 allows that, so nothing is silently dropped.Built themes carrying slot functions (traced imports, inline static slots beside them, built, package, and family bases) are in the stacked follow-up #9829. I split them out to keep this PR under the 2,000-authored-line limit.
Current specification
architecture:icon-resolution-and-component-slots: system model, slot precedence, INV1–INV12, the component-local documentation section, change coupling. Its one-sentence baseline update is in spec: record component icon slots in CodeBlock, Timestamp, and Table #10045.architecture:theme-authoring-contract:componentIconsnormalization and inheritance, and the static view.architecture:theme-compilation: item 7 and INV15.spec:AST-087: FR11–FR20.component:CodeBlockFR15 (the copy icon slot), recorded by spec: record component icon slots in CodeBlock, Timestamp, and Table #10045. This PR changes no record;main's record text is unchanged here.Public delta and caller burden
@astryxdesign/core/Icon:ComponentIconSlotMap(augmentable),ComponentIconSlotName,ComponentIconRequest,ComponentIconValue,ComponentIconMap, andComponentIconStaticMap.defineTheme({componentIcons})andDefinedTheme['componentIcons'].componentIcons, CodeBlock drawscopy, thencheck, as before.theming.componentIconson component docs (ComponentIconSlotDoc,ComponentIconSlotStateDocfrom@astryxdesign/cli/authoring).ComponentIconSlotMapgets the types, but resolving its own slots needs a public resolver. That arrives with the first package-owned slot.Design and alternatives
IconName, never to artwork. Artwork stays inicons, so a slot also picks up the theme's variant and size handling. Rejected: slot values as React nodes, which would bypass shared resolution and break built themes.ComponentIconSlotMapis declared in the publicIcon/index.ts, not in an implementation file: augmentation only widens an interface declared in the module consumers name.defineTheme, so an inherited or built theme behaves the same way.code-block-copyfollows<component-kebab>-<semantic-role>.copiedis the state the component already tracks (useClipboard'sisCopied).Evidence
componentIcons.test.tsxcovers precedence, field-by-field requests, slot functions and their state, malformed requests with a single warning, no production warning, the static view, inheritance (undefined inherits, null hides, a request replaces whole), the renderer, and type-level slot, state, and variant checks.componentIconSlots.test.tschecks the slot inventory.CodeBlock.test.tsxcovers the copy slot: the fallback per state,copiedreaching a function,undefinedfor one state, a mapped name in both states,nullhiding only the glyph while copy still works, a size request leaving the button atsm, and an unknown name warning once.build.component-icons.test.mjsruns native Node over built and runtime themes, including a child of a built base and a family build. Both resolve every slot alike and read back the samecomponentIcons. Inline and imported slot functions fail before writing.Scope
Out of scope: other component slots (timestamp-copy, table-sort-indicator, and table-row-expand follow in their own PRs), namespaced keys, status-icon maps, selected-item checks, and raw-SVG icons.
Testing
pnpm vitest run --project ui packages/core/src/Icon packages/core/src/CodeBlock packages/core/src/themepnpm vitest run --project node packages/cli/api/theme packages/cli/clients/cli/lib packages/cli/test/core-doc-quality.test.mjs packages/cli/test/experimental-isolation.test.mjs scripts/check-theme-template.test.mjscd apps/docsite && npx vitest run src/__tests__/theming-doc-projection.test.tspnpm check:knowledge,pnpm review:pre, and the core and CLI typechecks.