feat(core): pt units, table height as min-height, honor td width% - #7
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
Fixes three rendering gaps that real-world email/CMS HTML (TinyMCE, Google Docs exports) exposed:
ptunits were silently dropped,heighton table cells acted as a hard cap instead of a minimum, and a cell'swidthwas ignored in row layout. A production email template's CTA button rendered as an empty blue chip — its white 16pt label fell back to 14px and overflowed the fixed-height cell onto the page background.Changes
parsePxnow acceptsptat the CSS ratio 1pt = 4⁄3px, everywhere lengths are parsed (font-size,line-height, margins/paddings, borders, dimensions).heightontable/tr/td/this remapped tominHeightat build time (browser table semantics, CSS 2.1 §17.5); an explicit largermin-heightstill wins;heighton non-table elements is unchanged.widthnow shapes the row: all-percent rows distribute columns proportionally to their percents (15%/33%/15% keeps the 15:33:15 ratio); mixed rows pin sized cells viaflexBasisand let widthless cells share the remainder; width-free rows keep the oldflex: colspanbehavior. Logic lives in a new pure modulerenderer/table-layout.ts.ptparsing, height→minHeight mapping (incl. min-height merge and non-table exemption), and a fullresolveRowCellFlexsuite — the first renderer-side logic with jest coverage (the module has no react-native imports).Test plan
npm run typecheckpassesnpm testpasses (164 tests: 145 core incl. new suites, 19 video)npm run buildsucceedscd example && npx tsc --noEmitpassesBreaking changes
No API changes. Rendering behavior changes for existing content, gated by the minor bump (0.3 → 0.4, outside
^0.3.0):ptsizes now apply, so text set inptchanges size.Migration: to keep old behavior for specific content, strip the relevant declarations via
ignoredStyles={['width']}/['height']/['fontSize'].