Skip to content

@wordpress/theme: overall API and architecture assessment #77462

Description

@ciampo

Stabilization review of @wordpress/theme, aggregating the original assessment with a fresh validation pass against the current source (v0.13.0). Items shipped since the first pass are listed as done.

Done

  • I4 — Refactor color-space registration to avoid module-level side effects (#77653).
  • A6 (parsing) — Throw a clear error when the seed color is unparseable (#77653).
  • T-M1 — Add --wpds-motion-duration-* and --wpds-motion-easing-* tokens (#76097).

Bugs

API design

Architecture and implementation

  • I2 — Set custom properties via inline style on the wrapper instead of injecting a per-instance <style> element. Removes the doubled-class specificity hack, removes the <style> element in the common case, and removes one DOM node per provider. For isRoot, write to document.documentElement.style in a useLayoutEffect with cleanup — no need for :root:has(...). Theme: apply ThemeProvider styles inline (I2) #78678
  • I3 — Don't serialize data-wpds-root-provider=\"false\" on every non-root provider. Use data-wpds-root-provider={ isRoot || undefined } (or drop the attribute altogether after I2). Theme: Skip serializing data-wpds-root-provider="false" on non-root providers #79253
  • I5 — Document the memoization contract for getCachedBgRamp / getCachedAccentRamp. buildAccentRamp(seed, bgRamp) keys on both arguments and relies on the upstream bgRamp memo to keep references stable. Worth a comment near the cache declarations. Theme: Document ramp memoization contract #79459

Testing

Tokens

Naming and structure:

Values and content:

Priorities

  • Block stabilization: B1, B2, B5, A1+A2.
  • High priority: A3, A8, B3, B4, I2, I3, T-N1, T-N3.
  • Medium: T1, T2, A5, A6, A7, I5, T-M5, T-M7.
  • Low / token cleanup: T-D1, T-D4, T-V1, T-V4, T-X3, T3.

Original detailed assessment (April 2026)

The first iteration of this review lives in the issue's revision history and discussion thread above. It contained additional commentary on items that have since been resolved (color-space registration, motion tokens, seed parsing) plus lower-priority token-level observations not repeated here.

Metadata

Metadata

Assignees

Labels

Design SystemIssues related to the system of combining components according to best practices.[Package] Theme/packages/theme

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions