Skip to content

Conversation

@aduth
Copy link
Member

@aduth aduth commented Dec 17, 2025

What?

Updates @wordpress/theme to expose TypeScript types for valid design token options, generated automatically from the token JSON files as a source of truth.

Previous discussion:

Why?

  • Internally reinforces conventions around standardizing token naming schema and value options
  • Prevents the very likely possibility of drift caused by human error in how these types were previously maintained (duplicated) in @wordpress/ui, using the actual source of truth.
  • Convenience for external consumers on awareness to available options.

How?

  1. Creates a new custom Terrazzo plugin to generate a TypeScript output file for the types, from the source tokens
  2. Exposes those types from the root @wordpress/theme package export
  3. Updates @wordpress/ui to replace hard-coded, duplicated type unions to use those newly available types

Testing Instructions

Verify there are no TypeScript errors:

npm run build

Visually inspect the contents of packages/theme/src/prebuilt/ts/token-types.ts for accuracy.

@aduth aduth requested a review from jameskoster December 17, 2025 20:18
@aduth aduth requested a review from a team as a code owner December 17, 2025 20:18
@github-actions
Copy link

github-actions bot commented Dec 17, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: aduth <aduth@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions github-actions bot added the [Package] Theme /packages/theme label Dec 17, 2025
@aduth aduth added [Type] Task Issues or PRs that have been broken down into an individual action to take [Package] UI /packages/ui labels Dec 17, 2025
Storybook can't pick it up automatically, likely because of DimensionVariant support.

The numeric values should be removed, as they're no longer supported.

Use `satisfies` to enforce type-checking on valid options.
This can lead to strange results in the case of t-shirt sizing. While the sort order can't always be guaranteed in how the plugin discovers matches across the full set of tokens, it's a better default behavior.
@github-actions
Copy link

Flaky tests detected in d34f8a9.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/20316645477
📝 Reported issues:

Copy link
Member

@mirka mirka left a comment

Choose a reason for hiding this comment

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

Cool, didn't think of this!

Copy link
Member

@jsnajdr jsnajdr left a comment

Choose a reason for hiding this comment

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

Haha nice idea 🙂

@aduth aduth merged commit dae102a into trunk Dec 18, 2025
37 checks passed
@aduth aduth deleted the add/theme-types-plugin branch December 18, 2025 15:17
@github-actions github-actions bot added this to the Gutenberg 22.4 milestone Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Theme /packages/theme [Package] UI /packages/ui [Type] Task Issues or PRs that have been broken down into an individual action to take

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants