Skip to content

feat(core): add static component icon slots - #7122

Closed
rubyycheung wants to merge 1 commit into
agent/component-icons-authorityfrom
agent/component-icons-core
Closed

rubyycheung wants to merge 1 commit into
agent/component-icons-authorityfrom
agent/component-icons-core

Conversation

@rubyycheung

@rubyycheung rubyycheung commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Primary intent

Implement the approved static componentIcons Core model so themes can map a component-owned slot to a shared semantic icon name or null without changing the shared icon registry.

Stacked on #7117.

Public capability

  • @astryxdesign/core/Icon owns the augmentable ComponentIconSlotMap, ComponentIconSlotName, and ComponentIconMap declarations.
  • With no declared slots, arbitrary keys are rejected rather than being accepted by an empty {} type.
  • Packages augment the public Icon module to declare their slots; this PR deliberately declares no Core slot.
  • DefineThemeInput.componentIcons and DefinedTheme.componentIcons use the static slot map.
  • extends merges mappings per slot: an explicit name or null replaces the base; undefined is absent and preserves inheritance; normalized output contains no undefined and does not mutate inputs.
  • getComponentIconName(slot, fallback, source?) resolves theme mapping → component fallback.
  • getComponentIcon(slot, fallback, source?) then resolves the resulting shared name through the existing theme/global/default icon registry.
  • useComponentIcon(slot, fallback) provides the same behavior from the active theme.
  • null suppresses the slot; an absent mapping uses the component fallback.

Compatibility

Existing themes, semantic icon names, namespaced extension keys, global registration, getIcon, getExtendedIcon, and useIcon retain their behavior. No component begins rendering a new slot in this PR.

Built themes do not yet preserve componentIcons; the current compilation authority records that implementation gap. The shipped docs direct callers that need the map to use the source theme until the build follow-up lands.

Scope and follow-ups

Included:

  • Core public types and exports;
  • theme normalization and inheritance;
  • static slot resolvers and client hook;
  • public theme/Icon docs and generated theme template surface;
  • focused consumer-view type, resolver, hook, inheritance, null, undefined, and no-mutation tests;
  • compatible patch Changesets for Core and CLI docs.

Not included:

  • CLI built-theme preservation or older-Core compatibility behavior;
  • component slot metadata schema;
  • a first Core slot or component migration;
  • AST-054 state, variant, size, function-entry, or private resolver metadata behavior;
  • Selector or ChatSendButton changes.

Writing rubric results

  • R1 narration: one stale “componentIcons is unshipped” paragraph no longer described the implemented theme-authoring system; deleted.
  • R2 research: none.
  • R3 evidence: the current INV13 verification row names the defineTheme merge and extension tests that now exist.
  • R4 rejected alternatives: none added.
  • R5 change references: none in the amended record.
  • R6 open questions: none added to the amended record.

Testing

  • full Core and CLI suites: 756 of 761 files passed (17,196 tests); the 10 failing tests are in CLI build, doctor, template-integration, and project-discovery files this PR does not touch, and all 4 files (173 tests) pass when rerun on their own;
  • focused final run: 39 files, 1,798 tests passed;
  • type-level rejections (undeclared slots, non-IconName map values including JSX and extension keys, and extension-key fallbacks) live in one consumer-view fixture compiled against the public subpaths, rather than being repeated as in-package @ts-expect-error cases;
  • Core typecheck, declaration build, and typecheck:docs;
  • CLI typecheck:template-docs and typecheck:authoring;
  • consumer-view TypeScript fixtures against public source and emitted declarations;
  • strict ESLint on changed source;
  • pnpm check:repo;
  • pnpm check:sync;
  • pnpm check:knowledge;
  • pnpm check:changesets;
  • git diff --check;
  • independent code, API, authority, and docs review.

packages/cli strict typecheck still requires the separately built @astryxdesign/theme-neutral/built fixture in this checkout; the failure is in unchanged template files and is unrelated to this stack.

@vercel

vercel Bot commented Oct 7, 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 Oct 7, 2026 8:23pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 7, 2026
@astracat-bot

astracat-bot Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
📝 Draft — not reviewed automatically (for maintainers only) Oct 7, 2026, 6:33 PM UTC

@astracat-bot

astracat-bot Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
📝 Draft — not reviewed automatically (for maintainers only) Oct 7, 2026, 6:33 PM UTC

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Previews ready: Storybook and Sandbox were built with this PR's docsite. CI evidence will be added when available.

View Storybook for this PR · View Sandbox for 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.

This change adds a clean, well-tested way for themes to retarget one component's icon role without changing that icon everywhere else. Packages can declare their own slots, themes can map a slot to a shared icon or hide it, and child themes inherit those choices slot by slot, while existing themes and icon keys keep working unchanged.

One limitation to keep in mind: themes produced by astryx theme build do not yet carry these mappings, so use the source theme where a slot mapping matters until that follow-up lands. No shipped component uses a slot yet, so there is no visual change today.

[Automated review]

@rubyycheung

Copy link
Copy Markdown
Contributor Author

Closing this PR because its static-only Core implementation follows the superseded #7117 direction.

The corrected AST-054 model is in #6891 and its authority projection is in #7116. The replacement implementation is being split into focused review surfaces for: Core capabilities/build parity, direct-icon adapters, component role/state infrastructure, a Button-family visual proof, and inventory/conformance guidance. This PR remains available as historical context; none of it landed. Replacement links will be added to #6891 and #7116 as each focused PR opens.

This branch was successfully deployed

1 active deployment
Preview — f1eb2f63 Deployed Oct 7, 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.

1 participant