Skip to content

feat(Icon): request a theme's alternate icon artwork with variant - #8758

Merged
imdreamrunner merged 4 commits into
mainfrom
icons/ast087-icon-variant-prop
Oct 28, 2026
Merged

imdreamrunner merged 4 commits into
mainfrom
icons/ast087-icon-variant-prop

Conversation

@imdreamrunner

@imdreamrunner imdreamrunner commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Follows #8753 (function icon entries) and #8756 (theme icon variant list), both merged; this PR is now based on main.

User need

A product shows the same semantic icon in two looks, for example an outline info normally and a filled one for emphasis or a selected state, and wants the active theme to supply both from its own icon library. With #8753 and #8756 a theme can list outline/filled and map them to artwork, but nothing can ask for a variant yet, so every icon still renders the normal artwork.

The request has to be safe across themes. One app may load several themes that list different names, and a theme an app does not control must still render something sensible when it lacks the requested name. Composition does not cover this: swapping in a different icon component at the call site bypasses the theme entirely, so the theme cannot decide.

Problem and solution fit

  • <Icon variant> (primary). Icon takes variant?: IconVariant. In registry mode, the selected entry receives it.
  • Gating (supporting, FR4). The entry receives the variant only when the active theme lists it and, for a theme-supplied entry, the theme that defined the entry lists it too. An inherited entry keeps its defining theme's list, so it never sees a name it was not written for. Otherwise the entry receives undefined and draws its normal artwork: an omitted variant, an unlisted variant, and no active list all behave this way. A process-wide registration receives the variants the active theme lists. A node entry ignores variant.
  • Artwork only (supporting, FR5). A directly supplied icon component never receives variant, and variant is never written to the DOM. The icon theming target does not reflect it, so it has no styling selector.
  • Built themes keep each inherited entry's defining list (supporting, built/runtime parity). astryx theme build writes the per-entry defining lists (__iconEntryVariants) beside iconVariants as an inheritable field. A defining theme with no list is written as [], because JSON drops undefined. A built child that widens its list then passes an inherited entry only its defining theme's variants, as the runtime theme does.
  • Guard exemption (supporting, architecture:component-theming-surface INV14 change coupling). IconVariantMap now types a component prop, so the extensible-axis guard discovers it. The guard keeps its public-map check and exempts it from the themeProps() reflection and visualProps checks by an explicit artwork-request list. It also asserts the axis stays unreflected.

Current specification

  • spec:AST-087 (current): FR4 (an unlisted variant renders the normal icon; the active-theme and defining-theme lists; process-wide registrations; node entries), FR5 (no variant for supplied components or the DOM; the target does not reflect it), and the defining-list part of FR19 (a built theme passes an inherited entry the same variants as its runtime theme). DEC-1, DEC-9.
  • architecture:theme-compilation INV15 (built icon resolution matches runtime): the inherited-entry defining-list part only.
  • component:Icon (current): FR6 (registry mode passes {size, variant} under those rules; a supplied component never receives variant; no DOM forwarding; no target reflection). The Public concepts row for Variant: names in IconVariantMap; registry glyphs only; default none; unknown names are a type error; unlisted names render normal artwork.
  • architecture:component-theming-surface INV6 and INV14 (Icon.variant is an artwork request with a theme-independent fallback, no themeProps() reflection, and no visualProps entry), plus its change-coupling rule for artwork axes in extensibleAxes.test.ts.
  • architecture:icon-resolution-and-component-slots → Shared icon resolution (a theme-supplied entry, including an inherited one, receives a variant only when its defining theme also lists it).
  • architecture:theme-authoring-contract → System model (an inherited function entry keeps the list of the theme that defined it).

Not in this PR: componentIcons slots and slot requests; FR8 enumeration; FR10 size dimensions; the rest of theme build output (node-valued built public reads, such as the icons export read at {size: 'md'}); and FR20 malformed-output warnings.

Public delta and caller burden

New Icon prop:

// Before: no way to request a theme's alternate artwork.
<Icon icon="info" />

// After (with an application augmentation of IconVariantMap, from #8756):
<Icon icon="info" variant="filled" />   // the active theme's filled artwork, if it lists 'filled'
<Icon icon="info" />                    // unchanged: normal artwork
<Icon icon={MyIcon} variant="filled" /> // MyIcon renders as given; it never receives variant
  • Type: variant?: IconVariant, where IconVariant = keyof IconVariantMap & string. Without an augmentation it is never, so only augmented names type-check.
  • Default: none (the entry receives undefined).
  • Entry contract: a function entry receives {size, variant} when the variant is receivable, otherwise {size}.

Behavior matrix:

Request Theme entry defined by a theme that lists it Inherited entry whose defining theme does not list it registerIcons() entry Node entry Supplied component
listed by the active theme receives it undefined receives it same node never receives it
not listed / no active list / omitted undefined undefined undefined same node never receives it

Unchanged: public reads (getIcon, getExtendedIcon, getIconRegistry, useIcon, theme.icons) still read at {size: 'md'} with no variant. The icon target's data-size/data-color, sizing, color, label semantics, and every Icon without variant render as before.

Caller decisions: a product decides when to request a variant and, to type it, augments IconVariantMap (#8756). It does not need to know which themes list the name: an unlisted request renders the normal icon.

Compatibility: additive. variant was not previously accepted. Existing usages, direct components, and themes without iconVariants behave identically.

Accessibility: no change. variant adds no semantics and does not affect label/aria-*.

Design and alternatives

  • Icon destructures variant, so it never reaches the supplied component or the span's props. It passes {size, variant} to the internal resolver, which selects one source and then decides receivability from the selection: theme entry → the active list and the defining list; process-wide → the active list; built-in default → none.
  • defineTheme records, for each inherited function entry, its defining theme's list only where that differs from the theme's own list (an internal field). An entry the theme defines uses the theme's own list. A list-less theme, or a child that inherits its base's list unchanged, records nothing. The record carries through several levels of extends.
  • Rejected by the spec: passing an unlisted name through to the entry, falling back to another source for a listed name, variants for directly supplied components, and reflecting variant as a styling selector (FR4, FR5, component-theming-surface INV14).

Evidence

  • Icon.test.tsx (new variant suite): listed ({size: 'sm', variant: 'filled'} reaches the entry); omitted; unlisted (the INV14 focused fallback test renders an unlisted name); no active list; an inherited entry under a child that widened the list (filled → normal artwork, outline passes, the child's own entry gets filled); an inherited entry under a child that narrowed the list, and under a child that inherited it; process-wide registration under a listing theme, a non-listing theme, and no theme; node entries; a supplied component receives no variant prop; neither render mode writes variant/data-variant to the DOM; @ts-expect-error for a name not in IconVariantMap.

  • globalIconRegistry.test.tsx: resolver gating for theme, process-wide, and built-in default entries; the defining list kept through two extends levels; public reads never pass a variant even when listed.

  • extensibleAxes.test.ts: Icon.variant (IconVariantMap) keeps the augmentable-index check; it is exempt from the reflection and visualProps checks; the exemption list matches discovered axes; the artwork axis is asserted unreflected and undocumented as a visual prop.

  • packages/cli/test/experimental-isolation.test.mjs: 34/34 with goldens regenerated for the requesting-a-variant prose in astryx docs icons.

  • build.icon-entry-variants.test.mjs (INV15 fixture) builds a base theme listing outline with a function entry, and a child widening the list to outline and filled. It renders <Icon variant> under the built and runtime children in a native ESM load: both pass outline and draw normal artwork for filled. A list-less base under a child listing filled passes no variant either way. The first assertion fails without the serialized field, the second without the []. All packages/cli/api/theme/build suites pass (269).

  • packages/native/src/contract/contracts.test.ts: the native contract generator keeps variant on the web, because IconVariant has no portable definition yet. Icon's web-only list is now variant and xstyle, each with its reason. No generated Swift changes.

Native support for variant is not part of AST-087 and is not added here.

Scope

  • One capability is added.
  • Unrelated fixes, cleanup, and policy changes were removed or split.
  • Consumer docs, focused tests, and migration evidence ship with the feature.
  • Public text and artifacts contain no internal Meta context.

Testing

  • pnpm vitest run packages/core/src/Icon packages/core/src/theme: 1698 passed.
  • pnpm vitest run packages/cli/api/component packages/cli/api/docs: 259 passed. pnpm vitest run packages/cli/api/api-docs-parse.test.mjs packages/cli/api/discover packages/cli/api/icon packages/core/src/theme/themingTargets.test.ts: 810 passed.
  • pnpm vitest run packages/core/src: 14474 passed. Of the failures, postinstall.test.mjs and the Markdown.fr23.perf.test.ts timing tests also fail on clean main here. The Table.perf render budgets fail only under parallel full-suite load and pass when the file runs alone (12/12). pnpm vitest run packages/lab/src/Comments packages/richtext/src (consumers of getExtendedIcon): 665 passed.
  • pnpm -F @astryxdesign/core typecheck (including typecheck:docs): clean.
  • eslint on changed files: 0 errors, 0 warnings. prettier --check on changed TS/TSX/MD files: clean.
  • pnpm check:repo (pre-commit hook): passes. node scripts/check-changesets.mjs: passes.
  • Not included: real-browser screenshots. This PR changes which node an entry returns, not layout or styling, and the jsdom render tests above assert the rendered node and DOM attributes for each state. The spec's browser matrix (theme switching, nested themes, hydration) is not run here.

@vercel

vercel Bot commented Oct 27, 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 28, 2026 4:58am UTC

Request Review

@astracat-bot

astracat-bot Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 28, 2026, 5:17 AM UTC

@imdreamrunner
imdreamrunner marked this pull request as ready for review October 27, 2026 22:54
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 27, 2026
@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

Modified Components

Icon (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Entry File (ESM) 1.5KB 1.5KB 0B
Lines of Code 667 700 -
Complexity High Very High (35) -

Component Size

Component Import before Import after Delta CSS before CSS after Delta
charts/Chart N/A 64.2KB N/A N/A 20B N/A
core/AppShell 58.4KB 58.5KB +157B 11.8KB 11.8KB 0B
core/Banner 48.3KB 48.5KB +152B 10.1KB 10.1KB 0B
core/BaseTypeahead 54.8KB 55.0KB +151B 10.1KB 10.1KB 0B
core/BreadcrumbItem 66.9KB 67.0KB +171B 11.2KB 11.2KB 0B
core/Calendar 55.4KB 55.6KB +175B 10.2KB 10.2KB 0B
core/Carousel 50.7KB 50.9KB +177B 10.3KB 10.3KB 0B
core/ChatComposer 61.2KB 61.3KB +155B 11.0KB 11.0KB 0B
core/ChatDictationButton 47.0KB 47.2KB +151B 9.6KB 9.6KB 0B
core/ChatLayout 49.3KB 49.5KB +160B 10.1KB 10.1KB 0B
core/ChatLayoutScrollButton 46.9KB 47.0KB +152B 9.7KB 9.7KB 0B
core/ChatMessageMetadata 26.3KB 26.4KB +137B 4.0KB 4.0KB 0B
core/ChatSendButton 46.2KB 46.4KB +154B 9.3KB 9.3KB 0B
core/ChatToolCalls 32.3KB 32.4KB +155B 9.1KB 9.1KB 0B
core/CheckIndicator 9.0KB 9.2KB +164B 3.7KB 3.7KB 0B
core/CheckboxInput 50.4KB 50.5KB +157B 9.5KB 9.5KB 0B
core/CheckboxList 46.5KB 46.6KB +151B 8.3KB 8.3KB 0B
core/CheckboxListItem 54.5KB 54.7KB +160B 10.6KB 10.6KB 0B
core/Citation 26.4KB 26.5KB +172B 4.3KB 4.3KB 0B
core/CodeBlock 61.0KB 61.2KB +141B 10.8KB 10.8KB 0B
core/Collapsible 17.0KB 17.2KB +165B 4.4KB 4.4KB 0B
core/CommandPalette 51.4KB 51.5KB +130B 12.0KB 12.0KB 0B
core/CommandPaletteInput 32.8KB 32.9KB +154B 8.3KB 8.3KB 0B
core/ComplexSelector 56.3KB 56.5KB +151B 10.8KB 10.8KB 0B
core/ContextMenu 75.1KB 75.3KB +168B 14.8KB 14.8KB 0B
core/ContextMenuItem 53.4KB 53.5KB +157B 9.8KB 9.8KB 0B
core/DateInput 100.0KB 100.2KB +173B 14.9KB 14.9KB 0B
core/DateRangeInput 69.9KB 70.1KB +177B 11.4KB 11.4KB 0B
core/DateTimeInput 110.3KB 110.4KB +177B 15.4KB 15.4KB 0B
core/DialogHeader 49.3KB 49.5KB +159B 10.0KB 10.0KB 0B
core/DrawerHeader 49.4KB 49.6KB +163B 11.4KB 11.4KB 0B
core/DropdownMenu 73.2KB 73.4KB +145B 15.0KB 15.0KB 0B
core/DropdownMenuCheckboxItem 16.2KB 16.4KB +179B 5.7KB 5.7KB 0B
core/DropdownMenuItem 15.5KB 15.6KB +184B 5.3KB 5.3KB 0B
core/DropdownMenuRadioItem 16.3KB 16.4KB +175B 5.7KB 5.7KB 0B
core/DropdownMenuSubMenu 58.5KB 58.7KB +174B 9.7KB 9.7KB 0B
core/Field 44.7KB 44.8KB +155B 8.1KB 8.1KB 0B
core/FieldLabel 40.2KB 40.3KB +144B 6.7KB 6.7KB 0B
core/FieldStatus 10.4KB 10.6KB +153B 4.4KB 4.4KB 0B
core/FileInput 54.6KB 54.8KB +170B 10.5KB 10.5KB 0B
core/Icon 8.8KB 9.0KB +157B 3.7KB 3.7KB 0B
core/InputGroup 45.3KB 45.4KB +157B 8.2KB 8.2KB 0B
core/LayerProvider 63.9KB 64.0KB +158B 10.3KB 10.3KB 0B
core/Lightbox 51.7KB 51.9KB +154B 10.0KB 10.0KB 0B
core/Link 43.9KB 44.1KB +154B 7.7KB 7.7KB 0B
core/ListItem 54.0KB 54.1KB +163B 10.6KB 10.6KB 0B
core/Markdown 144.9KB 145.0KB +154B 17.6KB 17.6KB 0B
core/MobileNav 51.5KB 51.7KB +149B 10.2KB 10.2KB 0B
core/MobileNavToggle 46.7KB 46.9KB +155B 9.6KB 9.6KB 0B
core/MoreMenu 73.6KB 73.7KB +147B 15.0KB 15.0KB 0B
core/MultiSelector 73.4KB 73.6KB +166B 14.8KB 14.8KB 0B
core/NumberInput 56.2KB 56.4KB +158B 10.9KB 10.9KB 0B
core/Overlay 19.5KB 19.5KB 0B 3.8KB 3.8KB 0B
core/Pagination 85.3KB 85.5KB +150B 15.5KB 15.5KB 0B
core/PowerSearch 164.8KB 165.0KB +166B 20.1KB 20.1KB 0B
core/RadioList 46.0KB 46.2KB +158B 8.2KB 8.2KB 0B
core/RadioListItem 52.7KB 52.8KB +165B 9.8KB 9.8KB 0B
core/Selector 76.9KB 77.0KB +179B 15.2KB 15.2KB 0B
core/SelectorOption 14.5KB 14.7KB +167B 5.2KB 5.2KB 0B
core/SideNav 58.5KB 58.7KB +149B 10.7KB 10.7KB 0B
core/SideNavCollapseButton 47.2KB 47.3KB +138B 9.6KB 9.6KB 0B
core/SideNavHeading 55.2KB 55.4KB +149B 10.3KB 10.3KB 0B
core/SideNavItem 55.0KB 55.1KB +143B 10.3KB 10.3KB 0B
core/Slider 48.9KB 49.0KB +150B 8.7KB 8.7KB 0B
core/Step 32.9KB 33.0KB +157B 5.5KB 5.5KB 0B
core/Stepper 47.9KB 48.1KB +156B 9.7KB 9.7KB 0B
core/Switch 48.8KB 49.0KB +158B 9.5KB 9.5KB 0B
core/TabList 40.5KB 40.6KB +158B 7.3KB 7.3KB 0B
core/TabMenu 52.1KB 52.3KB +151B 10.2KB 10.2KB 0B
core/Table 84.4KB 84.5KB +169B 15.3KB 15.3KB 0B
core/TableCell 76.2KB 76.3KB +157B 15.1KB 15.1KB 0B
core/TableHeaderCell 75.9KB 76.1KB +165B 15.0KB 15.0KB 0B
core/TextArea 49.8KB 50.0KB +150B 9.5KB 9.5KB 0B
core/TextInput 54.1KB 54.2KB +152B 10.6KB 10.6KB 0B
core/Thumbnail 51.2KB 51.4KB +156B 11.1KB 11.1KB 0B
core/TimeInput 87.3KB 87.5KB +171B 13.9KB 13.9KB 0B
core/Timestamp 27.9KB 27.9KB +1B 9.7KB 9.7KB 0B
core/Toast 60.4KB 60.6KB +148B 9.9KB 9.9KB 0B
core/Token 30.0KB 30.2KB +158B 4.6KB 4.6KB 0B
core/Tokenizer 69.1KB 69.3KB +173B 16.7KB 16.7KB 0B
core/TopNav 52.4KB 52.5KB +153B 10.5KB 10.5KB 0B
core/TopNavHeading 54.7KB 54.8KB +139B 10.1KB 10.1KB 0B
core/TopNavMegaMenu 54.7KB 54.9KB +157B 11.0KB 11.0KB 0B
core/TopNavMenu 54.1KB 54.3KB +147B 10.3KB 10.3KB 0B
core/TreeList 38.7KB 38.8KB +151B 4.8KB 4.8KB 0B
core/Typeahead 62.0KB 62.2KB +168B 11.4KB 11.4KB 0B
lab/ChatEmojiPicker N/A 65.8KB N/A N/A 773B N/A
lab/ChatReactionBar N/A 66.3KB N/A N/A 1.1KB N/A
lab/CommentComposer N/A 94.7KB N/A N/A 1.9KB N/A
lab/CommentPin N/A 48.0KB N/A N/A 1.2KB N/A
lab/CommentThread N/A 216.6KB N/A N/A 2.4KB N/A
lab/Comments N/A 221.2KB N/A N/A 2.5KB N/A
lab/DiffViewer N/A 46.2KB N/A N/A 2.1KB N/A
lab/EmojiPicker N/A 63.6KB N/A N/A 722B N/A
lab/InfoTip N/A 21.9KB N/A N/A 458B N/A
lab/ListInput N/A 75.9KB N/A N/A 1.6KB N/A
lab/MobilePowerSearch N/A 147.2KB N/A N/A 1.4KB N/A
lab/MobileTokenizer N/A 92.8KB N/A N/A 809B N/A
lab/Schedule N/A 60.4KB N/A N/A 3.9KB N/A
lab/TransferList N/A 67.5KB N/A N/A 1.7KB N/A
lab/TransferListSelector N/A 73.0KB N/A N/A 1.9KB N/A
richtext/RichTextEditor N/A 271.4KB N/A N/A 2.6KB N/A
richtext/RichTextEditorToolbar N/A 213.0KB N/A N/A 454B N/A
richtext/RichTextView N/A 251.8KB N/A N/A 2.3KB N/A

Sizes are gzip. Import counts the JavaScript the import loads eagerly; CSS counts the package stylesheet rules referenced by the modules it can load from its own package, lazily loaded ones included.

Bundle Size Summary

Gzip figures measure each package's entry file, not the code an import pulls in.

Package Entry (ESM) Entry gzip before Entry gzip after Delta
@astryxdesign/core 4.9KB 1.2KB 1.2KB 0B
Package stylesheet Gzip before Gzip after Delta
@astryxdesign/core 35.1KB 35.1KB 0B

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

57 of 506 shot(s) changed.

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
Selector Indicator Space Bottom Sheet Narrow End RTL neutral light 753,933
Selector Indicator Space Bottom Sheet Wide Start neutral light 740,072
RichTextEditor Markdown parity: side by side probe dark 558,840
RichTextEditor Markdown parity: side by side probe light 540,756
Chat Full AI Chat probe light 230,823
Chat Full AI Chat probe dark 229,805
AppShell With Mobile Nav probe light 217,010
AppShell With Mobile Nav probe dark 216,960
Collapsible Dividers probe dark 66,445
Collapsible Dividers probe light 66,445
AppShell Playground neutral dark 65,198
AppShell Playground neutral light 63,788
Chat Default neutral dark 36,304
Chat Default neutral light 35,767
Chat Empty State probe light 23,531
Chat Empty State probe dark 22,622
ChatAutoScroll Scroll Behavior Comparison neutral dark 15,378
ChatAutoScroll Scroll Behavior Comparison neutral light 14,107
Chat With Attachments probe light 13,406
Chat With Attachments probe dark 11,232

and 37 more.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@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.

Recommending approval: <Icon variant> follows AST-087 FR3-FR5 and the Icon contract's FR6, and the new tests cover listed, unlisted, inherited, process-wide and supplied-component requests. Nothing needs to change in this pull request; it can merge once #8753 and #8756 have landed. One follow-up for the stack: built themes do not carry iconVariants yet, so a theme used through astryx theme build output draws the normal artwork for every variant until the build carries the list and each inherited entry's defining list.

[Automated review]

@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.

Recommending approval: <Icon variant> follows AST-087 FR3-FR5 and the Icon contract's FR6, and the new tests cover listed, unlisted, inherited, process-wide, node and supplied-component requests. Nothing needs to change in this pull request; it can merge once #8756 has landed. One follow-up for the stack: built themes do not carry iconVariants yet, so a theme used through astryx theme build output draws the normal artwork for every variant until the build carries the list and each inherited entry's defining list.

[Automated review]

@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.

Recommending approval: <Icon variant> follows AST-087 FR3-FR5 and the Icon contract's FR6, and the new tests, which fail without the change, cover listed, unlisted, inherited, process-wide, node and supplied-component requests. Nothing needs to change in this pull request; it can merge once #8756 has landed. One follow-up for the stack: built themes do not carry iconVariants yet, so a theme used through astryx theme build output draws the normal artwork for every variant until the build carries the list and each inherited entry's defining list.

[Automated review]

@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.

Requesting changes: <Icon variant> and its runtime gating follow AST-087 FR3-FR5 and the Icon contract's FR6, but a theme built with astryx theme build loses each inherited entry's defining variant list. Now that the built module carries iconVariants, a built child that widens the list hands an inherited entry a variant its defining theme never listed (a base that lists only outline draws its filled artwork), while the runtime theme withholds it, against AST-087 FR4 and FR19 and theme-compilation INV15. Please write __iconEntryVariants into the built module beside iconVariants (storing a defining theme with no list as [], since JSON drops undefined) and add a CLI build test that compares built and runtime resolution for an inherited entry under a replaced list.

[Automated review]

* variants its defining theme lists. Only Astryx icon resolution reads it.
* @internal
*/
__iconEntryVariants?: Record<string, ReadonlyArray<string> | undefined>;

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.

astryx theme build does not write this record: generateBuiltModule's inheritableFields (packages/cli/api/theme/build/build.mjs:2153-2178) now writes iconVariants but not __iconEntryVariants, so a built child that widens its list hands an inherited function entry variants its defining theme never listed, and a theme extending the built child does the same (AST-087 FR4 and FR19, theme-compilation INV15). Writing it there needs a JSON-safe value for a defining theme with no list: JSON.stringify drops undefined, which falls back to the active list, while recording [] (line 829) gates the same way.

Icon takes an optional variant (an IconVariant name). In registry mode,
the selected entry receives the requested variant only when the active
theme lists it and, for a theme-supplied entry, the theme that defined
the entry lists it too: an inherited function entry keeps its defining
theme's list. Otherwise the entry receives undefined and draws its
normal artwork. A process-wide registration receives the variants the
active theme lists; node entries ignore variant.

A directly supplied icon component never receives variant, and variant
is never written to the DOM. It selects artwork only, so the icon
theming target does not reflect it; the extensible-axis guard exempts
IconVariantMap from the themeProps reflection and visualProps checks
and asserts it stays unreflected.

Implements spec:AST-087 FR4 and FR5, component:Icon FR6.
The icons topic gains the requesting-a-variant prose; the guard's
artwork-request list now names the theme build's matching list.
@imdreamrunner
imdreamrunner force-pushed the icons/ast087-icon-variant-prop branch from 1d7ff90 to be4de55 Compare October 28, 2026 04:02
@imdreamrunner
imdreamrunner changed the base branch from icons/ast087-icon-variants to main October 28, 2026 04:02
Icon.doc.mjs now documents variant (IconVariant). The native contract
generator keeps a prop whose type has no portable definition on the web,
so Icon's web-only list is variant and xstyle; the contract test now
names both with their reasons.

@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.

Requesting changes: <Icon variant> and its runtime gating follow AST-087 FR3-FR5 and the Icon contract's FR6, but a theme built with astryx theme build loses each inherited entry's defining variant list. The built module carries iconVariants but not the new __iconEntryVariants, so a built child that widens its list hands an inherited entry a variant its defining theme never listed (a base that lists only outline draws its filled artwork) while the runtime theme withholds it, against AST-087 FR4 and FR19 and theme-compilation INV15. Please write __iconEntryVariants into the built module beside iconVariants (recording a defining theme with no list as [], since JSON drops undefined) and add the INV15 build fixture that compares built and runtime resolution for an inherited entry under a replaced list.

[Automated review]

@imdreamrunner

Copy link
Copy Markdown
Contributor Author

Not adding __iconEntryVariants to built output in this PR. The owner's scope decision for this stack limits theme-build work to the one iconVariants field (merged in #8756). Carrying function entries and their per-entry defining lists into built modules, and the INV15 fixture comparing built and runtime resolution, belong to the later theme-build change. This PR implements the runtime request and gating (spec:AST-087 FR4, FR5; component:Icon FR6). The gap you describe is real: a built child that widens its list hands an inherited function entry a variant its defining theme does not list, while the runtime theme withholds it. I have reported it to the owner for a decision.

…riant list

theme build wrote iconVariants but not __iconEntryVariants, so a built
child that widens its list passed an inherited function entry a variant
its defining theme never listed, while the runtime theme withheld it.
The built module now carries the per-entry lists as an inheritable field,
a defining theme with no list written as [] (JSON drops undefined), so
built and runtime themes pass an inherited entry the same variants
(spec:AST-087 FR4, FR19; architecture:theme-compilation INV15).
@imdreamrunner

Copy link
Copy Markdown
Contributor Author

Added in adf6421, for parity between built and runtime themes. The owner revised the scope for this one field. astryx theme build now writes __iconEntryVariants beside iconVariants as an inheritable field, with a defining theme that has no list written as []. The new build.icon-entry-variants.test.mjs builds a base theme (lists outline, with a function entry) and a child that widens the list to outline and filled. It renders <Icon variant> under the built child and the runtime child in a native ESM load. Both give the inherited entry outline and normal artwork for filled. A second pair (base with no list, child listing filled) passes no variant either way. Each assertion fails without the change: the first without the field, the second without the []. Still out of scope here and left for the later theme-build change: node-valued built public reads (the icons export read at {size: 'md'}) and FR8 request enumeration.

@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.

Recommending approval: <Icon variant> follows AST-087 FR3-FR5 and the Icon contract's FR6, and astryx theme build now writes each inherited entry's defining variant list, so a built theme resolves variants exactly as its runtime theme does (AST-087 FR19, theme-compilation INV15). The new build fixture covers an inherited entry under a widened list and under a list-less base, and it fails without the change. Nothing else needs to change in this pull request.

[Automated review]

@imdreamrunner
imdreamrunner merged commit 33645a2 into main Oct 28, 2026
76 checks passed
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 28, 2026
The search golden for "icon set" counted 370 on both sides: main's icon
variants section (meta#8756, meta#8758) and this pull request's keyboard section
each moved it from 369, so the merge kept 370 with no conflict while the
merged docs return 371. Regenerated with the test's --update.
@github-actions
github-actions Bot deleted the icons/ast087-icon-variant-prop branch October 28, 2026 06:17
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 28, 2026
Main's icon changes (meta#8753, meta#8756, meta#8758, meta#8759) moved the `icon set` search
golden. Regenerated with `vitest run
packages/cli/test/experimental-isolation.test.mjs --update`: only the two
count lines differ from main.
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 28, 2026
The no-icon-set search goldens conflicted: main's icon variants (meta#8756,
meta#8758) and the keyboard section this branch carries from meta#8559 both moved
the "icon set" count. Regenerated with the test's --update.
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 28, 2026
The no-icon-set search goldens conflicted: main's icon variants (meta#8756,
meta#8758) and the keyboard section this branch carries from meta#8559 both moved
the "icon set" count. Regenerated with the test's --update.
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 28, 2026
The no-icon-set search goldens conflicted: main's icon variants (meta#8756,
meta#8758) and the keyboard section this branch carries from meta#8559 both moved
the "icon set" count. Regenerated with the test's --update.

This branch was successfully deployed

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