Skip to content

fix(spec): align w3c-tokens-v2 proposal with DTCG v2025.10 specification - #62

Merged
alexey1312 merged 1 commit into
mainfrom
claude/validate-w3c-tokens-v2-Sb7ga
Feb 24, 2026
Merged

fix(spec): align w3c-tokens-v2 proposal with DTCG v2025.10 specification#62
alexey1312 merged 1 commit into
mainfrom
claude/validate-w3c-tokens-v2-Sb7ga

Conversation

@alexey1312

Copy link
Copy Markdown
Collaborator

Validated all proposal documents against the actual W3C Design Tokens
Community Group v2025.10 specification (Format, Color, and Resolver
modules). Fixed critical format errors and added missing spec features:

  • Color $value: hex strings → structured objects (colorSpace, components,
    alpha, hex) per v2025.10 Color Module
  • Dimension $value: plain numbers → objects with value+unit per spec
  • Typography: fontSize as dimension object, lineHeight as number (ratio),
    fontFamily as string/array format
  • $extensions key: "exfig" → "com.exfig" (reverse-domain notation)
  • Modes: hex strings in modes → color objects in $extensions.com.exfig.modes
  • Added $root, $extends, $deprecated support for tokens-file-source parser
  • Added non-sRGB color space handling, fontWeight string aliases
  • Noted Resolver module as alternative to $extensions modes approach
  • Removed $extensions.exfig.unit (unit is part of dimension $value)
  • Fixed valid $type list (fontStyle still undocumented in spec)

https://claude.ai/code/session_01BwsB119aPMRTX7HrNkxw9C

Validated all proposal documents against the actual W3C Design Tokens
Community Group v2025.10 specification (Format, Color, and Resolver
modules). Fixed critical format errors and added missing spec features:

- Color $value: hex strings → structured objects (colorSpace, components,
  alpha, hex) per v2025.10 Color Module
- Dimension $value: plain numbers → objects with value+unit per spec
- Typography: fontSize as dimension object, lineHeight as number (ratio),
  fontFamily as string/array format
- $extensions key: "exfig" → "com.exfig" (reverse-domain notation)
- Modes: hex strings in modes → color objects in $extensions.com.exfig.modes
- Added $root, $extends, $deprecated support for tokens-file-source parser
- Added non-sRGB color space handling, fontWeight string aliases
- Noted Resolver module as alternative to $extensions modes approach
- Removed $extensions.exfig.unit (unit is part of dimension $value)
- Fixed valid $type list (fontStyle still undocumented in spec)

https://claude.ai/code/session_01BwsB119aPMRTX7HrNkxw9C
@alexey1312
alexey1312 merged commit a932958 into main Feb 24, 2026
1 check failed
@alexey1312
alexey1312 deleted the claude/validate-w3c-tokens-v2-Sb7ga branch February 24, 2026 04:03
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @alexey1312, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly updates the design token handling to fully conform with the W3C Design Tokens Community Group v2025.10 specification. The changes introduce structured data types for colors, dimensions, and typography, enhance extension handling, and expand support for advanced token group features. This ensures greater interoperability with other design token tools and improves the robustness of both token export and import processes.

Highlights

  • W3C DTCG v2025.10 Specification Alignment: The pull request aligns the design token export and import mechanisms with the stable W3C Design Tokens Community Group v2025.10 specification, covering Format, Color, and Resolver modules. This includes adopting structured data types for various token properties.
  • Structured Color Values: Color token $value fields are now structured objects, including colorSpace, components, optional alpha, and a 6-digit hex fallback, replacing plain hex strings. Multi-mode colors are managed via $extensions.com.exfig.modes with similar structured color objects.
  • Dimension and Number Token Types: Dimension tokens now use an object format {"value": N, "unit": "px"} for their $value, where the unit is an integral part of the value. Plain numbers are used for unitless properties like opacity and font weight. The $extensions.exfig.unit field has been removed as units are now embedded.
  • Typography Decomposition and Formatting: Typography tokens are decomposed into individual sub-tokens (fontFamily, fontWeight, fontSize, lineHeight) with specific W3C types and value formats. fontFamily is an array, fontSize is a dimension object, and lineHeight is a plain number (ratio).
  • Standardized Extensions and Asset Handling: Vendor-specific extensions now use the reverse-domain notation $extensions.com.exfig for keys. The invented $type: "asset" has been replaced by storing asset URLs in $extensions.com.exfig.assetUrl to comply with the W3C specification's closed set of $type values.
  • Enhanced Token Group Features: Support for advanced group features from the v2025.10 spec has been added, including $root tokens within groups, $extends for group inheritance (deep merge), and $deprecated flags for tokens and groups.
  • Improved Token Parsing and Validation: The .tokens.json parser has been updated to handle the new structured formats for colors, dimensions, and typography, along with comprehensive validation for malformed input and support for non-sRGB color spaces and fontWeight string aliases.
Changelog
  • openspec/changes/w3c-tokens-v2/design.md
    • Updated the table of divergences to reflect new W3C v2025.10 spec requirements for color values, multi-mode colors, dimension format, and group features.
    • Modified Decision 1 to specify color $value as a structured object and multi-mode colors within $extensions.com.exfig.modes.
    • Updated Decision 2 to change the extension key from exfig to com.exfig for asset references.
    • Revised Decision 4 to define dimension $value as an object {"value": N, "unit": "px"} and added FONT_WEIGHT as a number type.
    • Expanded the TokenGroup struct definition to include $description, $deprecated, $extends, $extensions, and $root fields, along with explanations for these new group features.
  • openspec/changes/w3c-tokens-v2/proposal.md
    • Updated the 'Why' section to explicitly mention the three modules of the v2025.10 spec (Format, Color, Resolver) and detail current divergences.
    • Revised 'Phase 1' changes to specify color $value as a Color Module object, multi-mode support via $extensions.com.exfig.modes, and the use of $extensions.com.exfig for asset URLs and Figma metadata.
    • Updated 'Phase 2' changes to detail dimension type with object $value, number type with plain numeric $value, and the decomposition of typography into sub-tokens with correct v2025.10 types.
    • Added support for v2025.10 group features ($root, $extends, $deprecated) to 'Phase 3' for .tokens.json import.
  • openspec/changes/w3c-tokens-v2/specs/design-tokens-export/spec.md
    • Updated the 'W3C DTCG v2025.10 Color Format' requirement to mandate $value as a structured object with colorSpace, components, alpha, and hex fields, and hex as a 6-digit string.
    • Modified scenarios for single-mode, multi-mode, and alpha transparency colors to reflect the new structured color object format and $extensions.com.exfig.modes.
    • Changed the extension key from exfig to com.exfig in 'Token Extensions with Figma Metadata' requirement and associated scenarios.
    • Clarified that $description must be a plain JSON string per spec.
    • Updated alias scenarios to show primitive token $value as a color object and multi-mode aliases using $extensions.com.exfig.modes.
    • Revised 'No Invented Token Types' requirement to remove fontStyle from valid types (noted as undocumented) and to use $extensions.com.exfig.assetUrl for assets.
    • Updated 'Dimension Tokens' requirement to specify $value as an object {"value": N, "unit": "px"} and removed unit from $extensions.
    • Adjusted 'Number Tokens' to remove LETTER_SPACING from unitless scopes.
    • Modified 'Typography Decomposition' requirement and scenario to specify fontFamily as an array, fontSize as a dimension object, and lineHeight as a plain number (ratio).
  • openspec/changes/w3c-tokens-v2/specs/tokens-file-source/spec.md
    • Updated scenarios for parsing color and typography tokens to reflect the new structured $value formats.
    • Added a new scenario for parsing dimension tokens with the object $value format.
    • Introduced new requirements and scenarios for parsing $deprecated tokens and groups, $root tokens within groups, and $extends for group inheritance.
    • Revised the mapping table for W3C Token Types to ExFigCore Models, detailing the new $value formats for color, typography, dimension, number, fontFamily, and fontWeight.
    • Added new scenarios for mapping color tokens with alpha and non-sRGB color spaces, dimension tokens, fontWeight string aliases, and fontFamily arrays.
    • Updated validation scenarios to include checks for invalid color object structure, missing colorSpace, and invalid dimension object structure.
    • Added a scenario for resolving aliases to $root tokens.
  • openspec/changes/w3c-tokens-v2/tasks.md
    • Updated task 1.1 to specify color $value as a structured object and added task 1.2 for a colorToObject() helper.
    • Revised task 1.3 to use $extensions.com.exfig.modes and added task 1.4 to omit extensions for single-mode colors.
    • Updated task 2.1 and 2.2 to use $extensions.com.exfig (reverse-domain key) for Figma metadata and asset URLs.
    • Modified task 3.3 to support per-mode aliases in $extensions.com.exfig.modes.
    • Updated task 4.1 to replace $type: "asset" with $extensions.com.exfig.assetUrl.
    • Revised task 5.3 to specify dimension $value as an object and removed task 5.4 related to $extensions.exfig.unit.
    • Added task 5.5 to map FONT_WEIGHT scope to number type.
    • Updated task 6.2 to detail correct $type and $value formats for typography sub-tokens, including fontFamily as array, fontSize as dimension object, and lineHeight as number (ratio).
    • Added tasks 6.3 and 6.4 for converting lineHeight to ratio and emitting fontFamily as an array in composite $value.
    • Expanded task 8 for TokensFileSource parser to include parsing color, dimension, and typography $value objects, supporting $root, $extends, $deprecated, handling non-sRGB colors, and mapping fontWeight aliases, along with more detailed validation.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This is an excellent and thorough update to align the design token specification documents with the W3C DTCG v2025.10 standard. The changes are comprehensive and consistent across the design, proposal, spec, and task files. You've clearly paid great attention to the details of the W3C spec, correctly addressing structured color objects, dimension value formats, reverse-domain notation for extensions, and subtle aspects like the lineHeight type and the status of fontStyle. The updated task list provides a clear path for implementation. I have one minor suggestion to further improve the clarity of the design document.

Comment on lines +183 to 185
The dimension `$value` is an object with `value` (number) and `unit` (`"px"` or `"rem"` per spec). Figma variables
don't carry unit information, so ExFig defaults to `"px"`. The number `$value` is a plain JSON number.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While this table correctly maps a standalone LINE_HEIGHT number variable to a dimension token, other parts of the specification (e.g., design-tokens-export/spec.md) state that when decomposing a typography token, its lineHeight property becomes a number token (a unitless ratio). This distinction is subtle and could be a source of confusion for readers of this design document.

To improve clarity, I suggest adding a note here to explicitly state that this mapping applies to standalone number variables, and that lineHeight is treated differently in the context of typography decomposition.

Suggested change
The dimension `$value` is an object with `value` (number) and `unit` (`"px"` or `"rem"` per spec). Figma variables
don't carry unit information, so ExFig defaults to `"px"`. The number `$value` is a plain JSON number.
The dimension `$value` is an object with `value` (number) and `unit` (`"px"` or `"rem"` per spec). Figma variables
don't carry unit information, so ExFig defaults to `"px"`. The number `$value` is a plain JSON number.
*Note: This mapping applies to standalone Figma number variables. When decomposing a composite `typography` token, its `lineHeight` property is exported as a `$type: "number"` token representing a unitless ratio, per the W3C specification for composite typography values.*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants