feat(direction): populate TableAttrs.tableDirectionContext in pm-adapter (SD-3138 Phase 1B)#3285
Merged
Merged
Conversation
1ddf6cd to
263b06c
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…ter (SD-3138 Phase 1B) Phase 1A (PR #3279) landed the getTableVisualDirection helper and migrated three consumers. The helper preferred a resolved TableDirectionContext but pm-adapter never wrote one - consumers fell through to the legacy fallback path on every read. Phase 1B closes the loop: - Add tableDirectionContext?: TableDirectionContext to TableAttrs in @superdoc/contracts (mirrors directionContext on ParagraphAttrs from Wave 1a / SD-2776). - In pm-adapter table.ts, resolve the effective table direction from cascade-resolved table properties (style cascade + inline override) and write the result via resolveTableDirection. The cascade resolution uses style-engine's resolveTableProperties for the style chain and `??` to layer inline on top. Because `??` treats null/undefined as missing but preserves explicit false, inline w:bidiVisual w:val="0" correctly overrides a style cascade true and produces visualDirection: 'ltr' (relies on SD-3141 resolver symmetry). After this lands, the helper's fast path is exercised at runtime: - Inline true → 'rtl' - Style cascade true → 'rtl' - Inline false overriding style true → 'ltr' - Absent signal → undefined Tests: - 4 new converter tests for the cascade scenarios above - pm-adapter: 1836 tests pass - painter table: 174 tests pass
263b06c to
c52569c
Compare
Contributor
|
🎉 This PR is included in vscode-ext v2.3.0-next.137 |
Contributor
|
🎉 This PR is included in @superdoc-dev/react v1.2.0-next.135 The release is available on GitHub release |
Contributor
|
🎉 This PR is included in @superdoc-dev/mcp v0.3.0-next.92 The release is available on GitHub release |
Contributor
|
🎉 This PR is included in superdoc-cli v0.8.0-next.107 The release is available on GitHub release |
Contributor
|
🎉 This PR is included in superdoc v1.30.0-next.88 The release is available on GitHub release |
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.
Closes SD-3138 Phase 1B. Phase 1A (#3279) landed the
getTableVisualDirectionhelper and migrated three consumers. The helper preferred a resolvedTableDirectionContextbut pm-adapter never wrote one — consumers fell through to the legacy fallback path on every read. This PR closes the loop.What lands
tableDirectionContext?: TableDirectionContexttoTableAttrsin@superdoc/contracts. Mirrors thedirectionContextfield onParagraphAttrsshipped by Wave 1a (SD-2776).pm-adapter/src/converters/table.ts, resolve the effective table direction from cascade-resolved table properties (style cascade + inline override) and write the result viaresolveTableDirection.Cascade semantics
Inline
w:bidiVisualwins over the style cascade; explicitfalseoverrides a cascadetrueper §17.4.1 + §17.17.4. Aliases (rightToLeft/bidiVisual) are normalized to a single signal per layer before layering inline over style, so an inlinebidiVisual: falsecorrectly overrides a stylerightToLeft: true. Relies on the SD-3141 resolver-symmetry fix already inmain.Verified scenarios (6 new converter tests):
rightToLeft: true→'rtl'rightToLeft: true→'rtl'falseoverriding style cascadetrue→'ltr'bidiVisual: falseoverriding stylerightToLeft: true→'ltr'undefinedtableDirectionContext.parentSectionpropagates fromconverterContext.sectionDirectionContextTests:
Layout-comparison heads-up: Adding
tableDirectionContexttoTableAttrsintroduces a new field that the layout JSON serializer will emit for table-bearing documents. Expect schema-evolution diffs inpnpm layout:compareuntil the reference baseline is updated through the normal layout process; the diffs are additive (new field present in candidate, absent in reference) and not a behavior regression.Sequencing: companion to #3279 (Phase 1A), #3283 (SD-3141 resolver symmetry — required, already merged), and #3284 (SD-3142 export preservation — independent, already merged). After this lands, all Wave 3 architectural foundation tickets close.