Repository navigation
Propose theme-defined Icon capabilities (AST-054) - #6891
rubyycheung wants to merge 13 commits 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.
Thank you for recording this as a focused draft proposal with clear compatibility boundaries.
Approval needs a maintainer decision first, because the proposal intentionally changes established Icon and theming rules and adds new contract surface that has no governing spec yet. A maintainer needs to accept this record as the owner for the broader size, appearance, and weight contract, update the current baseline and closed-size rules it amends, confirm the coordinated changes with the affected theme, icon, API, and Button owners, settle how final helper names are handled, and coordinate the overlapping size-aware draft so the two do not compete.
Record fixes will also be needed before acceptance: move pull-request history and the library survey out of the standing record (keeping only durable facts and conclusions), rewrite proposal narration as present-tense system statements, and add the writing-rubric results to the description. No runtime behavior changes in this pull request, and existing fixed icons and lookups are preserved by the proposal as written.
[Automated review]
|
Aligned with the direction and the added icon behaviors! One thing to highlight to eng owner, this spec allow theme to expand the flow type for icon size (currently xsm, sm, md and lg) and 2 new @cixzhang would love your inputs on this as it's more about core component prop and types. |
d12a0bb to
897f631
Compare
PR Analysis ReportView Storybook for this PR · View Sandbox for this PR
Generated by PR Enrichment workflow | View current CI run |
897f631 to
ff7b044
Compare
There was a problem hiding this comment.
Thank you for narrowing this to one registry-backed variant request and one typed slot resolver with clear compatibility boundaries.
Approval needs a maintainer decision first, because the new variant and resolver contract has no governing specification yet and the variant fallback intentionally departs from the current rule that an extensible axis needs a theme-independent baseline expressed through a public vocabulary map. A maintainer needs to accept this record as the governing specification, decide its eight proposals, settle the final type and overload names and what public theme data exposes for a resolver-valued slot, and update the current baseline, Icon, slot-resolution, and theme records it amends.
No runtime behavior changes in this pull request, and the proposal as written preserves fixed icons, the four sizes, direct component-mode Icons, instance precedence, and existing node-valued reads.
[Automated review]
|
@cixzhang @rubyycheung a thought on Could export interface IconVariantMap {} // themes augment, e.g. { filled: true; outline: true }
export type IconVariant = keyof IconVariantMap & string;
Cindy, I may be misreading "no cross-theme unions". Was it meant to rule out something like this? I'm also curious whether you see |
There was a problem hiding this comment.
Thank you for restoring the complete contract with clear compatibility boundaries for fixed icons, existing sizes, marker-only slots, and current lookups.
Approval needs a maintainer decision first, because the proposal opens new Icon and theme contract surface and intentionally revises current closed-size and component-ownership rules that have no governing acceptance yet. A maintainer needs to accept this record as the governing specification, decide its proposals including the pending adapter, presentation, slot-state, and inventory additions, settle the final exported names and where the generated inventory and checks ship, update the affected theming, Icon, slot, public-API, and theme records, settle the single owner for size-specific artwork selection, and confirm this broad direction in place of the previously directed narrow model together with overlapping slot work.
No runtime behavior changes in this pull request, and the proposal as written preserves existing fixed entries, direct components, shared-name slot mapping, and one-argument reads.
[Automated review]
4aadac4 to
b57c446
Compare
There was a problem hiding this comment.
Thank you for restoring the complete contract with clear compatibility boundaries for fixed icons, existing sizes, marker-only slots, and current lookups.
Approval needs a maintainer decision first, because the proposal opens new Icon and theme contract surface and intentionally revises current closed-size and component-ownership rules that have no governing acceptance yet. A maintainer needs to accept this record as the governing specification, decide its pending adapter, theme-presentation, slot-state, and inheritance and inventory proposals, settle the final exported names and where the generated inventory and checks ship, update the affected theming, Icon, slot, public-API, Button-family, and theme records, settle the single owner for size-specific artwork selection, and confirm this broader direction in place of the previously directed narrower model together with overlapping slot work.
No runtime behavior changes in this pull request, and the proposal as written preserves existing fixed entries, ordinary direct components, shared-name slot mapping, caller source overrides, and one-argument reads.
[Automated review]
There was a problem hiding this comment.
Approval needs a maintainer decision first: this draft adds Icon and theme contract surface that has no governing spec yet (appearance and weight requests, a theme presentation policy, a direct-icon adapter, and a generated inventory), and it intentionally changes current rules that keep Icon sizes closed and keep a component icon slot's size and state with the component. A maintainer needs to identify or accept the governing spec for those additions in place of the earlier, narrower direction, update the existing Icon, slot, theming, and Button-family specs for the intentional changes, decide the four pending decisions and both open API questions, and name the single owner for size-specific icon artwork. Before acceptance, please also fix these record issues:
- State the built-in Icon sizes as their shipped rem values (12–24px only at a 16px root), so they keep scaling with the root font size.
- Explain how
sizeOverridesrelates to the existingicontheme target size styles, which already resize icons. - Keep theme role-size overrides inside the owning control's geometry, as the Button family's size contract requires.
- Name one owner for size-specific entry resolution, describe the private size context without its internal name, and refresh the 671-line figure in the description (the record has 719 lines).
[Automated review]
Decision needed
Adopt the complete AST-054 capability model with four additions:
The formal deciders for DEC-7 through DEC-10 remain pending. Approval to prepare this preview is not recorded as architecture approval.
Simple authoring experience
Component maintainers declare structure once
An icon role is the stable place or purpose of an icon inside a component: a Button leading icon, a SideNav item icon, a Selector selected marker, or an input status icon.
A state is one finite literal condition declared by a role. In this example the
exact literals are selected, pressed, disabled, and loading; other roles may declare
another finite set.
The approved public
ComponentIconSlotMapremains the role-name owner. Its originaltruevalue remains valid, stateless, and nonparticipating. A metadata-bearing valueowns a finite literal state vocabulary. Public
ComponentIconStateNameand themebyStatekeys conditionally derive only from metadata-bearing values. The role'sprecedence contains only its own states and produces at most one effective state. The
component still owns source, transitions, placement, interaction, and accessibility.
Conceptually, with helper and metadata field spelling still under API review:
Existing
{slot: true}augmentations continue to type-check, contribute no statename, and retain only their
componentIconssource mapping. A component opts intorole size and state appearance only through a metadata-bearing value. Its
contract-default path remains pixel-equivalent to its nonparticipating baseline.
Theme authors set one policy
State presentation chooses appearance only—never weight.
byStatekeys conditionallyderive from metadata-bearing role values; a
trueentry contributes none. Final sizeselects the theme's default weight. An explicit
<Icon weight>remains the onlyoverride.
Theme inheritance is settled:
presentation: nullresets to contract/source defaults;nullclears one inherited override.Product icon libraries adapt once
The bound adapter contract joins the application capability set. The adapter receives
only admitted axes it supports. An unsupported axis is omitted so the wrapped
library's declared default applies. An explicit caller appearance/weight mismatch
warns once in development; theme-policy fallback is inspection-only. Malformed mapped
output warns once in development and safely renders the wrapped component without
mapped presentation props.
Ordinary direct components stay fixed. Astryx never spreads presentation data or unknown props onto them or the DOM.
Theme owners review one generated inventory
The declarations generate one visual inventory showing every role's source mode, default/resolved size, state precedence, effective state, appearance, and weight under each theme. The same metadata drives generated types, docs, inspection, runtime, and static builds.
Conformance checks flag undeclared roles/states, shared-path bypasses, hardcoded state appearance, dropped role-size rules, missing inventory coverage, and default-policy pixel changes.
Normative precedence
componentIconsrole mapping and ordinary registry precedence. A metadata-bearing role reports zero or one effective state; atruerole reports none.md. Atruerole has no role-size override. Invalid theme or role-size authoring rejects before use. An untyped unadmitted consumer size is ignored, continues through the remaining cascade, and warns once in development.Dimension application is participation-aware. An admitted explicit
Iconsize and astandalone icon's final
mduse the active theme dimension. An implicit size inside alegacy nonparticipating component keeps its released dimension until that component
declares metadata participation. A participating role uses its final resolved theme
dimension for both the glyph and its component-owned wrapper.
Missing size artwork uses the root branch in the resolved box. Fixed and ordinary
direct sources ignore theme presentation without warning; only an explicit unsupported
caller request warns. Malformed registry entries skip to normal registry precedence.
Adapter failure is separate and safely renders the wrapped default. A missing or
unresolved namespaced key renders nothing through
Icon, returns no node fromgetIcon, and preserves the caller-supplied fallback ingetExtendedIcon.Existing caller-supplied
selectedIconandpressedIconvalues remain source overrides for compatibility. Without one, the normal source remains and theme state appearance supplies the visual state.Exact original-versus-preview checklist
9647aacontractsize,appearance, andweightrequestsxsm,sm,md, andlgdimensionsduotone.trueroles, and themes without capability fields remain byte/pixel compatible; metadata-bearing defaults match the nonparticipating baseline.Iconrenders nothing,getIconreturns no node, andgetExtendedIconuses its caller-supplied fallback.ComponentIconSlotMapvalue remainstrueor carries finite literal states;ComponentIconStateName/byStateconditionally derive only from metadata-bearing entries; one role emits at most one state.trueroles are marked stateless/nonparticipating; metadata-bearing roles receive the complete state/size/presentation review surface and checks.selectedIcon/pressedIconcomponentIconsauthoritytrueand maps roles to anIconNameornull; metadata-bearing values add participation. Under INV8, structural ownership stays component-owned while opted-in roles permit theme default size and one-state appearance.Public library survey moved out of the standing spec
The original research remains useful context but is not normative content:
Durable conclusion retained in the record: contracts support library-owned appearance names, exact or continuous weights, sparse size artwork, and supplied parameterized renderers without SVG mutation.
Related-work map
9647aac855f993and63b11cfIconName. Preserve compatibility.ComponentIconSlotMap,componentIcons,trueslot declarations, role-to-IconName/nullmapping, fallback precedence, and structural ownership. Corrected AST-054 conditionally extends slot values with metadata while keepingtruevalid, and refines INV8 so source/transitions/transforms/placement/color/accessibility stay component-owned while opted-in roles permit theme default size and one-state appearance.trueslot declarations and name/null mapping remain compatibility requirements in the focused replacement stack.The replacement implementation keeps every AST-054 use case but is split for review:
A slice that cannot safely land independently remains stacked and blocked. #7117,
#7122, and #7131 are closed as superseded; their branches and discussion remain as
historical context. Replacement links will be added here as each focused PR opens.
Proposed decisions
ComponentIconSlotMapkeepstrueas stateless/nonparticipating and adds metadata-bearing values; publicComponentIconStateName/byStateconditionally derive only from metadata states; each participating role reports at most one state by declared precedence.Existing DEC-1 through DEC-6 remain, with DEC-4 clarified as structural defaults only.
Open API decisions
Inheritance, role ownership, state precedence, adapter fallback, and participation are no longer open.
Scope and migration
9647aabloba5d6b1152a79a35199299fa12c98d99e081375db(30,570 bytes).{slot: true}augmentations remain valid, stateless, and nonparticipating; no metadata migration is required.selectedIcon,pressedIcon, namespaced keys, andcomponentIconscallsites remain valid.Writing rubric results
R1 narration: project-stage phrases using current/new additive, before adoption,
acceptance requires, and migration language were rewritten as durable compatibility,
ownership, and participation constraints; none remain in the standing record.
R2 research: the public icon-library survey was removed from the standing record and retained above; only its durable capability conclusion remains in DEC-1/DEC-6.
R3 evidence: verification names observable type, runtime, build, browser, inventory, diagnostic, and accessibility facts; no verification cell cites a PR, issue, or commit.
R4 rejected alternatives: each retained rejection is one line inside DEC-1 through DEC-10; comparison and historical alternatives live only in this PR body.
R5 change references: none remain in the standing spec; the related PR/issue/commit map lives only in this PR body.
R6 open questions: OQ1 retains unresolved spelling/module-path choices and OQ2 retains unresolved inventory/tool location; inheritance, role ownership, state precedence, participation, and adapter fallback were settled and removed from open questions.
Validation
node scripts/check-knowledge.mjs: passed (Knowledge templates and records are aligned).vitest run scripts/check-knowledge.test.mjs: 100/100 tests passed. Vite also emitted its existing non-failing SSR warning for the dynamicfile://${file}import in the doc compiler; that unrelated source is unchanged.git diff --no-index --check: passed for both files.trueslot entries still type-check and remain stateless/nonparticipating; the conditional state union excludestrue; invalid consumer-size fallback and invalid theme authoring are distinct; adapter warnings retain caller/theme provenance; all namespaced-key outcomes are present; project-stage narration, amendment narration, and standing change references are absent; both Markdown tables have stable columns; docs: define icon resolution and component slots #5733 records the additive slot-value extension and durable INV8 ownership refinement.