revert: "feat(text): expose trimmedHeight on text nodes (#30)"#35
Merged
Conversation
This reverts commit 965999b.
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
Reverts #30. Removes the
node.trimmedHeightgetter, thetrimmedHeightfield on theloadedevent payload, and the supporting calc in both renderers.This reverts commit
965999b282851938f0a73ccd288acbf32350e2c7exactly — 5 files, 69 deletions, mechanical inverse.Why
trimmedHeightwas introduced as a way for callers to tightly size a text node to its visible ink — e.g.node.h = payload.trimmedHeightafterloadedso flexboxalignItems: 'center'would optically center the glyphs.Investigation found two problems with the API as shipped:
The documented snippet doesn't work.
set h()onCoreTextNodeis overridden to setmaxHeightinstead ofprops.h— sonode.h = payload.trimmedHeightis silently rewritten tonode.maxHeight = trimmedHeight, which is a layout constraint, not a dimension. Result: a wasted re-layout invalidation, no change to the visible bounding box, and (worse) lines silently dropped whenmaxHeight < 2 × lineHeightPx.It's the wrong tool for centering anyway. With the default
textBaselineMode: 'optical'(or'cap', or'x'), the math already places the optical center of the text atlineHeightPx / 2 = node.h / 2. Dropping a text node into a parent and usingmountY: 0.5already perfectly centers the visible ink — notrimmedHeightneeded, no API surface required.For the rarer case of "I want the node's box to hug the ink" (tight chips/badges in a flex row), the right shape is a dedicated
textBoxTrimprop modeled after CSStext-box-trim— explicit, declarative, and it can actually update the texture/baselines coherently. That's a future addition; not in this PR.What stays
Nothing else from #30 had external users that we could find —
grepfortrimmedHeightafter this revert returns no matches insrc/,examples/tests/, ortest/. Safe removal.Test plan
pnpm build,pnpm test, visual regression)🤖 Generated with Claude Code