Skip to content

feat(core): add theme-defined Icon capabilities and build parity - #7214

Closed
rubyycheung wants to merge 3 commits into
mainfrom
agent/ast054-core-capability-engine
Closed

rubyycheung wants to merge 3 commits into
mainfrom
agent/ast054-core-capability-engine

Conversation

@rubyycheung

@rubyycheung rubyycheung commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Draft status

This is a focused implementation draft based directly on current main. It is reviewable and runs CI independently from the specification stack, but must not land until the corrected AST-054 specification in #6891 and its authority projection in #7116 are approved.

User need

Theme authors need supplied icon artwork to vary independently by icon size, appearance, and weight without changing every component callsite or leaking library-specific properties onto the DOM.

What this PR implements

  • Immutable, local icon capability contracts.
  • Fixed and adaptive registered icon entries.
  • Independent size, appearance, and weight requests on Icon.
  • Theme-owned canonical icon dimensions and dimension overrides.
  • Theme presentation defaults and per-final-size appearance/weight.
  • Safe source-local fallback through supplied artwork only—no SVG mutation or synthesis.
  • Separate node-valued public reads and private adaptive source data, preserving existing registry APIs.
  • Source-theme, built-theme, extended-built-theme, and family-theme parity in the theme compiler.
  • Local caching and a fixed-icon fast path.

Deliberately excluded

These remain separate focused PRs:

  1. Direct product-icon library adapter.
  2. Component role/state infrastructure, byState, and role-size overrides.
  3. Button-family visual proof and component-owned dynamic boxes.
  4. Generated visual inventory, conformance checks, and broader authoring guidance.

This PR adds no component roles, no state presentation, no Button changes, no inventory product, no public resolver/inspection plumbing, and no ambiguous request-order overload.

Compatibility

  • Existing fixed icon registries and node-valued reads remain valid.
  • Existing registerIcons, getIcon, getExtendedIcon, and useIcon call shapes remain unchanged.
  • Existing themes that omit the new fields preserve their current behavior and pixels.
  • Ordinary direct SVG components remain fixed and do not receive appearance or weight props.
  • Implicit built-in sizes inside nonparticipating legacy component contexts retain released rem geometry.
  • Explicit admitted sizes and standalone md use the active theme dimension.
  • Invalid/unadmitted explicit size behaves as omitted before geometry is chosen.
  • Native SVG role and ARIA behavior remains unchanged.
  • No process-global capability installation or import-order-dependent admission is introduced.

Evidence completed before publication

The equivalent focused implementation commit (14bbfa6673) passed:

  • Core UI: 242/242
  • CLI source/build parity: 328/328 across 21 files
  • Source consumer programs: 5/5
  • Emitted-package consumer programs: 6/6
  • Post-authority-rebase impacted UI: 66/66
  • Core build, declarations, and docs TypeScript
  • Four CLI TypeScript projects
  • Configured changed-source lint with zero findings
  • Formatting, syntax, client-boundary, export, package-boundary, Changeset, knowledge, and diff checks

The code-only restack onto latest main applied without implementation conflicts. GitHub CI on this exact head is the current evidence source for the latest-main integration.

Pending and explicitly not claimed

  • GitHub full CI on this exact head
  • Real-browser execution and screenshots for IconEngine.stories.tsx
  • Optional Node 24 confirmation
  • Broader cross-package and performance matrices
  • Final API, owner, and authority approval
  • The four later focused implementation PRs

Changeset

Patch release for @astryxdesign/core and @astryxdesign/cli: adds the capability engine and preserves its data through theme builds. This draft cannot release until #6891/#7116 are approved.

Review focus

Please review only this boundary:

  • capability contract and adaptive artwork model;
  • fallback and diagnostics;
  • compatibility of existing registry reads and fixed icons;
  • explicit/standalone versus legacy implicit geometry;
  • source/build/extended-build parity;
  • public API minimality.

Adapter, component state, Button adoption, and inventory questions belong to their later PRs.

@vercel

vercel Bot commented Oct 9, 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 9, 2026 3:07am UTC

Request Review

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

astracat-bot Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
❓ Needs maintainer input (for maintainers only) Oct 20, 2026, 4:41 PM UTC

@rubyycheung
rubyycheung force-pushed the agent/ast054-core-capability-engine branch from 14bbfa6 to 724d3f3 Compare October 9, 2026 01:36
@rubyycheung
rubyycheung changed the base branch from agent/ast054-authority to main October 9, 2026 01:36
@github-actions github-actions Bot added the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 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
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 2590 -
Complexity N/A Very High (234) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.9KB 1.2KB

Accessibility Audit

Status: 1 accessibility violation(s) found — 1 serious.

Icon - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/18 stories · Learn more
    • WCAG: 1.4.3 (Level AA)

Visual Regression

23 of 446 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
TableRowExpansion Detail Panel neutral dark 5,129
TableRowExpansion Detail Panel neutral light 4,050
SideNav Resizable in AppShell probe light 3,208
TableGroupedRows Default neutral light 2,133
TableGroupedRows Default neutral dark 2,116
Markdown Default probe dark 897
Markdown Default probe light 897
Markdown Default neutral dark 882

and 3 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.

Approval waits on a maintainer decision: the new Icon appearance and weight requests, custom icon size names, adaptive theme artwork, theme icon dimensions and presentation, nested-theme policy inheritance and their theme-build transport need a maintainer to provide or identify the governing spec (the proposed path is AST-054 in #6891 with its projection in #7116). Whatever that decision, please fix these before this can land:

  • defineTheme({icons}) and registerIcons() now throw Icon: icon entries must contain plain data fields. for a module-namespace registry (import * as icons), which works today, so prepareIconEntries should accept namespaces as before, with regression tests.
  • astryx theme build now fails on a theme that carries componentIcons while runtime defineTheme accepts it, so build and runtime should agree again.
  • At 7,876 authored lines, please split the theme-compiler transport from the runtime contract, or record in the governing spec why they must land together.
  • Please restore the released JSDoc removed from globalIconRegistry.tsx, including the registerIcons and getExtendedIcon examples, since it is unrelated to this change.

[Automated review]

@github-actions
github-actions Bot deleted the agent/ast054-core-capability-engine branch October 23, 2026 06:23

This branch was successfully deployed

1 active deployment
Preview — fd7d3796 Deployed Oct 9, 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:code-review High-risk change (new package/component/API) — needs human code review before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants