Skip to content

(PoC) UI PHP components: Add a props contract, deprecations and translations - #84903

Draft
juanfra wants to merge 2 commits into
try/84036-ui-components-phpfrom
try/84036-ui-components-php-contract
Draft

juanfra wants to merge 2 commits into
try/84036-ui-components-phpfrom
try/84036-ui-components-php-contract

Conversation

@juanfra

@juanfra juanfra commented Oct 16, 2026

Copy link
Copy Markdown
Member

What?

Builds on #84714. Brings back what was moved out of it, so that we kept the original PR to the essentials, making it easier to review. It includes the fix for renaming a required prop (from @ciampo's review)

How?

  • contract.lock.json records the props as of the last release, and the build fails if a change would break existing PHP calls, unless a deprecation keeps them working.
  • Deprecations map old props and values to new ones, with a _deprecated_argument() notice.
  • Strings React translates with __() are translated by PHP instead of being baked in as English.

Testing Instructions

  1. Run npm run build and npm run build:wp --workspace @wordpress/ui.
  2. npm run test:unit:vitest -- packages/ui/bin/php/test/contracts.test.mjs
  3. npm run test:unit:php:base -- --filter Gutenberg_UI_Components_Test

Use of AI Tools

Claude Code + Opus 5.5

@juanfra
juanfra added this pull request to stack #84904 October 16, 2026 09:03
@juanfra juanfra added [Type] Technical Prototype Offers a technical exploration into an idea as an example of what's possible [Package] UI /packages/ui labels Oct 16, 2026
@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground

📦 Bundle size

Size Change: 0 B

Total Size: 8.96 MB

a136ee9 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric beaea28 trunk % Change
timeToFirstByte 57.25 ms +9.87% -6.03% 55.75 ms +11.48% -3.68% 2.69%
largestContentfulPaint 98 ms +4.08% -6.12% 94 ms +8.51% -6.38% 4.26%
lcpMinusTtfb 35.5 ms +23.94% -2.11% 37.2 ms +14.11% -9.41% -4.57%
wpBeforeTemplate 32.72 ms +6.82% -12.01% 30.45 ms +13.63% -6.83% 7.45%
wpTemplate 21.74 ms +5.29% -5.43% 21.4 ms +5.42% -5.47% 1.59%
wpTotal 53.5 ms +8.04% -5.89% 52.01 ms +9.96% -3.94% 2.86%
wpMemoryUsage 7.64 MB +0% -0% 7.61 MB +0% -0% 0.46%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric beaea28 trunk % Change
timeToFirstByte 46.25 ms +5.84% -1.95% 42 ms +10.95% -2.86% 10.12%
largestContentfulPaint 102 ms +1.96% -1.96% 90 ms +4.44% -2.22% 13.33%
lcpMinusTtfb 55 ms +3.82% -0.82% 47.5 ms +4.11% -1.26% 15.79%
wpBeforeTemplate 26.69 ms +1.57% -1.16% 26.61 ms +11.24% -1.84% 0.3%
wpTemplate 16.02 ms +4.18% -1.56% 12.02 ms +3.66% -0.83% 33.28%
wpTotal 43.18 ms +5.6% -1.99% 39.44 ms +10.12% -3.78% 9.48%
wpMemoryUsage 6.32 MB +0% -0% 6.18 MB +0% -0% 2.39%
wpDbQueries 13 +0% -0% 9 +0% -0% 44.44%

media-processing

Metric beaea28 trunk % Change
mediaProcessingJpeg 402.64 ms +0.21% -0.78% 402.39 ms +0.59% -0.49% 0.06%
mediaProcessingAvif 6069.2 ms +0.21% -0.1% 6096.27 ms +0.35% -0.17% -0.44%
mediaProcessingJpegToAvif 4183.17 ms +0.55% -0.17% 4197.27 ms +0.49% -0.12% -0.34%

media-upload

Metric beaea28 trunk % Change
jpegUploadProcessing 1419.8 ms +1.6% -0.81% 1416.76 ms +1.48% -1.13% 0.21%
pngUploadProcessing 211.75 ms +6.86% -16.01% 215.34 ms +15.11% -21.05% -1.67%
largeJpegUploadProcessing 1408.56 ms +1.46% -0.57% 1414.45 ms +0.8% -1.38% -0.42%
multipleImageUploadProcessing 1592.75 ms +0.47% -1.03% 1554.95 ms +0.32% -0.3% 2.43%

post-editor

Metric beaea28 trunk % Change
serverResponse 310.61 ms +5.5% -6.02% 322.61 ms +3.91% -8.99% -3.72%
firstPaint 405.11 ms +1.2% -44.73% 395.25 ms +3.9% -38.97% 2.49%
domContentLoaded 939.52 ms +2.63% -2.84% 909.69 ms +2.74% -1.59% 3.28%
loaded 940.57 ms +2.6% -2.81% 910.84 ms +2.73% -1.59% 3.26%
firstContentfulPaint 412.15 ms +2.3% -1.7% 408.29 ms +2.6% -1.44% 0.95%
firstBlock 2693.31 ms +1.3% -1.24% 2651.72 ms +1.56% -0.58% 1.57%
type 16.25 ms +7.69% -5.72% 16.21 ms +0.99% -3.95% 0.25%
typeWithoutInspector 16.46 ms +4.68% -2.79% 16.32 ms +3.68% -3.62% 0.86%
typeWithTopToolbar 19.74 ms +5.27% -4.2% 19.74 ms +9.17% -5.42% 0%
typeContainer 7.47 ms +3.61% -4.42% 7.36 ms +8.42% -9.1% 1.49%
focus 93.7 ms +8.4% -2.67% 92.58 ms +3.78% -1.75% 1.21%
firstFocus 184.16 ms +0% -0% 174.6 ms +0% -0% 5.48%
selectAll 465.54 ms +3.36% -0.09% 440.95 ms +17.56% -1.52% 5.58%
listViewOpen 56.96 ms +4.34% -3.18% 58.35 ms +7.71% -5.66% -2.38%
inserterOpen 32.93 ms +5.13% -3.77% 34.28 ms +2.65% -6.01% -3.94%
inserterHover 10.42 ms +2.88% -8.06% 9.85 ms +5.18% -4.16% 5.79%
inserterSearch 6.94 ms +6.77% -2.88% 7.39 ms +6.36% -9.61% -6.09%
loadPatterns 519.3 ms +3.66% -3.03% 511.62 ms +3.06% -1.15% 1.5%
wpTotal 302.08 ms +5.44% -6.33% 313.79 ms +4.05% -9.26% -3.73%
wpMemoryUsage 13.59 MB +0% -0% 13.55 MB +0% -0% 0.28%
wpDbQueries 55 +0% -1.82% 55 +0% -0% 0%

site-editor

Metric beaea28 trunk % Change
serverResponse 287.01 ms +0.83% -2.03% 290.73 ms +14.82% -4.48% -1.28%
firstPaint 207.75 ms +11.16% -12.93% 196.64 ms +36.67% -13.86% 5.65%
domContentLoaded 872.02 ms +5.23% -2.11% 878.33 ms +2.48% -2.32% -0.72%
loaded 872.74 ms +5.23% -2.11% 879.19 ms +2.48% -2.33% -0.73%
firstContentfulPaint 380.98 ms +12.24% -3.26% 382.65 ms +1.65% -3.49% -0.44%
firstBlock 3268.86 ms +1.71% -3.58% 3219.92 ms +1.4% -1.07% 1.52%
type 16.36 ms +3% -7.21% 15.78 ms +5.01% -1.77% 3.68%
navigate 86.92 ms +6.51% -1.55% 85.27 ms +31.09% -6.68% 1.94%
loadPatterns 1034.91 ms +12.56% -3.15% 987.76 ms +6.61% -4.45% 4.77%
loadPages 1055.66 ms +3.43% -3.15% 1052.24 ms +2.04% -2.23% 0.33%
wpTotal 279.54 ms +0.97% -1.99% 283.28 ms +15.14% -4.52% -1.32%
wpMemoryUsage 12.63 MB +0% -0% 12.61 MB +0% -0% 0.13%
wpDbQueries 44 +2.27% -0% 44.5 +1.12% -1.12% -1.12%

a136ee9 Run

🏁 Flaky tests

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.

Regression: updating a specific option will only change its value and will not corrupt others in /test/e2e/specs/editor/various/core-settings.spec.js, passed after 1 failed attempt.
Error: expect(received).toStrictEqual(expected) // deep equality

- Expected  - 1
+ Received  + 1

  Array [
    "rewrite_rules",
-   "SERIALIZED DATA",
+   "",
  ]
    at forEach (/home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/core-settings.spec.js:46:26)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/core-settings.spec.js:43:35
does not select blocks in the canvas preview when editing from the sidebar (Site Editor v2) in /test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeFocused() failed

Locator: getByRole('combobox', { name: 'Search or type URL' })
Expected: focused
Timeout: 5000ms
Error: element(s) not found

Call log:
  - Expect "toBeFocused" getByRole('combobox', { name: 'Search or type URL' }) with timeout 5000ms
  - waiting for getByRole('combobox', { name: 'Search or type URL' })

    at LinkControl.useLinkControlSearch (/home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js:331:47)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js:179:21
keeps the blocks selected after dropping a multi-selection in /test/e2e/specs/editor/various/draggable-blocks.spec.js, passed after 1 failed attempt.
TypeError: Cannot read properties of null (reading 'y')
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/draggable-blocks.spec.js:824:57
    at dragSelectionBelowLanding (/home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/draggable-blocks.spec.js:823:3)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/draggable-blocks.spec.js:908:3
restores the blocks when a multi-selection drag is canceled in /test/e2e/specs/editor/various/draggable-blocks.spec.js, passed after 1 failed attempt.
TypeError: Cannot read properties of null (reading 'y')
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/draggable-blocks.spec.js:824:57
    at dragSelectionBelowLanding (/home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/draggable-blocks.spec.js:823:3)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/draggable-blocks.spec.js:871:3

a136ee9 Run

This branch has not been deployed

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

Labels

[Package] UI /packages/ui [Type] Technical Prototype Offers a technical exploration into an idea as an example of what's possible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant