Repository navigation
spec: define size-aware icon registry entries - #6244
freddymeta 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.
|
There was a problem hiding this comment.
Approval waits on an engineering owner's decision, and the record needs fixes whichever way it goes.
Since this draft was opened, spec:AST-087 (icon variants, theme sizes and component icon slots) became the current spec: a theme icon entry can already be a pure function of {size, variant}, so per-size artwork works today through icons[name]: ({size}) => .... This draft proposes a second, declarative {default, bySize} form, so an engineering owner needs to decide whether Astryx wants it beside AST-087's function entries, as an amendment to AST-087, or whether AST-087 supersedes this proposal. An engineering owner records an approval by commenting /approve-spec <full head SHA> on this pull request, and the author may do so if they are an engineering owner.
Required changes:
- Regression:
spec:AST-034anddocs/specs/AST-034/spec.mdnow belong to the theme family build spec onmain, so this branch conflicts, and renaming only the directory still fails the knowledge check on a duplicate id; move the record to an unused AST id and update its DEC references. - Regression: DEC-1 and the matching non-goal reject the
(size) => ReactNodeentry that AST-087 FR1 and DEC-2 adopted, and FR5 and FR7 (size-less reads returningdefault, and a size input ongetIcon,getExtendedIcon,getIconRegistryanduseIcon) contradict AST-087 FR18 and DEC-7, which read entries atmdand route size throughIcon. - Regression:
schema_version: 1failspnpm check:knowledgeon currentmain, which requires schema version 4 for active system-spec records. - Regression: the Current-state impact section says
mainstores only React nodes and thatIconFromRegistrydrops the size, butmainnow passes{size, variant}to the registry, so the motivation needs to start from AST-087. - Newly live check: the description needs the
docs/contributing/spec-writing.mdrubric results under## Writing rubric results, whicharchitecture:knowledge-contractsrequires for a pull request that adds a record.
[Automated review]
| schema_version: 1 | ||
| template_version: 1 | ||
| kind: system-spec | ||
| id: spec:AST-034 |
There was a problem hiding this comment.
spec:AST-034 and this path now belong to the current theme family build spec on main, so the branch conflicts, and renaming only the directory still fails the knowledge check on a duplicate id. Move the record to an unused AST id and update the DEC references at lines 157, 170 and 183.
| @@ -0,0 +1,200 @@ | |||
| --- | |||
| schema_version: 1 | |||
There was a problem hiding this comment.
Current main requires schema_version: 4 for an active system-spec record; with version 1 pnpm check:knowledge fails (active system-spec records must use latest schema_version 4 for that kind).
| - **FR7 — Public resolvers expose the same optional size input.** `getIcon`, | ||
| `getExtendedIcon`, `getIconRegistry`, and `useIcon` MUST support resolving a | ||
| requested `IconSize` without changing existing calls. Omitted size uses FR5. | ||
| Resolver syntax MUST remain backward-compatible with each released argument | ||
| position. Resolver results remain React nodes, not registry descriptors. |
There was a problem hiding this comment.
spec:AST-087 FR18 and DEC-7 keep public reads at {size: 'md'} and route size through Icon, so a size input on these four resolvers contradicts the current spec. FR5's size-less read returning default differs from it the same way.
| Current `main` stores `ReactNode` values in the shared registry. `IconFromRegistry` | ||
| already knows the effective `IconSize`, but calls `getIcon(name, themeName)` without | ||
| passing it. A theme therefore supplies one static node for every size. Themes backed | ||
| by icon systems with separately authored 12px, 16px, 20px, and 24px assets must pick | ||
| one source for all sizes or compensate inside that node. |
There was a problem hiding this comment.
This describes main before spec:AST-087: Icon now passes {size, variant} to the registry, and an entry can be a function of that request. The motivation needs to start from AST-087.
| Rejected: a render callback such as `(size) => ReactNode`. It permits arbitrary | ||
| render-time behavior, hides fallback completeness, and turns registry data into a | ||
| second component lifecycle. |
There was a problem hiding this comment.
spec:AST-087 DEC-2 adopted exactly this alternative: a theme entry is a node or a pure synchronous function of the final size and optional variant. Rejecting it here reverses a current decision; drop the rejection or propose an explicit amendment to AST-087.
|
Thanks for writing this up. The need here, choosing separately drawn artwork per
AST-087 uses a function rather than a declarative Closing this as covered. If a case isn't served by function entries, please open an issue describing it. |
Summary
Motivation
IconFromRegistryalready knows the effectiveIconSize, but the registry resolves one static React node for every size. Themes backed by icon systems with separately authored 12px, 16px, 20px, and 24px assets cannot select the matching source without CSS or SVG-geometry workarounds.Scope
Spec only. This PR does not change runtime behavior.
Test plan
pnpm check:repo