Repository navigation
Conversation
A glyph owned by one component or library gets a namespaced key (numberInput:stepperDown, richtext:bold) rather than a new member of the shared IconName union: adding to the union makes every downstream IconRegistry grow a required key, so a scaffolded theme stops compiling on a patch bump. The registry already resolved those keys; the prop, the hook and defineTheme did not accept them, so the only way to keep Icon's size, color and xstyle was to widen the union. They accept them now. getIconRegistry() still returns built-in names only.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsIcon (@astryxdesign/core) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: 1 accessibility violation(s) found — 1 serious. Icon - 1 issue(s)
Visual RegressionStatus: No visual change across 2 compared shot(s). 34 shot(s) have no baseline yet and were not compared. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
|
Closing because this solves a different problem from the one we need. Namespaced registry keys make app-owned React glyphs typed, but they neither accept URL-backed SVG assets nor tint those external documents. We should design around the URL-backed asset contract rather than land a second |
Component-scoped icons should be themeable without growing the shared
IconNameunion — the ruling on #5466. The registry already resolved namespaced keys; the surfaces a component actually writes did not accept them, so the union was the only route that keptsize/color/xstyle. This is that route.What
<Icon icon>,useIcon, anddefineTheme({icons})now take a namespaced key as well as a built-in name:defaultIconsmay carry a namespaced entry, so a component ships its own fallback where every other default lives.Why not widen
IconNameIconRegistryisRecord<IconName, ReactNode>, so each new member adds a required key to every downstream registry — a CLI-scaffolded theme stops compiling on a patch bump. A namespaced key costs no permanent union surface and no precedent for the 13 other components sharingchevronDown.Not any string
The new type is
`${string}:${string}`, notExtendedIconName. A misspelled built-in name is still a compile error — there's a@ts-expect-errortest holding that.Risk
Additive: three parameter types widen, which is non-breaking.
getIconRegistry()still returns built-in names only — it now skips namespaced keys explicitly instead of relying on none existing, which is what makes a namespaced default indefaultIconssafe.Testing
tsc --noEmitclean on@astryxdesign/core(3 pre-existinglocales/pseudo.jsonerrors aside).Type '"numberInput:stepperDown"' is not assignable to type 'IconName | IconType'at each call site. The tests are the type assertion.vitest run packages/core packages/richtext— 7,901 passed. Two failures (SideNavfocus,Table.perf) are load-sensitive; both pass in isolation and neither touches this code.