fix(runtime): support CSS v-bind() on Lynx native#144
Conversation
…tarting dev watch
- Move use-css-vars.md and LYNX-ISSUES.md from runtime/src/ to packages/vue-lynx/docs/ so rslib does not try to bundle them - Restore root package.json private: true (was accidentally set to false)
…seCssVars
Two critical fixes:
1. Add onBeforeUpdate + onMounted wrapping (matching upstream Vue):
- patchProp's SET_STYLE overwrites CSS vars on every re-render since
it doesn't know about them. Without onBeforeUpdate, CSS vars silently
vanish whenever a style binding changes but the CSS var value doesn't.
- VNode tree changes (v-if, v-for) also need CSS vars re-applied to
newly created root elements.
2. Restrict SF_ARRAY_CHILDREN walking to Fragment vnodes only:
- The standalone `if (shapeFlag & SF_ARRAY_CHILDREN)` also fired for
element vnodes with children, applying CSS vars to every descendant
element (O(N) SET_STYLE ops). Root elements are sufficient since
enableCSSInheritance cascades vars to descendants.
- Move v-bind() from "Upcoming" to "Works (requires config)" - Add required config snippet (enableCSSInlineVariables + enableCSSInheritance) - Document the known layout-property limitation - Remove the workaround snippet (no longer needed) - Update both EN and ZH versions
Revert element-registry.ts and TransitionGroup.ts type annotation changes that were rejected in PR Huxpro#122 review. Add changeset for the v-bind() CSS vars feature.
|
@KealanAU is attempting to deploy a commit to the huxpro's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@KealanAU Thanks for the thorough investigation and the detailed PR description -- the root cause analysis of the Lynx engine's CSS var inheritance gap is spot on, and the isolation test ( I've been digging into this and wanted to share where I've landed. What we've verifiedI traced through the Lynx engine source and confirmed the bug. The root cause is that I also verified on Lynx Explorer 3.8 that same-element CSS vars (set and consumed on the same element via inline Separate fix for entry.tsThe Performance concerns with
|
|
@Huxpro I totally agree that O(N) is terrible to pay on every change. I'm happy to wait for I did think it was still an upstream issue that would need to be resolved, and had made the Thanks for splitting it off into its own PR for the other fix and the deeper dive. I was |
|
@KealanAU I just confirmed that we can make it work by fixing lynx#5889! I'll see what the nearest release I can land it in is. Thanks for the detailed issue analysis and the comprehensive CSS feature tests! I'll get back to you when it's landed.
|
Resolves conflict in entry.ts: both sides had the same fix (sourceContent.config instead of compilerOptions). Also includes the stampElementDescendants workaround removal and root-only stamping tests from the current session.
ebb4ef3 to
e80ced0
Compare
|
The engine fix is merged lynx-family/lynx#5912 and will be released in 3.8 (May) |
|
@Huxpro , Perfect, I'll remove the work around then and we can merge in May |
Engine fix lynx-family/lynx#5912 landed; root-only stamping is the correct description, not "every element".
Huxpro
left a comment
There was a problem hiding this comment.
Blocking from my side: this adds user-facing v-bind() support/docs that appear to depend on the newer Lynx engine/toolchain surface, but the compatibility baseline is still ambiguous here.
If this lands before #192, readers can reasonably take the docs as applying to the default current toolchain, while the required support may only exist on the newer release line. I think this either needs to be explicitly stacked after #192 or the docs need to state the minimum required Lynx engine/toolchain version very clearly.
Also, the linked Lynx issue references should be reconciled. I saw both lynx#5912 and lynx#5889 in the surrounding discussion/context, and that kind of mismatch makes the support story harder to trust.
…ersion Standardize all references on the fix PR (#5912, closing issue #5889) and document that v-bind() in CSS requires Lynx engine >= 3.8.1.
|
Thanks — both addressed. Issue references: the two numbers are an issue↔fix pair, not a mismatch. lynx-family/lynx#5912 is the fix PR; it closes issue #5889. Every mention in the code comments, the spec, the changeset, and the docs now reads "#5912 (closing #5889)" consistently. Compatibility baseline: you're right that this depends on the engine fix in #5912, which ships in the 3.8.1 line. I've made the requirement explicit:
|

Summary
Adds Background-Thread-safe support for
v-bind()in Vue<style>blocks on Lynx native.enableCSSInheritanceguidance.Compatibility
Verification
pnpm test:localinpackages/upstream-testsbackground-color,color,font-size, andopacityall update via CSSv-bind().CleanShot.2026-04-05.at.15.29.59.mp4
CleanShot.2026-04-05.at.15.07.14.mp4