Skip to content

feat: add support for transforming vw and vh units into calc() expressions using CSS variables.#2377

Merged
PupilTong merged 4 commits intolynx-family:mainfrom
PupilTong:p/hw/support-rpx-and-vw-vh
Mar 26, 2026
Merged

feat: add support for transforming vw and vh units into calc() expressions using CSS variables.#2377
PupilTong merged 4 commits intolynx-family:mainfrom
PupilTong:p/hw/support-rpx-and-vw-vh

Conversation

@PupilTong
Copy link
Copy Markdown
Collaborator

@PupilTong PupilTong commented Mar 25, 2026

Summary by CodeRabbit

  • New Features

    • rpx unit support: inline rpx values transform to calc(...) using configurable --rpx-unit
    • New transform-vw / transform-vh attributes/properties to optionally transform vw/vh → calc(...) via --vw-unit / --vh-unit
  • Style

    • Added container-query defaults and CSS custom properties (--rpx-unit, --vw-unit, --vh-unit) with @Property registrations
  • Tests

    • Added e2e and unit tests for rpx and vw/vh behaviors
  • Breaking Changes

    • rpx support marked as breaking in the changeset

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).
  • Changeset added, and when a BREAKING CHANGE occurs, it needs to be clearly marked (or not required).

@PupilTong PupilTong self-assigned this Mar 25, 2026
@PupilTong PupilTong requested a review from Sherry-hue as a code owner March 25, 2026 10:29
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 25, 2026

🦋 Changeset detected

Latest commit: e0de618

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@lynx-js/web-core Minor
upgrade-rspeedy Patch
@lynx-js/web-rsbuild-server-middleware Minor
@lynx-js/template-webpack-plugin Patch
@lynx-js/react-rsbuild-plugin Patch
create-rspeedy Patch
@lynx-js/web-worker-rpc Minor
@lynx-js/react-alias-rsbuild-plugin Patch
@lynx-js/rspeedy Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 25, 2026

📝 Walkthrough

Walkthrough

Adds configurable viewport-unit transformations (rpx, vw, vh) across CSS defaults, Rust style-transformer, WASM bindings, and TypeScript worker/main-thread paths; tests and E2E cover the new behavior. Changes introduce TransformerConfig and thread transform flags through encode/decode and inline-style APIs.

Changes

Cohort / File(s) Summary
Changesets
\.changeset/transform-rpx.md, \.changeset/transform-vw-vh-support.md
Added changesets announcing rpx and vw/vh transform support (rpx marked breaking).
CSS Base
packages/web-platform/web-core/css/index.css
Added container query defaults, --rpx-unit/--vw-unit/--vh-unit defaults and @property registrations.
Rust: Transformer Core
packages/web-platform/web-core/src/style_transformer/token_transformer.rs, .../transformer.rs, .../inline_style.rs, .../mod.rs
Introduced TransformerConfig (transform_vw/transform_vh), threaded config through StyleTransformer, added conditional vw/vh → calc(...) transforms, and made token_transformer public.
Rust: Main Thread & Server
packages/web-platform/web-core/src/main_thread/client/element_apis/style_apis.rs, .../server/main_thread_server_context.rs
Extended inline-style APIs and MainThreadServerContext to accept transform flags and pass them into transformation pipeline.
Rust: Style Info / Decoder
packages/web-platform/web-core/src/template/.../decoded_style_data.rs, .../style_info_decoder.rs, .../raw_style_info.rs
Extended WASM-exposed encode/decode and StyleInfoDecoder to accept and forward transform_vw/transform_vh flags.
WASM / .d.ts Bindings
packages/web-platform/web-core/binary/*/client*.d.ts, .../*_bg.wasm.d.ts, .../encode/*.d.ts, .../server/*.d.ts, .../client_legacy/*
Updated TypeScript/WASM declaration signatures to include two extra boolean parameters for style encode/decode and inline-style functions; adjusted wasm arities.
TypeScript: Worker & Loader
packages/web-platform/web-core/ts/client/decodeWorker/decode.worker.ts, .../cssLoader.ts, .../types.ts
Threaded transformVW/transformVH through worker message types and style loading (JSON and wasm) paths.
TypeScript: Main Thread & TemplateManager
packages/web-platform/web-core/ts/client/mainthread/LynxView.ts, .../LynxViewInstance.ts, .../TemplateManager.ts
Added observed transform-vw/transform-vh attributes/properties and passed flags into instance/template fetch flows.
TypeScript: Element API Creation
packages/web-platform/web-core/ts/client/mainthread/elementAPIs/createElementAPI.ts, packages/web-platform/web-core/ts/server/elementAPIs/createElementAPI.ts
createElementAPI accepts transform flags and forwards them to inline-style setters and server MainThreadServerContext.
TypeScript: Server APIs
packages/web-platform/web-core/ts/server/decode.ts, packages/web-platform/web-core/ts/server/deploy.ts
decodeTemplate and executeTemplate gain transformVW/transformVH and forward them into decoding/deploy flows.
Tests & E2E
packages/web-platform/web-core-e2e/tests/reactlynx.spec.ts, .../basic-rpx-unit/index.jsx, .../basic-vw-vh-unit/index.jsx, packages/web-platform/web-core/tests/**, .../template-manager.spec.ts
Added unit and E2E tests for rpx/vw/vh behavior; updated test call sites to new signatures.
Misc / Dev Middleware
packages/web-platform/web-core-e2e/shell-project/devMiddleware.ts
Forwarded transform flags into executeTemplate in dev middleware.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • Sherry-hue

Poem

🐰 I hopped through tokens, thin and spry,
rpx, vw, and vh learn to fly,
From Rust to WASM, calc lines hum,
Units dance bright where styles come from,
🥕✨ — a rabbit cheers the new sky

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 67.53% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main feature added in this PR: support for transforming vw and vh units into calc() expressions using CSS variables.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 25, 2026

Merging this PR will not alter performance

✅ 63 untouched benchmarks
⏩ 21 skipped benchmarks1


Comparing PupilTong:p/hw/support-rpx-and-vw-vh (e0de618) with main (36b38eb)

Open in CodSpeed

Footnotes

  1. 21 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@relativeci
Copy link
Copy Markdown

relativeci bot commented Mar 25, 2026

Web Explorer

#8419 Bundle Size — 727.67KiB (+0.41%).

e0de618(current) vs 36b38eb main#8397(baseline)

Bundle metrics  Change 5 changes Regression 2 regressions
                 Current
#8419
     Baseline
#8397
Regression  Initial JS 42.62KiB(+1.49%) 41.99KiB
Regression  Initial CSS 2.13KiB(+6.97%) 1.99KiB
Change  Cache Invalidation 49.08% 0%
No change  Chunks 8 8
No change  Assets 10 10
Change  Modules 150(+0.67%) 149
No change  Duplicate Modules 11 11
Change  Duplicate Code 34.73%(-0.06%) 34.75%
No change  Packages 3 3
No change  Duplicate Packages 0 0
Bundle size by type  Change 3 changes Regression 3 regressions
                 Current
#8419
     Baseline
#8397
Regression  Other 384.29KiB (+0.5%) 382.38KiB
Regression  JS 341.25KiB (+0.26%) 340.36KiB
Regression  CSS 2.13KiB (+6.97%) 1.99KiB

Bundle analysis reportBranch PupilTong:p/hw/support-rpx-and-v...Project dashboard


Generated by RelativeCIDocumentationReport issue

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
packages/web-platform/web-core/tests/element-apis.spec.ts (3)

1375-1391: ⚠️ Potential issue | 🟡 Minor

Missing transformVW and transformVH in SSR test config.

The createServerElementAPI config object is missing the newly required transformVW and transformVH properties. Based on the changes to packages/web-platform/web-core/ts/server/elementAPIs/createElementAPI.ts (lines 99-100), these are now required fields in the config type.

🔧 Proposed fix
       const config = {
         enableCSSSelector: true,
         defaultOverflowVisible: false,
         defaultDisplayLinear: true,
+        transformVW: false,
+        transformVH: false,
       };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/web-platform/web-core/tests/element-apis.spec.ts` around lines 1375
- 1391, The test's config passed to createServerElementAPI is missing the
now-required numeric callbacks transformVW and transformVH; update the config
object used in the 'create element infer css id from parent component in SSR'
test to include transformVW and transformVH properties (functions returning
numbers) so the config shape matches the new createElementAPI expectations and
the call to createServerElementAPI compiles.

1461-1465: ⚠️ Potential issue | 🟡 Minor

Missing transform_vw and transform_vh parameters in decode_style_info call.

The decode_style_info function signature was updated to require two additional boolean parameters (transform_vw, transform_vh), but this call site was not updated.

🔧 Proposed fix
     const encodedStyleInfo = wasmInstance.decode_style_info(
       encodedRawStyleInfo,
       undefined,
       true,
+      false,
+      false,
     );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/web-platform/web-core/tests/element-apis.spec.ts` around lines 1461
- 1465, Call to wasmInstance.decode_style_info is missing the two new boolean
parameters transform_vw and transform_vh; update the invocation (the
encodedStyleInfo assignment) to include those two booleans (e.g., pass false,
false or the appropriate test variables) so the call matches the updated
signature: decode_style_info(encodedRawStyleInfo, undefined, true, transform_vw,
transform_vh).

1413-1428: ⚠️ Potential issue | 🟡 Minor

Missing transformVW and transformVH in second SSR test config.

Same issue as the previous SSR test - the config object needs the new required properties.

🔧 Proposed fix
       const config = {
         enableCSSSelector: true,
         defaultOverflowVisible: false,
         defaultDisplayLinear: true,
+        transformVW: false,
+        transformVH: false,
       };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/web-platform/web-core/tests/element-apis.spec.ts` around lines 1413
- 1428, The test "create element wont infer css id if parent css id is 0 in SSR"
passes a config to createServerElementAPI but omits the required transformVW and
transformVH properties; add transformVW and transformVH to the config object
used in this test (the same properties used in the previous SSR test) so the
config matches the expected shape when calling createServerElementAPI.
🧹 Nitpick comments (2)
packages/web-platform/web-core/src/style_transformer/mod.rs (1)

18-18: Narrow visibility unless external consumers are intentionally supported.

Line 18 makes token_transformer part of the public crate API. Based on current usage, this appears to be internal-only and can be crate-scoped to avoid unnecessary long-term API surface.

Proposed change
- pub mod token_transformer;
+ pub(crate) mod token_transformer;
+ pub(crate) use token_transformer::TransformerConfig;

Based on learnings: CSS processing in packages/web-platform/web-core/src/{css_tokenizer,style_transformer}/**/*.rs should stay focused and efficient; keeping API surface minimal helps maintain that boundary.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/web-platform/web-core/src/style_transformer/mod.rs` at line 18, The
module declaration `pub mod token_transformer` unnecessarily exposes internal
APIs; change it to a crate-private module by replacing the `pub mod
token_transformer` declaration with a private `mod token_transformer`, then
update any external references that relied on the public path (or add a minimal,
intentional public wrapper/re-export if external consumers truly need one).
Search for uses of `token_transformer::` outside the crate and either adjust
call sites to use the internal path (within the crate) or create a small,
explicit public facade function/type to re-export only the required symbols
rather than the entire module.
packages/web-platform/web-core-e2e/tests/reactlynx/basic-vw-vh-unit/index.jsx (1)

6-19: Consider removing the unnecessary fragment wrapper for consistency.

The <>...</> fragment wrapper around the single <view> element is unnecessary since there's only one child. The basic-rpx-unit/index.jsx test doesn't use a fragment wrapper for its single element.

♻️ Suggested simplification
 function App() {
   return (
-    <>
-      <view
-        id='target'
-        style={{
-          height: '50vh',
-          width: '50vw',
-          background: 'blue',
-        }}
-      />
-    </>
+    <view
+      id='target'
+      style={{
+        height: '50vh',
+        width: '50vw',
+        background: 'blue',
+      }}
+    />
   );
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/web-platform/web-core-e2e/tests/reactlynx/basic-vw-vh-unit/index.jsx`
around lines 6 - 19, Remove the unnecessary JSX fragment in the App component:
update the App function (function App) to return the single <view id='target'
.../> element directly instead of wrapping it with the fragment (<>...</>), so
the component returns the single root element without the fragment for
consistency with basic-rpx-unit/index.jsx.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@packages/web-platform/web-core/src/main_thread/server/main_thread_server_context.rs`:
- Around line 35-37: The changes introduce main-thread-visible style
transformation flags (transform_vw and transform_vh) in the server context, but
there are no corresponding JS-side tests; add cases to element-apis.spec.ts that
cover the updated main-thread style-transformation behavior by exercising the
code paths that read transform_vw and transform_vh (and other modified
transformation logic in the same main-thread module) — create test elements,
apply styles that use vw/vh-based transforms, and assert the computed
styles/layout and any expected transform results to ensure the new flags behave
correctly from the JS side.

---

Outside diff comments:
In `@packages/web-platform/web-core/tests/element-apis.spec.ts`:
- Around line 1375-1391: The test's config passed to createServerElementAPI is
missing the now-required numeric callbacks transformVW and transformVH; update
the config object used in the 'create element infer css id from parent component
in SSR' test to include transformVW and transformVH properties (functions
returning numbers) so the config shape matches the new createElementAPI
expectations and the call to createServerElementAPI compiles.
- Around line 1461-1465: Call to wasmInstance.decode_style_info is missing the
two new boolean parameters transform_vw and transform_vh; update the invocation
(the encodedStyleInfo assignment) to include those two booleans (e.g., pass
false, false or the appropriate test variables) so the call matches the updated
signature: decode_style_info(encodedRawStyleInfo, undefined, true, transform_vw,
transform_vh).
- Around line 1413-1428: The test "create element wont infer css id if parent
css id is 0 in SSR" passes a config to createServerElementAPI but omits the
required transformVW and transformVH properties; add transformVW and transformVH
to the config object used in this test (the same properties used in the previous
SSR test) so the config matches the expected shape when calling
createServerElementAPI.

---

Nitpick comments:
In
`@packages/web-platform/web-core-e2e/tests/reactlynx/basic-vw-vh-unit/index.jsx`:
- Around line 6-19: Remove the unnecessary JSX fragment in the App component:
update the App function (function App) to return the single <view id='target'
.../> element directly instead of wrapping it with the fragment (<>...</>), so
the component returns the single root element without the fragment for
consistency with basic-rpx-unit/index.jsx.

In `@packages/web-platform/web-core/src/style_transformer/mod.rs`:
- Line 18: The module declaration `pub mod token_transformer` unnecessarily
exposes internal APIs; change it to a crate-private module by replacing the `pub
mod token_transformer` declaration with a private `mod token_transformer`, then
update any external references that relied on the public path (or add a minimal,
intentional public wrapper/re-export if external consumers truly need one).
Search for uses of `token_transformer::` outside the crate and either adjust
call sites to use the internal path (within the crate) or create a small,
explicit public facade function/type to re-export only the required symbols
rather than the entire module.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0a45efb0-299e-4fe1-b4be-019f1242d8ba

📥 Commits

Reviewing files that changed from the base of the PR and between 36b38eb and 48ea22e.

📒 Files selected for processing (33)
  • .changeset/transform-rpx.md
  • .changeset/transform-vw-vh-support.md
  • packages/web-platform/web-core-e2e/tests/reactlynx.spec.ts
  • packages/web-platform/web-core-e2e/tests/reactlynx/basic-rpx-unit/index.jsx
  • packages/web-platform/web-core-e2e/tests/reactlynx/basic-vw-vh-unit/index.jsx
  • packages/web-platform/web-core/binary/client/client.d.ts
  • packages/web-platform/web-core/binary/client/client_bg.wasm.d.ts
  • packages/web-platform/web-core/binary/encode/encode.d.ts
  • packages/web-platform/web-core/binary/encode/encode_bg.wasm.d.ts
  • packages/web-platform/web-core/binary/server/server.d.ts
  • packages/web-platform/web-core/binary/server/server_bg.wasm.d.ts
  • packages/web-platform/web-core/css/index.css
  • packages/web-platform/web-core/src/main_thread/client/element_apis/style_apis.rs
  • packages/web-platform/web-core/src/main_thread/server/main_thread_server_context.rs
  • packages/web-platform/web-core/src/style_transformer/inline_style.rs
  • packages/web-platform/web-core/src/style_transformer/mod.rs
  • packages/web-platform/web-core/src/style_transformer/token_transformer.rs
  • packages/web-platform/web-core/src/style_transformer/transformer.rs
  • packages/web-platform/web-core/src/template/template_sections/style_info/decoded_style_data.rs
  • packages/web-platform/web-core/src/template/template_sections/style_info/raw_style_info.rs
  • packages/web-platform/web-core/src/template/template_sections/style_info/style_info_decoder.rs
  • packages/web-platform/web-core/tests/element-apis.spec.ts
  • packages/web-platform/web-core/tests/template-manager.spec.ts
  • packages/web-platform/web-core/ts/client/decodeWorker/cssLoader.ts
  • packages/web-platform/web-core/ts/client/decodeWorker/decode.worker.ts
  • packages/web-platform/web-core/ts/client/decodeWorker/types.ts
  • packages/web-platform/web-core/ts/client/mainthread/LynxView.ts
  • packages/web-platform/web-core/ts/client/mainthread/LynxViewInstance.ts
  • packages/web-platform/web-core/ts/client/mainthread/TemplateManager.ts
  • packages/web-platform/web-core/ts/client/mainthread/elementAPIs/createElementAPI.ts
  • packages/web-platform/web-core/ts/server/decode.ts
  • packages/web-platform/web-core/ts/server/deploy.ts
  • packages/web-platform/web-core/ts/server/elementAPIs/createElementAPI.ts
👮 Files not reviewed due to content moderation or server errors (8)
  • .changeset/transform-rpx.md
  • packages/web-platform/web-core/ts/client/decodeWorker/cssLoader.ts
  • .changeset/transform-vw-vh-support.md
  • packages/web-platform/web-core/ts/client/mainthread/elementAPIs/createElementAPI.ts
  • packages/web-platform/web-core/ts/client/mainthread/TemplateManager.ts
  • packages/web-platform/web-core/css/index.css
  • packages/web-platform/web-core-e2e/tests/reactlynx.spec.ts
  • packages/web-platform/web-core/ts/server/deploy.ts

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/web-platform/web-core-e2e/tests/reactlynx.spec.ts`:
- Around line 404-408: Update the outdated/misleading comment that describes
container-query math to reflect the actual test setup and expectations: mention
that --vw-unit and --vh-unit are 10px so 50vw/50vh compute to 500px (matching
the assertions in expect(target).toHaveCSS('width','500px') and
expect(target).toHaveCSS('height','500px')), and remove the incorrect
container-query 25px/50px explanation; also remove the unnecessary await on the
synchronous page.locator(...) call (used to assign target) so the locator is
obtained without await.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: de39a139-7439-45ae-a79b-56b158eda07c

📥 Commits

Reviewing files that changed from the base of the PR and between 48ea22e and 1b8f7bc.

📒 Files selected for processing (3)
  • packages/web-platform/web-core-e2e/tests/reactlynx.spec.ts
  • packages/web-platform/web-core/binary/client_legacy/client.d.ts
  • packages/web-platform/web-core/binary/client_legacy/client_bg.wasm.d.ts

…e and SSR element APIs, including transformation to `calc()` expressions.
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
packages/web-platform/web-core-e2e/tests/reactlynx.spec.ts (1)

407-415: ⚠️ Potential issue | 🟠 Major

Post-toggle assertions do not verify the intended behavior.

Line 414 and Line 415 (not 25px/not 50px) are too weak and may pass even when transform toggling is broken. Assert that the transformed 500px results are no longer present (or assert explicit expected values after disabling).

🔧 Suggested assertion update
-      await expect(target).not.toHaveCSS('width', '25px');
-      await expect(target).not.toHaveCSS('height', '50px');
+      await expect(target).not.toHaveCSS('width', '500px');
+      await expect(target).not.toHaveCSS('height', '500px');
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/web-platform/web-core-e2e/tests/reactlynx.spec.ts` around lines 407
- 415, After disabling transforms via lynxView.evaluate (setting
node.transformVW = false and node.transformVH = false followed by
node.reload()), replace the weak negative assertions on
target.toHaveCSS('width','25px') and ('height','50px') with explicit assertions
that verify the transformed 500px values are no longer present (e.g., assert
target does not have width/height '500px') or assert the explicit expected
dimensions after disabling transforms; update assertions referencing target and
toHaveCSS so they validate the intended post-toggle dimensions rather than just
"not 25px"/"not 50px".
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/web-platform/web-core/tests/element-apis.spec.ts`:
- Around line 439-461: The tests call createElementAPI(...) with
transformVW/transformVH enabled but still assert raw 'vw'/'vh' CSS strings;
update the assertions to expect transformed values (or validate computed style)
instead of raw units. Locate tests using createElementAPI and __SetInlineStyles
(e.g., the test named "__SetInlineStyles with object and vw/vh when enabled" and
similar cases around lines referenced) and change
expect(targetStyle).toBe('width:50vw;height:100vh;') to assert the transformed
result produced when transformVW/transformVH are true (or retrieve computed
styles from the DOM and assert those), and apply the same fix to the other
affected tests that assert 'vw'/'vh'/'rpx' when transforms are enabled.

---

Duplicate comments:
In `@packages/web-platform/web-core-e2e/tests/reactlynx.spec.ts`:
- Around line 407-415: After disabling transforms via lynxView.evaluate (setting
node.transformVW = false and node.transformVH = false followed by
node.reload()), replace the weak negative assertions on
target.toHaveCSS('width','25px') and ('height','50px') with explicit assertions
that verify the transformed 500px values are no longer present (e.g., assert
target does not have width/height '500px') or assert the explicit expected
dimensions after disabling transforms; update assertions referencing target and
toHaveCSS so they validate the intended post-toggle dimensions rather than just
"not 25px"/"not 50px".

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9217d863-8e71-484d-a79a-ed128af22d72

📥 Commits

Reviewing files that changed from the base of the PR and between c93127b and e0de618.

📒 Files selected for processing (2)
  • packages/web-platform/web-core-e2e/tests/reactlynx.spec.ts
  • packages/web-platform/web-core/tests/element-apis.spec.ts

Copy link
Copy Markdown
Collaborator

@Huxpro Huxpro left a comment

Choose a reason for hiding this comment

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

SHHHHIP IT! ;)

@PupilTong PupilTong enabled auto-merge (squash) March 26, 2026 04:28
@PupilTong PupilTong disabled auto-merge March 26, 2026 04:28
@PupilTong PupilTong enabled auto-merge (squash) March 26, 2026 04:29
@PupilTong PupilTong merged commit 138f727 into lynx-family:main Mar 26, 2026
67 of 71 checks passed
colinaaa pushed a commit that referenced this pull request Apr 6, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @lynx-js/rspeedy@0.14.0

### Minor Changes

- feat: add `Minify.mainThreadOptions` and `Minify.backgroundOptions`
for thread-specific minifier.
([#2336](#2336))

### Patch Changes

- Bump Rsbuild v1.7.4 with Rspack v1.7.10.
([#2384](#2384))

-   Updated dependencies \[]:
    -   @lynx-js/web-rsbuild-server-middleware@0.20.0

## @lynx-js/lynx-bundle-rslib-config@0.3.0

### Minor Changes

- **BREAKING CHANGE**:
([#2370](#2370))

Simplify the API for external bundle builds by `externalsPresets` and
`externalsPresetDefinitions`.

### Patch Changes

- Preserve the default external-bundle `output.minify.jsOptions` when
users set `output.minify: true` in `defineExternalBundleRslibConfig`, so
required minifier options are not lost.
([#2390](#2390))

## @lynx-js/external-bundle-rsbuild-plugin@0.1.0

### Minor Changes

- **BREAKING CHANGE**:
([#2370](#2370))

Simplify the API for external bundle builds by `externalsPresets` and
`externalsPresetDefinitions`.

### Patch Changes

- Updated dependencies
\[[`7b7a0c6`](7b7a0c6)]:
    -   @lynx-js/externals-loading-webpack-plugin@0.1.0

## @lynx-js/react-rsbuild-plugin@0.14.0

### Minor Changes

- feat: support `optimizeBundleSize` option to remove unused code for
main-thread and background.
([#2336](#2336))

- If `optimizeBundleSize` is `true` or `optimizeBundleSize.background`
is `true`, `lynx.registerDataProcessors` calls will be marked as pure
for the background thread output.
- If `optimizeBundleSize` is `true` or `optimizeBundleSize.mainThread`
is `true`, `NativeModules.call` and `lynx.getJSModule` calls will be
marked as pure for the main-thread output.

### Patch Changes

- refactor: remove `modifyWebpackChain` since Rsbuild 2.0 dropped
webpack support
([#2397](#2397))

- Updated dependencies
\[[`9193711`](9193711)]:
    -   @lynx-js/template-webpack-plugin@0.10.7
    -   @lynx-js/css-extract-webpack-plugin@0.7.0
    -   @lynx-js/react-webpack-plugin@0.8.0
    -   @lynx-js/react-alias-rsbuild-plugin@0.14.0
    -   @lynx-js/use-sync-external-store@1.5.0
    -   @lynx-js/react-refresh-webpack-plugin@0.3.5

## @lynx-js/web-core@0.20.0

### Minor Changes

- **This is a breaking change**
([#2322](#2322))

    ## Architectural Upgrade: `web-core-wasm` replaces `web-core`

This release marks a major architectural upgrade for the web platform.
The experimental, WASM-powered engine formerly known as `web-core-wasm`
has been fully stabilized and merged into the main branch, completely
replacing the previous pure JS/TS based `web-core` implementation. This
consolidation massively improves execution performance and aligns the
API boundaries of the Web platform directly with other native Lynx
implementations.

    ### 🎉 Added Features

- **Core API Enhancements**: Successfully exposed and supported
`__QuerySelector` and `__InvokeUIMethod` methods.
- **Security & CSP Compliance**: Added a `nonce` attribute to the
iframe's `srcdoc` script execution, strengthening Content Security
Policy (CSP) compliance.
    -   **`<lynx-view>` Parameter Enhancements**:
- Added the `browser-config` attribute and property to `<lynx-view>`.
Development environments can now supply a `BrowserConfig` object (e.g.,
configuring `pixelRatio`, `pixelWidth`, `pixelHeight`) allowing the
`systemInfo` payload to be dynamically configured at the instance level.

    ### 🔄 Changed Features

- **Legacy JSON Backwards Compatibility**: Delivered comprehensive fixes
and optimizations to deeply support legacy JSON output templates:
- Added support for lazy loading execution mode (`lazy usage`).
- Implemented the correct decoding and handling of `@keyframe` animation
rules.
- Rectified rule scoping matching including scoped CSS, root selectors,
and type selectors.

- **Ecosystem Migration**: Updated testing and ecosystem applications
(such as `web-explorer` and `shell-project`) to migrate away from
obsolete fragmented dependencies. The new WASM architecture seamlessly
integrates Element APIs and CSS directly inside the core client module,
requiring a much simpler initialization footprint.

        **Before (Legacy `web-core` + `web-elements`):**

        ```typescript
        // Required multiple imports to assemble the environment
        import "@lynx-js/web-core/client";
import type { LynxViewElement as LynxView } from "@lynx-js/web-core";

        // Had to manually import separate elements and their CSS
        import "@lynx-js/web-elements/index.css";
        import "@lynx-js/web-elements/all";

const lynxView = document.createElement("lynx-view") as LynxView;
        // ...
        ```

        **After (New `web-core` unified architecture):**

        ```typescript
// The new engine natively registers Web Components and injects
fundamental CSS
        import "@lynx-js/web-core/client";
import type { LynxViewElement as LynxView } from
"@lynx-js/web-core/client";

const lynxView = document.createElement("lynx-view") as LynxView;
        // ...
        ```

_(Applications can now drop `@lynx-js/web-elements` entirely from their
`package.json` dependencies)._

- **Dependency & Boot Sequence Improvements**: Re-architected module
loading pathways. Promoted `wasm-feature-detect` directly to a core
dependency, and hardened the web worker count initialization assertions.

- **Initialization Optimizations**: Converted `SERVER_IN_SHADOW_CSS`
initialization bounds to use compilation-time constant expressions for
better optimization.

    ### 🗑️ Deleted Features & Structural Deprecations

    -   **`<lynx-view>` Parameter Removals**:
- Removed the `thread-strategy` property and attribute. Historically,
this permitted consumers to toggle between `'multi-thread'` and
`'all-on-ui'` modes depending on how they wanted the background logic to
be executed. The WASM-driven architecture enforces a consolidated
concurrency model, deprecating this `<lynx-view>` attribute entirely.
- Removed the `overrideLynxTagToHTMLTagMap` property/attribute. HTML tag
overriding mechanism has been deprecated in the new engine.
- Removed the `customTemplateLoader` property handler from
`<lynx-view>`.
- Removed the `inject-head-links` property and attribute
(`injectHeadLinks`), which previously was used to automatically inject
`<link rel="stylesheet">` tags from the document head into the
`lynx-view` shadow root.
- **Fragmented Packages Removal**: The new cohesive WASM architecture
native to `@lynx-js/web-core` handles cross-thread communication, worker
boundaries, and rendering loops uniformly. Consequently, multiple
obsolete packages have been completely removed from the workspace:
        -   `@lynx-js/web-mainthread-apis`
        -   `@lynx-js/web-worker-runtime`
        -   `@lynx-js/web-core-server`
- `@lynx-js/web-core-wasm-e2e` (transitioned into standard test suites)

- Added support for `rpx` unit
([#2377](#2377))

    **This is a breaking change**

    The following Styles has been added to `web-core`

    ```css
    lynx-view {
      width: 100%;
      container-name: lynx-view;
      container-type: inline-size;
      --rpx-unit: 1cqw;
    }
    ```

    Check MDN for the details about these styles:

-
<https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/container-name>
-
<https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/container-type>
-
<https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Containment/Container_queries>

    ### how it works?

    For the following code

    ```html
    <view style="height:1rpx"></view>
    ```

    it will be transformed to

    ```html
    <view style="height:calc(1 * var(--rpx-unit))"></view>
    ```

Therefore you could use any `<length>` value to replace the unit, for
example:

    ```html
    <lynx-view style="--rpx-unit:1px"></lynx-view>
    ```

    By default, the --rpx-unit value is `1cqw`

- Added support for transform `vw` and `vh` unit
([#2377](#2377))

Add `transform-vw` and `transform-vh` attributes and properties on
`<lynx-view>`.

    For the following code

    ```html
    <view style="height:1vw"></view>
    ```

If the `transform-vw` is enabled `<lynx-view transform-vw="true">`, it
will be transformed to

    ```html
    <view style="height:calc(1 * var(--vw-unit))"></view>
    ```

Therefore you could use any `<length>` value to replace the unit, for
example:

    ```html
    <lynx-view style="--vw-unit:1px"></lynx-view>
    ```

### Patch Changes

- feat(web-core): add `is_bubble` parameter to `common_event_handler` to
properly handle non-bubbling events like `window.Event('click', {
bubbles: false })`.
([#2399](#2399))

- chore: update readme
([#2380](#2380))

- fix: the output format should be module
([#2388](#2388))

- opt: use opt-level 3 to compile wasm
([#2371](#2371))

- fix(web-core): avoid partial bundle loading and double fetching when
fetchBundle is called concurrently for the same url.
([#2386](#2386))

- fix(web-core): fallback to the original export chunk when
`processEvalResult` is absent during `queryComponent` execution
([#2399](#2399))

- fix: tokenizing inline style values correctly to support rpx and ppx
unit conversion
([#2381](#2381))

This fixes an issue where the `transform_inline_style_key_value_vec` API
bypassed the CSS tokenizer, preventing dimension units like `rpx` or
`ppx` from being successfully transformed into `calc` strings when
specified via inline styles.

- feat: add mts lynx.querySelectorAll API
([#2382](#2382))

- fix: mts in lazy component
([#2375](#2375))

- fix: enableJSDataProcessor not work
([#2372](#2372))

- feat: add `ppx` unit support for CSS, transforming to `calc(... *
var(--ppx-unit))` directly.
([#2381](#2381))

-   Updated dependencies \[]:
    -   @lynx-js/web-worker-rpc@0.20.0

## @lynx-js/externals-loading-webpack-plugin@0.1.0

### Minor Changes

- **BREAKING CHANGE**:
([#2370](#2370))

Simplify the API for external bundle builds by `externalsPresets` and
`externalsPresetDefinitions`.

## @lynx-js/devtool-connector@0.1.1

### Patch Changes

- fix: align GlobalKeys with Android DevToolSettings keys and filter
global switch responses
([#2392](#2392))

## @lynx-js/devtool-mcp-server@0.5.1

### Patch Changes

- Updated dependencies
\[[`95fff27`](95fff27)]:
    -   @lynx-js/devtool-connector@0.1.1

## @lynx-js/react@0.117.1

### Patch Changes

- Update preact version to simplify `setProperty` implementation
([#2367](#2367))

## @lynx-js/react-umd@0.117.1

### Patch Changes

- Add a new `entry` export to `@lynx-js/react-umd` for reuse by wrapper
libraries of `@lynx-js/react`.
([#2370](#2370))

## create-rspeedy@0.14.0

### Patch Changes

- Add optional Lynx DevTool skill.
([#2421](#2421))

- move Vitest integration to create-rstack extraTools and merge the
Vitest templates into a single incremental overlay
([#2408](#2408))

## @lynx-js/kitten-lynx-test-infra@0.1.2

### Patch Changes

- Updated dependencies
\[[`95fff27`](95fff27)]:
    -   @lynx-js/devtool-connector@0.1.1

## @lynx-js/template-webpack-plugin@0.10.7

### Patch Changes

- use path.posix.format instead of path.format to ensure consistent path
separators across platforms
([#2359](#2359))

- Updated dependencies
\[[`75960cd`](75960cd),
[`518c310`](518c310),
[`863469e`](863469e),
[`dc18c5c`](dc18c5c),
[`7d242f3`](7d242f3),
[`62bebcf`](62bebcf),
[`75960cd`](75960cd),
[`182f568`](182f568),
[`1aa051d`](1aa051d),
[`6b46f7e`](6b46f7e),
[`fcda36a`](fcda36a),
[`182f568`](182f568),
[`138f727`](138f727),
[`138f727`](138f727)]:
    -   @lynx-js/web-core@0.20.0

## @lynx-js/react-alias-rsbuild-plugin@0.14.0



## upgrade-rspeedy@0.14.0



## @lynx-js/web-rsbuild-server-middleware@0.20.0



## @lynx-js/web-worker-rpc@0.20.0

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants