Preserve inline geometry in generated block assets#593
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
geometry-v2parity signal without changing the existing v1 score contract.Fixes #591. Related to Automattic/static-site-importer#489.
Root cause
The transformer dropped inline geometry properties that were not mapped to native block supports. The first carrier implementation also exposed three correctness constraints that this PR now handles explicitly:
!importantand element-local custom properties.Implementation
core/buttonoutput owns canonical percentage widths.The implementation is generic and contains no fixture-specific selectors or site overrides.
Evidence
Using the same
static-style-parity-probes/geometry-v2property set on a representative inline-geometry fixture:a5b8b58)The fixture covers width, max-width, and aspect ratio. A 200-element stress case produces 200 unique carrier classes and 200 matching rules with byte-identical output across repeated transforms.
The full transformer suite passes with 230 parity fixtures, 75 style/cascade assertions, 8 parity-runner assertions, and package-install proof.
How to test
composer --working-dir=php-transformer install --no-interaction.composer --working-dir=php-transformer test.php php-transformer/tests/unit/block-style-support-conversion.phpto exercise carrier allocation, cascade, spacer, button, custom-property, and stress regressions.php php-transformer/tests/unit/live-wp-parity-runner.phpto verify the unchanged v1 contract and separate geometry-v2 signal.style="width:30rem;max-width:20rem;aspect-ratio:2 / 1"and confirm its markup references abe-inline-geometry-*class and its materialization plan includes the matching generated CSS asset.Compatibility
This intentionally changes generated markup and artifact assets for elements whose inline geometry was previously discarded. Consumers of ArtifactCompiler output may observe an additional generated CSS asset and deterministic carrier classes. Existing v1 parity scores and native block-owned geometry remain unchanged.
No extension-specific APIs or fixture-specific behavior are introduced.
Residual risk
Static parity and serialization tests do not replace browser raster validation. Reviewers should validate responsive layouts and complex custom-property fallback expressions on representative imported sites before merge.
AI assistance