Repository navigation
Conversation
Prop/value naming differs across platform implementations for reasons that aren't backed by a shared registry (e.g. Button's `style` option is `fillStyle` in React, `fill-style` as a Web Components attribute). The existing platform-extension mechanism only aliases shared registry terms (states, sizes, variants); this adds a sibling `componentOptions` array scoped to one component's own `options` map, including explicit `platformOnlyValues` so platform-only extras (e.g. Button's React-only `premium`/`genai` variants) are recorded rather than silently mapped to a lookalike. Implements the loader/record support in the Rust reference SDK (ComponentOptionExtensionRecord, TokenGraph.component_option_extensions) and matching conformance fixtures, mirroring the existing PlatformExtensionRecord pattern. Includes grounded example instances for Button on Web Components and React Spectrum, verified against their actual source (Button.ts/Button.types.ts, Button.tsx). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 22df09f The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
Run report for 22df09f8Total time: 2m 6s | Comparison time: 4m 49s | Estimated savings: 2m 42s (56.3% faster)
Expanded report
Changed files |
Contributor
🎨 Token Changes ReportTokens Changed (0)Original Branch: This comment was automatically generated by the token diff tool. 🤖 |
Contributor
🧩 Component Schema Changes ReportNo component schema changes detected.This comment was automatically generated by the component schema diff tool. 🤖 |
- primer.rs: the primer's platform_extensions summary only counted
graph.platform_extensions, silently ignoring componentOptions-only
manifests (reported as "Platform ext.: 0"). Now chains in
"{platform}:{component}.{option}" entries from
graph.component_option_extensions.
- graph.rs: the componentOptions loader didn't validate that the
referenced component/option actually exist, unlike the sibling
extends/termId path — a typo silently produced a dangling alias
instead of failing fast. Now looks up the component in the already-
loaded component catalog and checks the option exists in its
`options` map, erroring loudly on either miss.
- Adds two invalid conformance fixtures exercising the new checks
(unknown component, unknown option on a known component), and a
components/ fragment in the existing valid fixture so it has a real
"button" component with a "style" option to reference.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The componentOptions existence check in platform-extension parsing used !x.is_some() instead of x.is_none(), which clippy -D warnings flags as nonminimal_bool. This was failing the Rust CI job on PR #1483. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
styleoption isfillStylein React, and the reflected HTML attributefill-stylein Web Components). The existingplatform-extension.jsonmechanism only aliases shared registry terms (states, sizes, variants) viaextends/extensions— there was no way to alias a component-specific option.componentOptions[]array (sibling toextends/extensions, validated viaanyOf) scoped to one component's ownoptionsmap:platformProp,platformAttribute(when the JS prop and HTML attribute differ),platformAliases, per-value aliasing (values[]), andplatformOnlyValues[]for platform-only extras that have no canonical/Figma counterpart — recorded explicitly rather than silently mapped to the nearest lookalike.ComponentOptionExtensionRecord+TokenGraph.component_option_extensionsinsdk/core/src/graph.rs, mirroring the existingPlatformExtensionRecordpattern, plus acomponentOptionExtensions.presentconformance-behavior predicate insdk/core/src/lib.rs.Button.ts/Button.types.ts(Spectrum Web Components) andButton.tsx(@react-spectrum/button, S2):web-components-button.jsonandreact-spectrum-button.json. The React instance recordspremium/genaiasplatformOnlyValuessince neither Figma nor Web Components has them.valid/injects-component-option-extension,invalid/component-option-extension-missing-component) and a README table update.Motivation
Working through hooking Figma Code Connect up to spectrum-design-data's component declarations (see #1482) surfaced that per-platform naming drift is real and currently has nowhere durable to live. This gives it a home consistent with the existing platform-manifest extension pattern, rather than hardcoding aliases inside any one downstream tool.
Test plan
cargo test manifest_extensions— all 4 relevant tests pass, including the 2 new fixturescargo test(full suite) — 782 + 10 + 5 tests pass, no regressionsweb-components-states.json(backward compatible)componentOptionsshape before merging🤖 Generated with Claude Code