Repository navigation
feat(core): add static component icon slots - #7122
rubyycheung wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
AI review status for this pull request.
|
PR Analysis Report
|
a9d9f98 to
2ad5ee9
Compare
658f7b7 to
145c589
Compare
2ad5ee9 to
7aed987
Compare
145c589 to
f1eb2f6
Compare
There was a problem hiding this comment.
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]
|
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. |
Primary intent
Implement the approved static
componentIconsCore model so themes can map a component-owned slot to a shared semantic icon name ornullwithout changing the shared icon registry.Stacked on #7117.
Public capability
@astryxdesign/core/Iconowns the augmentableComponentIconSlotMap,ComponentIconSlotName, andComponentIconMapdeclarations.{}type.DefineThemeInput.componentIconsandDefinedTheme.componentIconsuse the static slot map.extendsmerges mappings per slot: an explicit name ornullreplaces the base;undefinedis absent and preserves inheritance; normalized output contains noundefinedand 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.nullsuppresses the slot; an absent mapping uses the component fallback.Compatibility
Existing themes, semantic icon names, namespaced extension keys, global registration,
getIcon,getExtendedIcon, anduseIconretain 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:
Not included:
Writing rubric results
defineThememerge and extension tests that now exist.Testing
IconNamemap 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-errorcases;typecheck, declaration build, andtypecheck:docs;typecheck:template-docsandtypecheck:authoring;pnpm check:repo;pnpm check:sync;pnpm check:knowledge;pnpm check:changesets;git diff --check;packages/clistrict typecheck still requires the separately built@astryxdesign/theme-neutral/builtfixture in this checkout; the failure is in unchanged template files and is unrelated to this stack.