Deprecate RenderingModifiers#27
Open
alexandercerutti wants to merge 14 commits into
Open
Conversation
…enderingModifiers from webvtt-adapter
…o make it parse the attributes line itself
… of having an unused attribute regionName
…r to replace RenderingModifiers; set text-align style to become emitted directly in the entities instead of RM
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR deprecates the RenderingModifiers BYO API and updates the WebVTT adapter to derive cue rendering geometry (position/size/align) via Regions instead of a dedicated RenderingModifiers implementation.
Changes:
- Remove the WebVTT-specific
WebVTTRenderingModifiersparser and store raw cue settings on parsed cues. - Add
deriveRegionFromCueSettings()to convert WebVTT cue settings into a derivedRegionused by the adapter. - Deprecate remaining RenderingModifiers entry points and add renderer tests asserting region geometry and text alignment come from Regions/cue settings.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/webvtt-adapter/src/Parser/RenderingModifiers.ts | Removes WebVTT RenderingModifiers implementation. |
| packages/webvtt-adapter/src/Parser/parseRegion.ts | Exports WebVTTRegion and adds region derivation from cue settings. |
| packages/webvtt-adapter/src/Parser/parseCue.ts | Replaces renderingModifiers parsing with settings parsing. |
| packages/webvtt-adapter/src/Adapter.ts | Uses derived regions for cues and injects cue align into line style entities. |
| packages/captions-renderer/src/TreeOrchestrator.ts | Marks trackRenderingModifiers as deprecated in favor of region. |
| packages/captions-renderer/src/index.ts | Deprecates region-modifier helper in favor of Regions. |
| packages/captions-renderer/specs/renderer.spec.pw.ts | Adds Playwright tests asserting cue settings affect region geometry/text-align. |
| packages/adapter-utils/src/RenderingModifiers.ts | Deprecates the RenderingModifiers interface. |
| packages/adapter-utils/src/CueNode.ts | Deprecates CueNode.renderingModifiers in favor of Regions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| region?.viewportanchor?.[1] ?? DEFAULT_VIEWPORT_ANCHOR_Y, | ||
| ]; | ||
|
|
||
| derivedRegion.id = `derived:${region?.id ?? "default"}`; |
Comment on lines
+252
to
+258
| const integerPosition = (pos.endsWith("%") && parseInt(pos)) || NaN; | ||
|
|
||
| if (!Number.isNaN(integerPosition)) { | ||
| return [Math.min(Math.max(0, integerPosition), 100), positionAlignment]; | ||
| } | ||
|
|
||
| return [0, positionAlignment]; |
Comment on lines
618
to
619
| }); | ||
|
|
||
| describe("RenderingModifiers", () => { | ||
| it("should return default values if no attributes string is provided", () => { | ||
| const modifier1 = WebVTTRenderingModifiers.fromString(""); | ||
|
|
||
| expect(modifier1.leftOffset).toBe(0); | ||
| expect(modifier1.regionIdentifier).toBeUndefined(); | ||
| expect(modifier1.textAlignment).toBe("center"); | ||
| expect(modifier1.width).toBe(100); | ||
|
|
||
| const modifier2 = new WebVTTRenderingModifiers(); | ||
|
|
||
| expect(modifier2.leftOffset).toBe(0); | ||
| expect(modifier2.regionIdentifier).toBeUndefined(); | ||
| expect(modifier2.textAlignment).toBe("center"); | ||
| expect(modifier2.width).toBe(100); | ||
| }); | ||
| }); | ||
| }); |
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.
This PR deprecates
RenderingModifiersBYO API and removes it from WebVTT implementation. There, it is replaced with Region derivation.Closes #26.