Skip to content

feat(Icon): a theme maps a component's own icon role by slot, starting with CodeBlock's copy button - #9828

Merged
imdreamrunner merged 9 commits into
mainfrom
icons/ast087-slots-code-block
Nov 5, 2026
Merged

imdreamrunner merged 9 commits into
mainfrom
icons/ast087-slots-code-block

Conversation

@imdreamrunner

@imdreamrunner imdreamrunner commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

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 remap check for 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

  • Public slot types (@astryxdesign/core/Icon): ComponentIconSlotMap is declared in the public module, so augmentation widens it. Also exported: ComponentIconSlotName, ComponentIconRequest, ComponentIconValue, ComponentIconMap, and ComponentIconStaticMap.
  • defineTheme({componentIcons}): normalization and inheritance follow the theme-authoring contract.
    • An entry replaces the inherited entry for its slot whole; an omitted or undefined entry is inherited.
    • theme.componentIcons is the static view: names, null, and static requests. Slots resolved by a function are left out.
    • Slot functions are kept internally for resolution only.
    • Inside defineTheme, variant is typed as the theme's listed names.
  • One shared resolution: resolveComponentIcon is the only caller of slot functions. The client hook is useComponentIcon, and the internal ComponentIcon renderer draws the result.
    • Precedence: caller content, then the theme slot, then the component's fallback.
    • Requests apply field by field: a missing icon, variant, or size keeps the component's own value.
    • A slot function returning null hides the icon; returning undefined changes nothing.
    • An unknown icon, a variant the active theme does not list, an unsupported size, or a result that is not a request is ignored for that field, with one development-only warning (FR20).
  • First slot, code-block-copy, with state {copied: boolean}. CodeBlock's copy button resolves through it.
    • Fallback: copy, and check while copied.
    • null hides only the glyph. The button keeps its size, name, tooltip, and copy action.
    • A request size changes only the glyph.
  • Slot metadata (FR16):
    • Component docs gain theming.componentIcons (slot, role, fallback per state, state fields, what null does).
    • astryx component lists slots in full, compact, and brief output.
    • The docsite registry projection carries the same fields.
    • A guard test keeps ComponentIconSlotMap, the render sites, and the docs in agreement, and checks each slot's <component-kebab>-<semantic-role> prefix.
  • Theme build: static slot values are written into the built module, so slots resolve the same built and at runtime (INV15, with a built-vs-runtime test). A slot function fails the build with ERR_THEME_INVALID before 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

Public delta and caller burden

  • New public types from @astryxdesign/core/Icon: ComponentIconSlotMap (augmentable), ComponentIconSlotName, ComponentIconRequest, ComponentIconValue, ComponentIconMap, and ComponentIconStaticMap.
  • New theme field: defineTheme({componentIcons}) and DefinedTheme['componentIcons'].
  • Visible default: unchanged. With no componentIcons, CodeBlock draws copy, then check, as before.
  • New doc field: theming.componentIcons on component docs (ComponentIconSlotDoc, ComponentIconSlotStateDoc from @astryxdesign/cli/authoring).
  • Callers who do nothing make no new decisions. A theme author who opts in:
defineTheme({
  name: 'brand',
  componentIcons: {
    'code-block-copy': ({copied}) => ({icon: copied ? 'checkDouble' : 'copy'}),
  },
});
  • The slot resolver stays internal in this PR. A package that augments ComponentIconSlotMap gets the types, but resolving its own slots needs a public resolver. That arrives with the first package-owned slot.

Design and alternatives

  • A slot maps to a shared IconName, never to artwork. Artwork stays in icons, 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.
  • ComponentIconSlotMap is declared in the public Icon/index.ts, not in an implementation file: augmentation only widens an interface declared in the module consumers name.
  • Validation happens at resolution, not in defineTheme, so an inherited or built theme behaves the same way.
  • code-block-copy follows <component-kebab>-<semantic-role>. copied is the state the component already tracks (useClipboard's isCopied).

Evidence

  • Core: componentIcons.test.tsx covers 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.ts checks the slot inventory. CodeBlock.test.tsx covers the copy slot: the fallback per state, copied reaching a function, undefined for one state, a mapped name in both states, null hiding only the glyph while copy still works, a size request leaving the button at sm, and an unknown name warning once.
  • Theme build: build.component-icons.test.mjs runs 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 same componentIcons. Inline and imported slot functions fail before writing.
  • Local suites: core Icon, CodeBlock, and theme (1,967 tests); all theme-build tests; CLI component format, doc quality, theme template, golden docs; the docsite theming projection.

Scope

  • One capability is added.
  • Unrelated fixes, cleanup, and policy changes were removed or split.
  • Consumer docs, focused tests, and migration evidence ship with the feature.
  • Public text and artifacts contain no internal Meta context.

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/theme
  • pnpm 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.mjs
  • cd apps/docsite && npx vitest run src/__tests__/theming-doc-projection.test.ts
  • pnpm check:knowledge, pnpm review:pre, and the core and CLI typechecks.

…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.
@vercel

vercel Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 5, 2026 5:36pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 3, 2026
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 3, 2026
@astracat-bot

astracat-bot Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 5, 2026, 5:48 PM UTC

… 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.
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 53122ca

Storybook · Sandbox · built from this PR's head

Modified components

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

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Waiting on one spec decision; nothing else blocks.

  • Spec approval needed: this pull request adds FR14 to the current component:CodeBlock record, 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 null leaves 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 build refuses 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) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/cli/assets/theme.template.ts Outdated
* 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'})},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@imdreamrunner

Copy link
Copy Markdown
Contributor Author

Addressed the non-blocking notes in 3e836bb:

  • The theme template's componentIcons example is now a static value ('clock'), which this head's theme build carries. feat(cli): built themes keep componentIcons slot functions #9829, which carries slot functions, restores the function example.
  • The icon slot architecture record no longer says no Core slot has shipped. It now points to ComponentIconSlotMap and the owning component's docs as the list of Core slots.
  • The description now opens with Stack: #9828 → #9829, so the two can be judged as a pair.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Waiting on one spec decision; nothing else blocks.

  • Spec approval needed: this pull request adds FR14 to the current component:CodeBlock record, 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 of null leaves 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 build refuses 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 component output; one golden fixture with a theming.componentIcons entry would guard them.
  • packages/core/src/theme/defineTheme.ts line 911: the first comment sentence restates mergeComponentIcons; keep only the reason.

[Automated review]

Comment thread packages/core/src/theme/defineTheme.ts Outdated
iconVariants,
);

// Component icon slots merge by slot. The base's values include its slot

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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."

@imdreamrunner

Copy link
Copy Markdown
Contributor Author

Took the non-blocking notes in d8b606b: component-format.test.mjs now covers the slot rows in full, compact, and brief astryx component output (stateful and stateless slots, and no section without slots). The defineTheme merge comment now states only its reason. #9829's description now opens with Stack: #9828 → #9829 and says to merge it right after this PR.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Waiting on one spec decision; nothing else blocks.

  • Spec approval needed: this pull request adds FR14 to the current component:CodeBlock record, 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 of null leaves 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 build refuses 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

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 main replaced docs/specs/components/CodeBlock/CodeBlock.spec.md with main's file and reverted the sentence in docs/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 covers startLineNumber.
  • The merge's brace-only reformat of internal/interaction-harness/src/busy.ts is unrelated to slots and is the only change that puts this pull request in the pr-interaction-webkit lane, 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]

Comment on lines +1143 to +1148
<ComponentIcon
slot="code-block-copy"
state={{copied}}
fallback={{icon: copied ? 'check' : 'copy', size: 'sm'}}
color="inherit"
/>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +924 to +926
if (f.t >= window.from) {
break;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@imdreamrunner

Copy link
Copy Markdown
Contributor Author

Responding to the review of b9ea752 (new head 489f5c6):

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ts now matches main, 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This matches component:CodeBlock FR15 as #10045 states it (slot, {copied}, copy/check fallback, null hides only the glyph, size changes only the glyph). It gains spec authority once an engineering owner approves that FR15 on #10045 and #10045 lands on main.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Waiting on one spec decision; nothing else blocks.

  • Spec decision needed: CodeBlock's copy glyph now resolves through the code-block-copy slot (CodeBlock.tsx:1143), but on main no component:CodeBlock clause adds that slot, so the icon slot system spec (spec:AST-087 FR15) still has CodeBlock pick its own icon. The clause that would cover it, component:CodeBlock FR15 in #10045, matches this code: the {copied} state, copy then check as the fallback, null hiding only the glyph while the button keeps its size, name, tooltip and copy action, and a request size changing 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]

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]

Comment on lines +24 to +26
* `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`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@imdreamrunner
imdreamrunner merged commit 98efdf1 into main Nov 5, 2026
99 of 105 checks passed
imdreamrunner added a commit that referenced this pull request Nov 5, 2026
main now carries #9828 as one squash commit; this merge keeps main's version
of everything #9828 contained and leaves only this branch's own change:
built themes keep componentIcons slot functions.
imdreamrunner added a commit that referenced this pull request Nov 5, 2026
main now carries #9828 and #9829 as squash commits; this merge keeps main's
version of everything they contained and leaves only this branch's own
change: the timestamp-copy slot.
imdreamrunner added a commit that referenced this pull request Nov 5, 2026
main now carries #9828, #9829, and #9830 as squash commits; this merge keeps
main's version of everything they contained and leaves only this branch's
own change: the table-sort-indicator slot, listed beside timestamp-copy in
the slot map and its type test.
imdreamrunner added a commit that referenced this pull request Nov 5, 2026
main now carries #9828 through #9831 as squash commits; this merge keeps
main's version of everything they contained and leaves only this branch's
own change: the table-row-expand slot, listed beside the other slots in the
slot map, its type test, and Table's componentIcons docs.
@humbertovirtudes

Copy link
Copy Markdown
Contributor

Post-merge follow-ups from an exact-head review of 53122ca6ef6d7cb1302cc7ac3e60925d76097639:

  1. ComponentIconSlotMap publicly tells external packages to augment it, but every supported consumer of that augmentation (resolveComponentIcon, useComponentIcon, and ComponentIcon) remains internal. The focused test crosses that boundary with relative imports. Either expose a supported resolver/renderer before the first package-owned slot, or make the staged limitation explicit in the public JSDoc.
  2. The malformed-value fallback can itself throw: warning text uses JSON.stringify on runtime values in applyComponentIconRequest. A bigint or cyclic value therefore crashes instead of preserving the component fallback with a development warning. Please use a non-throwing formatter and add regression cases.
  3. The focused coverage does not exercise the AST-087 server-render/hydration, nested-theme, theme-switch, or geometry cases. In particular, the {size: 'lg'} assertion checks props reflected into data-size, not whether the glyph overflows the fixed sm copy-button box.
  4. Docsite generation now projects theming.componentIcons, but the component-detail Theming view still renders only targets and variables. Please render the slot metadata or narrow the documented surface to the registry/CLI/MCP outputs that expose it.
  5. The feat(Icon): a theme maps a component's own icon role by slot, starting with CodeBlock's copy button #9828 changeset still says astryx theme build fails on a slot function, while the now-merged feat(cli): built themes keep componentIcons slot functions #9829 carries imported slot functions. Please reconcile the release note so one release does not describe both behaviors.

The earlier authority and stack-order blockers are resolved: #10045 landed before this PR, and #9829 landed immediately afterwards. The resolution, inheritance, null, accessible-name, and static-read paths otherwise looked sound.

This branch was successfully deployed

1 active deployment
Preview — 53122ca6 Deployed Nov 5, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants