Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/review-routing/design-system-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
team: WordPress/gutenberg-components
---

Does this change add or change a public API of the design system packages `@wordpress/components`, `@wordpress/ui`, `@wordpress/theme`, `@wordpress/base-styles` or `@wordpress/icons`? A public API is a member that these packages export, such as a component, a prop, an icon, a Sass mixin or a design token. Answer no when the change only updates dependencies, tooling, tests, types or build configuration, or only changes the internal implementation or styles of a component.
Does this change add, change or remove a contract that the design system packages `@wordpress/components`, `@wordpress/ui`, `@wordpress/theme`, `@wordpress/base-styles` or `@wordpress/icons` must keep supporting for their consumers, such as an exported component, a prop, an icon, a Sass mixin or a design token? Answer no when the change only affects internal details that consumers cannot depend on.
5 changes: 5 additions & 0 deletions .github/review-routing/design-system-maintenance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
team: WordPress/gutenberg-components
---

Does this change how a component, a design token or a Sass mixin of the design system packages `@wordpress/components`, `@wordpress/ui`, `@wordpress/theme`, `@wordpress/base-styles` or `@wordpress/icons` looks or behaves for the people who use it, for example its styles, its interactions or its accessibility? Only changes to these packages count, not changes to application code that uses them. Answer no when what people see and do stays the same, such as for a refactor, or for a change to dependencies, tooling, tests, types or build configuration that keeps the same runtime behavior.
2 changes: 1 addition & 1 deletion .github/review-routing/design-system-migration.md

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.

Should we consider a DS migration also migrating CSS from / to WPDS tokens, or using ThemeProvider from the theme package?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

There's a separate routing configuration specifically for tokens design-system-tokens.md, which should cover how new code uses design tokens.

That being said, there are some opportunities:

  • Your observation could reflect how having these specified in separate documents can be confused for us as maintainers. There's nothing to say it has to be one or many documents, and the current approach came from a reflection after initially having one document for everything. But there might also be some middle-ground, like "migration" encompassing both components and tokens.
  • The tokens document doesn't mention anything about ThemeProvider. I tested this locally with some revised phrasing†, but specifically calling out ThemeProvider can also water down the targetedness for token usage specifically. It might be good to try to find specific pull requests that involve the sort of work we're looking for and refine around that.
  • The tokens language can produce some false positives as-is, like Notes: Add search and a status filter to the All Notes sidebar #84060 and Style revisions: Compare the selected revision with the current version side by side #85288. In these cases, it might be getting tripped upon tagging any styling change. I think the language makes it sound like "colors, spacing, or typography" are mutually exclusive with "design tokens".

I pushed a couple small improvements to address some of this:

  • adb9922 expands migration to cover more packages of the design system, not just claiming @wordpress/ui and @wordpress/components as the only packages. It intentionally excludes DataViews for now; I don't know that the components team is prepared to be looped into all of these right now, and may deserve its own configuration similar to how it's set up in CODEOWNERS today.
  • 597c9ad refines the language of tokens routing to clarify what design tokens actually are and where they come from.

† Refined wording in migration:

Does this change start to use a component from @wordpress/components or @wordpress/ui in interface code, in place of another component or of code written by hand? This includes moving from @wordpress/components to @wordpress/ui. It also includes starting to use the design tokens of @wordpress/theme in interface code, in place of hard-coded values or of @wordpress/base-styles variables, and adding a ThemeProvider so that interface code follows a theme.

More detailed analysis on theme tokens usage findings against real PRs (AI-generated)

migration:

Does this change start to use a component of the design system in interface code, in place of another component or of code written by hand? Such components include those of @wordpress/ui, @wordpress/components and @wordpress/admin-ui, and the icons of @wordpress/icons. This includes moving from @wordpress/components to @wordpress/ui.

The three known positives still pass: 80500 0.89, #86501 0.95 and #85799 0.92.

tokens:

Does this change affect how interface code uses the design tokens of @wordpress/theme, which are the --wpds-* CSS custom properties? Answer no when …

The "Answer no" sentence is the same as before. I tested three wordings on the same 19 PRs (threshold 0.8):

PR Kind Old "such as color, spacing or typography" --wpds-* (chosen) "such as color, spacing, typography, motion and cursors"
86402 Image Editor token adoption 0.93 0.90 0.91 0.89
83074 wp-admin colors token adoption 0.94 0.81 0.89 0.83
79002 edit-site color token adoption 0.93 0.80 0.86 0.83
80300 Notes mention chips token adoption 0.92 0.73 0.84 0.74
75204 DataViews token adoption 0.87 0.83 0.80 0.83
77376 Editor cursor token adoption 0.92 0.55 0.79 0.81
78204 Dashboard motion token adoption 0.90 0.56 0.79 0.78
77358 Commands cursor token adoption 0.83 0.37 0.56 0.54
81112 Post editor ThemeProvider 0.94 0.91 0.91 0.92
81173 Widgets editor ThemeProvider 0.93 0.87 0.88 0.87
80557 Notices ThemeProvider 0.87 0.76 0.81 0.85
81653 Inverted seed ThemeProvider 0.91 0.64 0.76 0.69
84060 Notes search new UI, no tokens 0.84 0.57 0.21 0.55
85288 Style revisions new UI, no tokens 0.82 0.46 0.25 0.46
86154 Media header new UI, 1 token 0.90 0.67 0.65 0.60
85819 Emoji reactions new UI, 11 tokens 0.89 0.72 0.82 0.72

Why I chose the --wpds-* wording:

  • It separates the cases most clearly. The two new-UI PRs with no tokens fell from 0.82–0.84 to 0.21–0.25. The other wordings only took them down to about 0.5.
  • It keeps adoption cases better. A list of token kinds acts as a closed list, even with "such as": the cursor and motion PRs dropped when they were not in it. The --wpds-* name matches text that the model can see in the diff. This is the same lesson as the @wordpress/components to file path question.

Costs to know about:

  • 77376 and 78204 are at 0.79, on the threshold. 77358 (a one-line change from cursor: pointer to the token) and 81653 (a change to an existing ThemeProvider) are below it. These are small mechanical adoptions, so I think losing them is acceptable. If you disagree, a 0.75 threshold would catch three of them and still exclude the no-token PRs. But that would put the threshold just above the scores we observed, and I advised against that before.
  • 85819 still passes at 0.82. It writes a lot of new token CSS, so "affects how interface code uses the design tokens" is arguably true.
  • tokens fell on 80500 and UI: Use LoadingIndicator in remaining popup consumers #86501 (0.24–0.27). That is correct: they are component migrations, and migration catches them.

Other notes:

  • Token adoption PRs now get 0.12–0.51 from migration (before: about 0.05). "A component of the design system" picks up a little of the token meaning. All are below the threshold, and tokens catches them anyway.
  • bespoke-ui still has the closed pair "@wordpress/components and @wordpress/ui". I did not change it.

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.

But there might also be some middle-ground, like "migration" encompassing both components and tokens.

That, or even cross-referencing across documents for easier discovery?

The tokens document doesn't mention anything about ThemeProvider

Yeah, I guess consuming ThemeProvider is a different task type than consuming WPDS tokens

Thank you!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That, or even cross-referencing across documents for easier discovery?

It might not be exactly what you had in mind, but one of the improvements I was thinking about in #86325 was "generated context for rules like component or tokens lists", which in my mind would be related external resources that could be attached to the request context, like a full list of tokens or components, so that the decision model can know if e.g. a pull request could leverage an existing token or component.

Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
team: WordPress/gutenberg-components
---

Does this change replace or migrate the design system components that interface code uses, such as moving from `@wordpress/components` to `@wordpress/ui`, or add tooling such as a lint rule to support that migration?
Does this change start to use a component of the design system in interface code, in place of another component or of code written by hand? Such components include those of `@wordpress/ui`, `@wordpress/components` and `@wordpress/admin-ui`, and the icons of `@wordpress/icons`. This includes moving from `@wordpress/components` to `@wordpress/ui`.
2 changes: 1 addition & 1 deletion .github/review-routing/design-system-tokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ team: WordPress/gutenberg-components
threshold: 0.8
---

Does this change affect how interface UI uses design tokens, colors, spacing or typography? Answer no when the change only changes the internal styles of a component in the design system packages `@wordpress/components`, `@wordpress/ui`, `@wordpress/theme`, `@wordpress/base-styles` or `@wordpress/icons`.
Does this change affect how interface code uses the design tokens of `@wordpress/theme`, which are the `--wpds-*` CSS custom properties? Answer no when the change only changes the internal styles of a component in the design system packages `@wordpress/components`, `@wordpress/ui`, `@wordpress/theme`, `@wordpress/base-styles` or `@wordpress/icons`.
5 changes: 5 additions & 0 deletions .github/review-routing/design-system-tooling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
team: WordPress/gutenberg-components
---

Does this change add or change tooling that helps people use the design system correctly? This includes tools that check or support how code uses design system components and design tokens, such as lint rules and Stylelint plugins, build plugins for design tokens, tools that support the move from `@wordpress/components` to `@wordpress/ui`, and tools that give design system guidance to developers or agents, such as the design system MCP server.
Loading