refactor(painter-dom): rename rtl-paragraph feature to inline-direction (SD-2779)#3307
Merged
caio-pizzol merged 2 commits intoMay 14, 2026
Merged
Conversation
…on (SD-2779) The painter-dom feature module previously called `features/rtl-paragraph/` handles two related but distinct OOXML elements: w:pPr/w:bidi (paragraph inline direction) and w:rPr/w:rtl (run inline direction). Both belong to the inline-direction axis. Table visual direction (w:bidiVisual) and writing mode (w:textDirection) are separate orthogonal axes owned elsewhere. Rename the folder + import path + feature-registry entry to `inline-direction` so the module name matches the axis, and add an explicit note (registry comment + index.ts JSDoc) calling out the two orthogonal axes the module does NOT own. Internal file (`rtl-styles.ts`) and exported function names (`applyRtlStyles`, `shouldUseSegmentPositioning`, `isRtlParagraph`, `resolveTextAlign`) keep their RTL framing because they describe RTL detection and styling specifically. Only the feature folder name changes. Tests: painter-dom 1070 pass. Build sweep (`pnpm --filter @superdoc/painter-dom... build`) clean.
…note §17.18.93 is ST_TextDirection (the enum values), not the element location. w:textDirection lives at §17.3.1.41 (paragraph) and §17.4.72 (cell). Also soften the "inline direction" framing to "paragraph/run inline bidi handling": w:rPr/w:rtl is a run-level bidi/RTL/CS trigger, not strictly a paragraph base-direction signal. Comment-only; no code change.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
|
🎉 This PR is included in superdoc v1.30.0-next.95 The release is available on GitHub release |
Contributor
|
🎉 This PR is included in @superdoc-dev/mcp v0.3.0-next.101 The release is available on GitHub release |
Contributor
|
🎉 This PR is included in vscode-ext v2.3.0-next.147 |
Contributor
|
🎉 This PR is included in @superdoc-dev/react v1.2.0-next.145 The release is available on GitHub release |
Contributor
|
🎉 This PR is included in superdoc-cli v0.8.0-next.116 The release is available on GitHub release |
Contributor
|
🎉 This PR is included in superdoc-sdk v1.8.0-next.99 |
caio-pizzol
added a commit
that referenced
this pull request
May 16, 2026
…ine-direction The shouldAssignPerRunRtlDir / normalizeRtlDateTokenForWordParity helpers and their regexes (RTL_DATE_LIKE_TOKEN_RE, STRONG_RTL_CHAR_RE, LATIN_DIGIT_NEUTRAL_ONLY_RE) lived at the bottom of renderer.ts. After #3307 moved the rtl-paragraph feature folder to inline-direction with an explicit axis scope, the renderer was the wrong home: these helpers are paint-time decisions about how to project w:rPr/w:rtl onto a rendered span's dir attribute, which is exactly what features/inline-direction owns. Extract into features/inline-direction/run-direction.ts: - Combine the two-step decision (set dir=rtl? else set dir=ltr for date-like?) into a single resolveRunDirectionAttribute helper that returns 'rtl' | 'ltr' | null. - Expose normalizeRtlDateTokenForWordParity alongside since it shares RTL_DATE_LIKE_TOKEN_RE. - Inline the decision table as JSDoc, explicitly scoping the heuristic to current SD-3098 fixtures and pointing at the spec sections plus the known follow-up gaps (w:dir, w:bdo, w:lang/@bidi numeric, presentation forms). Renderer collapses the per-span direction logic to one helper call. 22 new unit tests in run-direction.test.ts cover both branches of the rtl-tagged decision table, the date-like ltr fallback for non-tagged runs, and the regex coverage smoke tests.
msviderok
pushed a commit
to msviderok/superdoc
that referenced
this pull request
May 16, 2026
…on (SD-2779) (superdoc-dev#3307) * refactor(painter-dom): rename rtl-paragraph feature to inline-direction (SD-2779) The painter-dom feature module previously called `features/rtl-paragraph/` handles two related but distinct OOXML elements: w:pPr/w:bidi (paragraph inline direction) and w:rPr/w:rtl (run inline direction). Both belong to the inline-direction axis. Table visual direction (w:bidiVisual) and writing mode (w:textDirection) are separate orthogonal axes owned elsewhere. Rename the folder + import path + feature-registry entry to `inline-direction` so the module name matches the axis, and add an explicit note (registry comment + index.ts JSDoc) calling out the two orthogonal axes the module does NOT own. Internal file (`rtl-styles.ts`) and exported function names (`applyRtlStyles`, `shouldUseSegmentPositioning`, `isRtlParagraph`, `resolveTextAlign`) keep their RTL framing because they describe RTL detection and styling specifically. Only the feature folder name changes. Tests: painter-dom 1070 pass. Build sweep (`pnpm --filter @superdoc/painter-dom... build`) clean. * docs(direction): correct OOXML spec citations on the orthogonal-axis note §17.18.93 is ST_TextDirection (the enum values), not the element location. w:textDirection lives at §17.3.1.41 (paragraph) and §17.4.72 (cell). Also soften the "inline direction" framing to "paragraph/run inline bidi handling": w:rPr/w:rtl is a run-level bidi/RTL/CS trigger, not strictly a paragraph base-direction signal. Comment-only; no code change.
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.
The painter-dom feature module at
features/rtl-paragraph/handles two related but distinct OOXML elements:w:pPr/w:bidi(paragraph bidirectional flag) andw:rPr/w:rtl(run-level RTL trigger). Both belong to paragraph/run inline bidi handling. Thertl-paragraphfolder name was inherited from earlier work and is now misleading - table visual direction (w:bidiVisual, §17.4.1) and writing mode (w:textDirection, §17.3.1.41 paragraph / §17.4.72 cell; values in §17.18.93ST_TextDirection) are separate orthogonal axes owned elsewhere.Rename the folder, import path, and feature-registry entry to
inline-directionso the module name matches the axis. Add an explicit note (registry comment + index.ts JSDoc) calling out the orthogonal axes the module does NOT own, so a future reader who reaches for this folder for table direction or writing-mode work lands on the right pointer.Internal file (
rtl-styles.ts) and exported function names (applyRtlStyles,shouldUseSegmentPositioning,isRtlParagraph,resolveTextAlign) keep their RTL framing because they describe RTL detection and styling specifically. Only the feature folder name changes.Tests: painter-dom 1070 pass.
pnpm --filter @superdoc/painter-dom... build(transitive type check) clean.Closes the direction-taxonomy cleanup wave alongside SD-2777 (#3279 + #3285) and SD-2778 (#3289 + #3290).