Skip to content

docs(authority): define static component icon maps - #7117

Closed
rubyycheung wants to merge 1 commit into
mainfrom
agent/component-icons-authority
Closed

rubyycheung wants to merge 1 commit into
mainfrom
agent/component-icons-authority

Conversation

@rubyycheung

@rubyycheung rubyycheung commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Primary intent

Complete the approved static componentIcons contract by assigning its normalization, inheritance, and built-output behavior to the theme owners.

Existing authority

architecture:icon-resolution-and-component-slots already owns the static slot model:

  • ComponentIconSlotMap owns typed slot names;
  • componentIcons[slot] is IconName | null;
  • instance content wins, theme mapping follows, and the component fallback is last;
  • undefined continues fallback and null suppresses the slot.

This amendment adds only the missing theme-authoring and theme-compilation ownership needed to implement that current contract. It is independent of draft AST-054 and does not add resolver functions, state, variant, size, or private request metadata.

Contract amendments

Theme authoring

  • DefineThemeInput.componentIcons accepts the approved static ComponentIconMap.
  • DefinedTheme.componentIcons is public static theme data.
  • Normalization preserves IconName and null, removes undefined, and merges extends per slot.
  • An explicit name or null replaces the inherited entry; an absent/undefined key keeps inheritance or the component fallback.

Theme compilation

  • componentIcons produces no CSS.
  • Built output carries the normalized map with identical keys and values, including null.
  • Runtime and built themes expose the same static map, and children inherit a built base exactly as they inherit a source base.
  • The verification contract is accepted but unshipped until implementation lands.

Compatibility

This is an additive public theme field. Existing themes and builds without componentIcons remain unchanged. Static mappings keep the already-approved slot precedence and null meaning.

Non-goals

  • Implement package or CLI behavior.
  • Add resolver functions, component state, Icon variant/size requests, or AST-054 policy.
  • Change slot names, semantic icon names, registry artwork precedence, or component behavior.

Scope

  • Two current architecture records only.
  • No package source, public exports, generated output, or Changeset.
  • No dependency on draft authority.
  • Public text contains no private operational context.

Writing rubric results

  • R1 narration: none; current behavior and accepted-but-unshipped contract are separated explicitly.
  • R2 research: none.
  • R3 evidence: verification names runtime/build/inheritance fixtures rather than changes.
  • R4 rejected alternatives: none.
  • R5 change references: none.
  • R6 open questions: none.

Validation

  • pnpm exec prettier --check docs/architecture/theme-authoring-contract.md docs/architecture/theme-compilation.md
  • pnpm check:knowledge
  • pnpm exec vitest run scripts/check-knowledge.test.mjs
  • git diff --check
  • independent authority and writing-rubric review

@vercel

vercel Bot commented Oct 7, 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 7, 2026 8:22pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 7, 2026
@astracat-bot

astracat-bot Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 8, 2026, 1:35 AM UTC

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Oct 7, 2026
@rubyycheung
rubyycheung marked this pull request as ready for review October 7, 2026 18:35
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

No new or modified components detected.

Bundle Size Summary

No component packages changed.

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

19 of 436 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 754,077
Selector Indicator Space Bottom Sheet Wide Start neutral light 740,188
Chat Full AI Chat probe light 155,733
Chat Full AI Chat probe dark 155,005
Chat Default neutral dark 33,205
Chat Default neutral light 32,876
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,229
Chat With Attachments probe dark 11,065
SideNav Resizable in AppShell probe light 3,208
Markdown Default probe dark 897
Markdown Default probe light 897
Markdown Default neutral dark 882
Markdown Default neutral light 858
FileInput Default neutral light 44
FileInput Default neutral dark 42

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.

This change looks ready for the theme owners to decide. It completes the existing static componentIcons contract in the two records that already own its open halves: theme authoring takes normalization and per-slot inheritance (explicit names and null replace inherited entries, undefined leaves inheritance or the component fallback in place, and null is preserved), and theme compilation takes built-output preservation (the same keys and values, including null, with no CSS). Both records keep icon authority as the owner of what an entry means, and both state plainly that the field is still unshipped, with the new test rows describing implementation acceptance rather than existing behavior. Existing themes without the field are unaffected. Formatting, knowledge-record validation, and its test suite pass for the changed files.

[Automated review]

@imdreamrunner

imdreamrunner commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

@cixzhang @rubyycheung before I approve this, two questions:

  1. I may be misremembering, but I thought you mentioned this functionality already exists. Themes can already change component icons through namespaced icons keys (numberInput:stepperDown, from Give NumberInput steppers a dedicated icon slot #5466) and indicators. Is shipping theme componentIcons (docs(authority): define static component icon maps #7117/feat(core): add static component icon slots #7122/Keep component icon slots in built themes #7131) still the plan alongside those, or do they already cover what you had in mind?

  2. If we keep componentIcons, theme authors get two ways to change a component's icon:

    • namespaced icons keys for component-owned artwork ('numberInput:stepperDown': <CaretDownFilled />);
    • componentIcons slots for a role that reuses a shared icon name ('selector-selected-option': 'success').

    I can see the reasoning behind the split, but the two use different naming schemes (numberInput:stepperDown vs the slot convention <component-kebab>-<semantic-role>, e.g. selector-selected-option), and a names-only slot can't express a component's own default artwork, so NumberInput could never move over. Is that split intended long-term? Or could componentIcons also accept a React element, so every component-owned icon lives in one place and namespaced keys remain for libraries (e.g. richtext:bold) and compatibility?

    defineTheme({
      componentIcons: {
        'selector-selected-option': 'success',         // reuse shared artwork
        'number-input-step-down': <CaretDownFilled />, // hypothetical slot: component-specific artwork
        'chat-send-button-send': null,                 // hide
      },
    });

    This would change INV3 ("never concrete artwork"), and Keep component icon slots in built themes #7131 currently writes the map out as JSON, so built themes would need to carry element values the way they carry icons. That's why it's easier to decide before feat(core): add static component icon slots #7122 ships.

@rubyycheung

rubyycheung commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor Author

Direction update

This PR is no longer the direction we intend to land as written.

While reviewing the open questions, we found that this proposal solves only one narrow part of the problem: mapping a component icon role to an icon source. It does not cover the complete AST-054 goal. A theme owner needs to use the same theme file to control icon dimensions, appearance, weight by final resolved size, and state appearance across both registered icons and opt-in direct product icon libraries.

The corrected ownership model is:

  • Icon library or registry adapter: describes the artwork and capabilities the library supplies, then maps Astryx choices to that library’s properties or assets.
  • Theme: owns icon size names and dimensions, default appearance, weight by final size, state appearance, and component-role size overrides.
  • Components: own stable icon roles and states, source transitions, placement, and accessibility.
  • Product code: uses icons normally without repeating theme rules.

Compatibility remains important:

  • Existing {slot: true} declarations remain valid.
  • Existing icon names and namespaced keys remain valid.
  • Ordinary direct icon components remain fixed unless they explicitly opt into a typed library adapter.
  • Existing icon, selectedIcon, and pressedIcon APIs remain valid compatibility and source overrides.

#6891 now restores the complete AST-054 specification, and #7116 projects the corresponding authority changes.

To make the replacement easier to review, the implementation is being split into smaller stacked PRs:

  1. #7214 — Core capability engine plus source/built-theme parity;
  2. #7222 — Direct-icon library adapter;
  3. #7219 — Component role/state infrastructure;
  4. #7221 — Apply theme-owned icon styling to the Button family;
  5. grouped component adoption; and
  6. #7223 — Generated inventory, conformance checks, and authoring guidance.

All approved use cases remain unchanged. A split that cannot safely land independently will remain stacked and blocked rather than weakening the contract.

#7117, #7122, and #7131 are now closed as superseded so reviewers do not spend more time on the discarded direction. Their branches and discussion remain available as historical context. Replacement links will be added to #6891 and #7116 as each focused PR opens.

@rubyycheung

Copy link
Copy Markdown
Contributor Author

Closing this PR because the static-only componentIcons direction has been superseded by the corrected AST-054 model in #6891 and its authority projection 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.

@rubyycheung rubyycheung closed this Oct 9, 2026
@github-actions
github-actions Bot deleted the agent/component-icons-authority branch October 9, 2026 06:25

This branch was successfully deployed

1 active deployment
Preview — 7aed9877 Deployed Oct 7, 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. needs:spec-owner-review Current knowledge records await owner approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants