@tscaps/engine 0.1.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -4
- package/dist/modules/css/CssScoper.d.ts +21 -1
- package/dist/modules/css/CssScoper.d.ts.map +1 -1
- package/dist/modules/css/CssScoper.js +129 -56
- package/dist/modules/css/CssScoper.js.map +1 -1
- package/dist/modules/css/CssVarReferenceScanner.d.ts +13 -0
- package/dist/modules/css/CssVarReferenceScanner.d.ts.map +1 -0
- package/dist/modules/css/CssVarReferenceScanner.js +20 -0
- package/dist/modules/css/CssVarReferenceScanner.js.map +1 -0
- package/dist/modules/css/index.d.ts +1 -0
- package/dist/modules/css/index.d.ts.map +1 -1
- package/dist/modules/css/index.js +1 -0
- package/dist/modules/css/index.js.map +1 -1
- package/dist/modules/document/CssVariable.d.ts +24 -3
- package/dist/modules/document/CssVariable.d.ts.map +1 -1
- package/dist/modules/document/CssVariable.js +30 -2
- package/dist/modules/document/CssVariable.js.map +1 -1
- package/dist/modules/document/Decoration.d.ts +42 -0
- package/dist/modules/document/Decoration.d.ts.map +1 -0
- package/dist/modules/document/Decoration.js +52 -0
- package/dist/modules/document/Decoration.js.map +1 -0
- package/dist/modules/document/Document.d.ts.map +1 -1
- package/dist/modules/document/Document.js +0 -3
- package/dist/modules/document/Document.js.map +1 -1
- package/dist/modules/document/DocumentEditor.d.ts +11 -0
- package/dist/modules/document/DocumentEditor.d.ts.map +1 -1
- package/dist/modules/document/DocumentEditor.js +49 -9
- package/dist/modules/document/DocumentEditor.js.map +1 -1
- package/dist/modules/document/Line.d.ts +9 -6
- package/dist/modules/document/Line.d.ts.map +1 -1
- package/dist/modules/document/Line.js +11 -24
- package/dist/modules/document/Line.js.map +1 -1
- package/dist/modules/document/Section.d.ts +0 -4
- package/dist/modules/document/Section.d.ts.map +1 -1
- package/dist/modules/document/Section.js +2 -18
- package/dist/modules/document/Section.js.map +1 -1
- package/dist/modules/document/Segment.d.ts +10 -7
- package/dist/modules/document/Segment.d.ts.map +1 -1
- package/dist/modules/document/Segment.js +15 -22
- package/dist/modules/document/Segment.js.map +1 -1
- package/dist/modules/document/Tag.d.ts +3 -0
- package/dist/modules/document/Tag.d.ts.map +1 -1
- package/dist/modules/document/Tag.js +3 -0
- package/dist/modules/document/Tag.js.map +1 -1
- package/dist/modules/document/Word.d.ts +20 -7
- package/dist/modules/document/Word.d.ts.map +1 -1
- package/dist/modules/document/Word.js +32 -34
- package/dist/modules/document/Word.js.map +1 -1
- package/dist/modules/document/index.d.ts +1 -0
- package/dist/modules/document/index.d.ts.map +1 -1
- package/dist/modules/document/index.js +1 -0
- package/dist/modules/document/index.js.map +1 -1
- package/dist/modules/effect/CarryQuotesEffect.d.ts +1 -7
- package/dist/modules/effect/CarryQuotesEffect.d.ts.map +1 -1
- package/dist/modules/effect/CarryQuotesEffect.js +17 -30
- package/dist/modules/effect/CarryQuotesEffect.js.map +1 -1
- package/dist/modules/effect/RemovePunctuationEffect.d.ts +10 -2
- package/dist/modules/effect/RemovePunctuationEffect.d.ts.map +1 -1
- package/dist/modules/effect/RemovePunctuationEffect.js +26 -6
- package/dist/modules/effect/RemovePunctuationEffect.js.map +1 -1
- package/dist/modules/effect/SmartLowercaseEffect.d.ts +7 -6
- package/dist/modules/effect/SmartLowercaseEffect.d.ts.map +1 -1
- package/dist/modules/effect/SmartLowercaseEffect.js +11 -7
- package/dist/modules/effect/SmartLowercaseEffect.js.map +1 -1
- package/dist/modules/pipeline/RenderPipelineBuilder.d.ts +3 -3
- package/dist/modules/pipeline/RenderPipelineBuilder.d.ts.map +1 -1
- package/dist/modules/pipeline/RenderPipelineBuilder.js +11 -6
- package/dist/modules/pipeline/RenderPipelineBuilder.js.map +1 -1
- package/dist/modules/rendering/BrowserSubtitleFrameRenderer.d.ts +19 -25
- package/dist/modules/rendering/BrowserSubtitleFrameRenderer.d.ts.map +1 -1
- package/dist/modules/rendering/BrowserSubtitleFrameRenderer.js +40 -717
- package/dist/modules/rendering/BrowserSubtitleFrameRenderer.js.map +1 -1
- package/dist/modules/rendering/SubtitleFrameRenderer.d.ts +8 -5
- package/dist/modules/rendering/SubtitleFrameRenderer.d.ts.map +1 -1
- package/dist/modules/rendering/index.d.ts +13 -8
- package/dist/modules/rendering/index.d.ts.map +1 -1
- package/dist/modules/rendering/index.js +5 -2
- package/dist/modules/rendering/index.js.map +1 -1
- package/dist/modules/rendering/styles/BaselineCssComposer.d.ts +23 -0
- package/dist/modules/rendering/styles/BaselineCssComposer.d.ts.map +1 -0
- package/dist/modules/rendering/styles/BaselineCssComposer.js +40 -0
- package/dist/modules/rendering/styles/BaselineCssComposer.js.map +1 -0
- package/dist/modules/rendering/styles/BehindActorBaselineCss.d.ts +19 -0
- package/dist/modules/rendering/styles/BehindActorBaselineCss.d.ts.map +1 -0
- package/dist/modules/rendering/styles/BehindActorBaselineCss.js +19 -0
- package/dist/modules/rendering/styles/BehindActorBaselineCss.js.map +1 -0
- package/dist/modules/rendering/styles/DecorationContainerBaselineCss.d.ts +7 -0
- package/dist/modules/rendering/styles/DecorationContainerBaselineCss.d.ts.map +1 -0
- package/dist/modules/rendering/styles/DecorationContainerBaselineCss.js +34 -0
- package/dist/modules/rendering/styles/DecorationContainerBaselineCss.js.map +1 -0
- package/dist/modules/rendering/styles/InlineStyleEmitter.d.ts +27 -0
- package/dist/modules/rendering/styles/InlineStyleEmitter.d.ts.map +1 -0
- package/dist/modules/rendering/styles/InlineStyleEmitter.js +53 -0
- package/dist/modules/rendering/styles/InlineStyleEmitter.js.map +1 -0
- package/dist/modules/rendering/styles/SegmentPaddingCssRuleBuilder.d.ts +15 -0
- package/dist/modules/rendering/styles/SegmentPaddingCssRuleBuilder.d.ts.map +1 -0
- package/dist/modules/rendering/styles/SegmentPaddingCssRuleBuilder.js +33 -0
- package/dist/modules/rendering/styles/SegmentPaddingCssRuleBuilder.js.map +1 -0
- package/dist/modules/rendering/styles/VideoFrameLayerClass.d.ts.map +1 -0
- package/dist/modules/rendering/styles/VideoFrameLayerClass.js.map +1 -0
- package/dist/modules/rendering/subtitle/AbstractAnim.d.ts +13 -0
- package/dist/modules/rendering/subtitle/AbstractAnim.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/AbstractAnim.js +2 -0
- package/dist/modules/rendering/subtitle/AbstractAnim.js.map +1 -0
- package/dist/modules/rendering/subtitle/ActiveRenderSession.d.ts +20 -0
- package/dist/modules/rendering/subtitle/ActiveRenderSession.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/ActiveRenderSession.js +31 -0
- package/dist/modules/rendering/subtitle/ActiveRenderSession.js.map +1 -0
- package/dist/modules/rendering/subtitle/ActiveRenderSessionFactory.d.ts +19 -0
- package/dist/modules/rendering/subtitle/ActiveRenderSessionFactory.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/ActiveRenderSessionFactory.js +41 -0
- package/dist/modules/rendering/subtitle/ActiveRenderSessionFactory.js.map +1 -0
- package/dist/modules/rendering/subtitle/AnimationProbe.d.ts +25 -0
- package/dist/modules/rendering/subtitle/AnimationProbe.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/AnimationProbe.js +198 -0
- package/dist/modules/rendering/subtitle/AnimationProbe.js.map +1 -0
- package/dist/modules/rendering/subtitle/AssetGroupBuilder.d.ts +15 -0
- package/dist/modules/rendering/subtitle/AssetGroupBuilder.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/AssetGroupBuilder.js +26 -0
- package/dist/modules/rendering/subtitle/AssetGroupBuilder.js.map +1 -0
- package/dist/modules/rendering/subtitle/BatchPlan.d.ts +32 -0
- package/dist/modules/rendering/subtitle/BatchPlan.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/BatchPlan.js +2 -0
- package/dist/modules/rendering/subtitle/BatchPlan.js.map +1 -0
- package/dist/modules/rendering/subtitle/BatchPlanner.d.ts +31 -0
- package/dist/modules/rendering/subtitle/BatchPlanner.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/BatchPlanner.js +91 -0
- package/dist/modules/rendering/subtitle/BatchPlanner.js.map +1 -0
- package/dist/modules/rendering/subtitle/PreparedStyle.d.ts +35 -0
- package/dist/modules/rendering/subtitle/PreparedStyle.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/PreparedStyle.js +2 -0
- package/dist/modules/rendering/subtitle/PreparedStyle.js.map +1 -0
- package/dist/modules/rendering/subtitle/PreparedStyleFactory.d.ts +31 -0
- package/dist/modules/rendering/subtitle/PreparedStyleFactory.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/PreparedStyleFactory.js +91 -0
- package/dist/modules/rendering/subtitle/PreparedStyleFactory.js.map +1 -0
- package/dist/modules/rendering/subtitle/SegmentPaintRegionCache.d.ts +13 -0
- package/dist/modules/rendering/subtitle/SegmentPaintRegionCache.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SegmentPaintRegionCache.js +24 -0
- package/dist/modules/rendering/subtitle/SegmentPaintRegionCache.js.map +1 -0
- package/dist/modules/rendering/{SegmentPaintRegionResolver.d.ts → subtitle/SegmentPaintRegionResolver.d.ts} +1 -1
- package/dist/modules/rendering/subtitle/SegmentPaintRegionResolver.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SegmentPaintRegionResolver.js.map +1 -0
- package/dist/modules/rendering/subtitle/SegmentSubtreeDecomposer.d.ts +45 -0
- package/dist/modules/rendering/subtitle/SegmentSubtreeDecomposer.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SegmentSubtreeDecomposer.js +50 -0
- package/dist/modules/rendering/subtitle/SegmentSubtreeDecomposer.js.map +1 -0
- package/dist/modules/rendering/subtitle/SegmentSubtreeHtmlBuilder.d.ts +80 -0
- package/dist/modules/rendering/subtitle/SegmentSubtreeHtmlBuilder.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SegmentSubtreeHtmlBuilder.js +188 -0
- package/dist/modules/rendering/subtitle/SegmentSubtreeHtmlBuilder.js.map +1 -0
- package/dist/modules/rendering/subtitle/SegmentWrapperRenderer.d.ts +45 -0
- package/dist/modules/rendering/subtitle/SegmentWrapperRenderer.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SegmentWrapperRenderer.js +141 -0
- package/dist/modules/rendering/subtitle/SegmentWrapperRenderer.js.map +1 -0
- package/dist/modules/rendering/subtitle/SpriteSheetCompositor.d.ts +46 -0
- package/dist/modules/rendering/subtitle/SpriteSheetCompositor.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SpriteSheetCompositor.js +134 -0
- package/dist/modules/rendering/subtitle/SpriteSheetCompositor.js.map +1 -0
- package/dist/modules/rendering/subtitle/SpriteSheetSizeProber.d.ts +17 -0
- package/dist/modules/rendering/subtitle/SpriteSheetSizeProber.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SpriteSheetSizeProber.js +58 -0
- package/dist/modules/rendering/subtitle/SpriteSheetSizeProber.js.map +1 -0
- package/dist/modules/rendering/subtitle/SvgFilterMaterializer.d.ts +27 -0
- package/dist/modules/rendering/subtitle/SvgFilterMaterializer.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SvgFilterMaterializer.js +40 -0
- package/dist/modules/rendering/subtitle/SvgFilterMaterializer.js.map +1 -0
- package/dist/modules/rendering/subtitle/VideoFrameVarsBuilder.d.ts +42 -0
- package/dist/modules/rendering/subtitle/VideoFrameVarsBuilder.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/VideoFrameVarsBuilder.js +112 -0
- package/dist/modules/rendering/subtitle/VideoFrameVarsBuilder.js.map +1 -0
- package/dist/modules/rendering/types/AlignmentConfig.d.ts.map +1 -0
- package/dist/modules/rendering/types/AlignmentConfig.js.map +1 -0
- package/dist/modules/rendering/types/BehindActorRequirement.d.ts +12 -0
- package/dist/modules/rendering/types/BehindActorRequirement.d.ts.map +1 -0
- package/dist/modules/rendering/types/BehindActorRequirement.js +2 -0
- package/dist/modules/rendering/types/BehindActorRequirement.js.map +1 -0
- package/dist/modules/rendering/types/BoxEdges.d.ts.map +1 -0
- package/dist/modules/rendering/types/BoxEdges.js.map +1 -0
- package/dist/modules/rendering/types/DecorationPlacementSide.d.ts +8 -0
- package/dist/modules/rendering/types/DecorationPlacementSide.d.ts.map +1 -0
- package/dist/modules/rendering/types/DecorationPlacementSide.js +2 -0
- package/dist/modules/rendering/types/DecorationPlacementSide.js.map +1 -0
- package/dist/modules/rendering/{ElementRenderOverrides.d.ts → types/ElementRenderOverrides.d.ts} +1 -1
- package/dist/modules/rendering/types/ElementRenderOverrides.d.ts.map +1 -0
- package/dist/modules/rendering/types/ElementRenderOverrides.js.map +1 -0
- package/dist/modules/rendering/types/InlineStyleMap.d.ts.map +1 -0
- package/dist/modules/rendering/types/InlineStyleMap.js.map +1 -0
- package/dist/modules/rendering/{RenderingConfig.d.ts → types/RenderingConfig.d.ts} +3 -1
- package/dist/modules/rendering/types/RenderingConfig.d.ts.map +1 -0
- package/dist/modules/rendering/types/RenderingConfig.js.map +1 -0
- package/dist/modules/rendering/{ScopedRenderOverride.d.ts → types/ScopedRenderOverride.d.ts} +2 -2
- package/dist/modules/rendering/types/ScopedRenderOverride.d.ts.map +1 -0
- package/dist/modules/rendering/types/ScopedRenderOverride.js.map +1 -0
- package/dist/modules/rendering/types/VideoFrameSource.d.ts.map +1 -0
- package/dist/modules/rendering/types/VideoFrameSource.js.map +1 -0
- package/dist/modules/splitting/BoundaryScoreLimitByCharsSegmentSplitter.d.ts +33 -0
- package/dist/modules/splitting/BoundaryScoreLimitByCharsSegmentSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/BoundaryScoreLimitByCharsSegmentSplitter.js +100 -0
- package/dist/modules/splitting/BoundaryScoreLimitByCharsSegmentSplitter.js.map +1 -0
- package/dist/modules/splitting/FixedTailLineSplitter.d.ts +29 -0
- package/dist/modules/splitting/FixedTailLineSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/FixedTailLineSplitter.js +43 -0
- package/dist/modules/splitting/FixedTailLineSplitter.js.map +1 -0
- package/dist/modules/splitting/index.d.ts +4 -0
- package/dist/modules/splitting/index.d.ts.map +1 -1
- package/dist/modules/splitting/index.js +2 -0
- package/dist/modules/splitting/index.js.map +1 -1
- package/dist/modules/tagging/PauseTagger.d.ts +24 -0
- package/dist/modules/tagging/PauseTagger.d.ts.map +1 -0
- package/dist/modules/tagging/PauseTagger.js +41 -0
- package/dist/modules/tagging/PauseTagger.js.map +1 -0
- package/dist/modules/tagging/StructureTagger.d.ts +1 -1
- package/dist/modules/tagging/StructureTagger.d.ts.map +1 -1
- package/dist/modules/tagging/StructureTagger.js +11 -5
- package/dist/modules/tagging/StructureTagger.js.map +1 -1
- package/dist/modules/tagging/index.d.ts +2 -0
- package/dist/modules/tagging/index.d.ts.map +1 -1
- package/dist/modules/tagging/index.js +1 -0
- package/dist/modules/tagging/index.js.map +1 -1
- package/dist/modules/transcription/VttTranscriber.d.ts +28 -0
- package/dist/modules/transcription/VttTranscriber.d.ts.map +1 -0
- package/dist/modules/transcription/VttTranscriber.js +59 -0
- package/dist/modules/transcription/VttTranscriber.js.map +1 -0
- package/dist/modules/transcription/index.d.ts +1 -0
- package/dist/modules/transcription/index.d.ts.map +1 -1
- package/dist/modules/transcription/index.js +1 -0
- package/dist/modules/transcription/index.js.map +1 -1
- package/dist/modules/video/RenderJob.d.ts +17 -0
- package/dist/modules/video/RenderJob.d.ts.map +1 -1
- package/dist/modules/video/RenderTimeMap.d.ts +50 -0
- package/dist/modules/video/RenderTimeMap.d.ts.map +1 -0
- package/dist/modules/video/RenderTimeMap.js +90 -0
- package/dist/modules/video/RenderTimeMap.js.map +1 -0
- package/dist/modules/video/index.d.ts +8 -1
- package/dist/modules/video/index.d.ts.map +1 -1
- package/dist/modules/video/index.js +4 -0
- package/dist/modules/video/index.js.map +1 -1
- package/dist/modules/video/mediabunny/MediaBunnyTranscodeCoordinator.d.ts +102 -0
- package/dist/modules/video/mediabunny/MediaBunnyTranscodeCoordinator.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/MediaBunnyTranscodeCoordinator.js +199 -0
- package/dist/modules/video/mediabunny/MediaBunnyTranscodeCoordinator.js.map +1 -0
- package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.d.ts +12 -52
- package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.js +25 -190
- package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.js.map +1 -1
- package/dist/modules/video/mediabunny/audio/AudioTrackBridgeFactory.d.ts +7 -0
- package/dist/modules/video/mediabunny/audio/AudioTrackBridgeFactory.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/audio/DefaultAudioTrackBridgeFactory.js +2 -2
- package/dist/modules/video/mediabunny/audio/DefaultAudioTrackBridgeFactory.js.map +1 -1
- package/dist/modules/video/mediabunny/audio/PassthroughAudioTrackBridge.d.ts +2 -0
- package/dist/modules/video/mediabunny/audio/PassthroughAudioTrackBridge.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/audio/PassthroughAudioTrackBridge.js +8 -2
- package/dist/modules/video/mediabunny/audio/PassthroughAudioTrackBridge.js.map +1 -1
- package/dist/modules/video/mediabunny/audio/TranscodeAudioTrackBridge.d.ts +3 -0
- package/dist/modules/video/mediabunny/audio/TranscodeAudioTrackBridge.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/audio/TranscodeAudioTrackBridge.js +9 -2
- package/dist/modules/video/mediabunny/audio/TranscodeAudioTrackBridge.js.map +1 -1
- package/dist/modules/video/mediabunny/codec/CodecPolicy.d.ts +7 -0
- package/dist/modules/video/mediabunny/codec/CodecPolicy.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.d.ts +1 -1
- package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/frame/FrameCompositor.d.ts +9 -2
- package/dist/modules/video/mediabunny/frame/FrameCompositor.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/frame/LayeredFrameCompositor.d.ts +5 -2
- package/dist/modules/video/mediabunny/frame/LayeredFrameCompositor.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/frame/LayeredFrameCompositor.js +8 -2
- package/dist/modules/video/mediabunny/frame/LayeredFrameCompositor.js.map +1 -1
- package/dist/modules/video/mediabunny/painter/CaptionsOverlayFramePainter.d.ts +35 -0
- package/dist/modules/video/mediabunny/painter/CaptionsOverlayFramePainter.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/painter/CaptionsOverlayFramePainter.js +69 -0
- package/dist/modules/video/mediabunny/painter/CaptionsOverlayFramePainter.js.map +1 -0
- package/dist/modules/video/mediabunny/painter/CaptionsOverlayFramePainterFactory.d.ts +23 -0
- package/dist/modules/video/mediabunny/painter/CaptionsOverlayFramePainterFactory.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/painter/CaptionsOverlayFramePainterFactory.js +23 -0
- package/dist/modules/video/mediabunny/painter/CaptionsOverlayFramePainterFactory.js.map +1 -0
- package/dist/modules/video/mediabunny/painter/FramePainter.d.ts +46 -0
- package/dist/modules/video/mediabunny/painter/FramePainter.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/painter/FramePainter.js +2 -0
- package/dist/modules/video/mediabunny/painter/FramePainter.js.map +1 -0
- package/dist/modules/video/mediabunny/painter/TopLayerSource.d.ts +25 -0
- package/dist/modules/video/mediabunny/painter/TopLayerSource.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/painter/TopLayerSource.js +2 -0
- package/dist/modules/video/mediabunny/painter/TopLayerSource.js.map +1 -0
- package/package.json +1 -1
- package/dist/modules/rendering/AlignmentConfig.d.ts.map +0 -1
- package/dist/modules/rendering/AlignmentConfig.js.map +0 -1
- package/dist/modules/rendering/BoxEdges.d.ts.map +0 -1
- package/dist/modules/rendering/BoxEdges.js.map +0 -1
- package/dist/modules/rendering/ElementRenderOverrides.d.ts.map +0 -1
- package/dist/modules/rendering/ElementRenderOverrides.js.map +0 -1
- package/dist/modules/rendering/InlineStyleMap.d.ts.map +0 -1
- package/dist/modules/rendering/InlineStyleMap.js.map +0 -1
- package/dist/modules/rendering/RenderingConfig.d.ts.map +0 -1
- package/dist/modules/rendering/RenderingConfig.js.map +0 -1
- package/dist/modules/rendering/ScopedRenderOverride.d.ts.map +0 -1
- package/dist/modules/rendering/ScopedRenderOverride.js.map +0 -1
- package/dist/modules/rendering/SegmentPaintRegionResolver.d.ts.map +0 -1
- package/dist/modules/rendering/SegmentPaintRegionResolver.js.map +0 -1
- package/dist/modules/rendering/SegmentSubtreeHtmlBuilder.d.ts +0 -58
- package/dist/modules/rendering/SegmentSubtreeHtmlBuilder.d.ts.map +0 -1
- package/dist/modules/rendering/SegmentSubtreeHtmlBuilder.js +0 -132
- package/dist/modules/rendering/SegmentSubtreeHtmlBuilder.js.map +0 -1
- package/dist/modules/rendering/VideoFrameLayerClass.d.ts.map +0 -1
- package/dist/modules/rendering/VideoFrameLayerClass.js.map +0 -1
- package/dist/modules/rendering/VideoFrameSource.d.ts.map +0 -1
- package/dist/modules/rendering/VideoFrameSource.js.map +0 -1
- /package/dist/modules/rendering/{VideoFrameLayerClass.d.ts → styles/VideoFrameLayerClass.d.ts} +0 -0
- /package/dist/modules/rendering/{VideoFrameLayerClass.js → styles/VideoFrameLayerClass.js} +0 -0
- /package/dist/modules/rendering/{SegmentPaintRegionResolver.js → subtitle/SegmentPaintRegionResolver.js} +0 -0
- /package/dist/modules/rendering/{AlignmentConfig.d.ts → types/AlignmentConfig.d.ts} +0 -0
- /package/dist/modules/rendering/{AlignmentConfig.js → types/AlignmentConfig.js} +0 -0
- /package/dist/modules/rendering/{BoxEdges.d.ts → types/BoxEdges.d.ts} +0 -0
- /package/dist/modules/rendering/{BoxEdges.js → types/BoxEdges.js} +0 -0
- /package/dist/modules/rendering/{ElementRenderOverrides.js → types/ElementRenderOverrides.js} +0 -0
- /package/dist/modules/rendering/{InlineStyleMap.d.ts → types/InlineStyleMap.d.ts} +0 -0
- /package/dist/modules/rendering/{InlineStyleMap.js → types/InlineStyleMap.js} +0 -0
- /package/dist/modules/rendering/{RenderingConfig.js → types/RenderingConfig.js} +0 -0
- /package/dist/modules/rendering/{ScopedRenderOverride.js → types/ScopedRenderOverride.js} +0 -0
- /package/dist/modules/rendering/{VideoFrameSource.d.ts → types/VideoFrameSource.d.ts} +0 -0
- /package/dist/modules/rendering/{VideoFrameSource.js → types/VideoFrameSource.js} +0 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { SvgFilterBundle } from '../../svg-filter/SvgFilterBundle';
|
|
2
|
+
import { SvgFilterScope } from '../../svg-filter/SvgFilterScope';
|
|
3
|
+
import { ElementRenderOverrides } from '../../rendering/types/ElementRenderOverrides';
|
|
4
|
+
import { InlineStyleEmitter } from '../../rendering/styles/InlineStyleEmitter';
|
|
5
|
+
/**
|
|
6
|
+
* Prepares a `SubtitleStyle` for downstream rendering: minifies and
|
|
7
|
+
* embeds the CSS, scopes it to a unique class, mounts a probe
|
|
8
|
+
* container in the host document, computes the baseline needs, and
|
|
9
|
+
* wires the per-style `InlineStyleEmitter` that filters unused CSS
|
|
10
|
+
* custom properties from inline styles.
|
|
11
|
+
*/
|
|
12
|
+
export class PreparedStyleFactory {
|
|
13
|
+
cssEmbedder;
|
|
14
|
+
cssScoper;
|
|
15
|
+
cssMinifier;
|
|
16
|
+
cssVarReferenceScanner;
|
|
17
|
+
baselineCssComposer;
|
|
18
|
+
svgFilterScoper;
|
|
19
|
+
segmentPaddingCssRuleBuilder;
|
|
20
|
+
constructor(cssEmbedder, cssScoper, cssMinifier, cssVarReferenceScanner, baselineCssComposer, svgFilterScoper, segmentPaddingCssRuleBuilder) {
|
|
21
|
+
this.cssEmbedder = cssEmbedder;
|
|
22
|
+
this.cssScoper = cssScoper;
|
|
23
|
+
this.cssMinifier = cssMinifier;
|
|
24
|
+
this.cssVarReferenceScanner = cssVarReferenceScanner;
|
|
25
|
+
this.baselineCssComposer = baselineCssComposer;
|
|
26
|
+
this.svgFilterScoper = svgFilterScoper;
|
|
27
|
+
this.segmentPaddingCssRuleBuilder = segmentPaddingCssRuleBuilder;
|
|
28
|
+
}
|
|
29
|
+
async create(kind, style, doc) {
|
|
30
|
+
const cssWithPadding = this.prependSegmentPaddingRule(style.css, style.rendering);
|
|
31
|
+
const minified = this.cssMinifier.minify(cssWithPadding);
|
|
32
|
+
const embedded = await this.cssEmbedder.embed(minified);
|
|
33
|
+
const scopeClass = `tscaps-render-${kind}-${Math.random().toString(36).slice(2, 8)}`;
|
|
34
|
+
const { css: cssWithIndirectFilters } = this.svgFilterScoper.rewriteCss(embedded);
|
|
35
|
+
const scopedCss = this.cssScoper.scope(cssWithIndirectFilters, `.${scopeClass}`);
|
|
36
|
+
const baselineNeeds = {
|
|
37
|
+
decorations: this.hasDecorationsForKind(doc, kind),
|
|
38
|
+
videoFrame: style.rendering.videoFrame.required,
|
|
39
|
+
behindActor: style.rendering.behindActor.required,
|
|
40
|
+
};
|
|
41
|
+
const baselineCss = this.baselineCssComposer.compose(baselineNeeds);
|
|
42
|
+
// Probe styles live in `document.head` while a render is open;
|
|
43
|
+
// without the scopeClass guard, any `.word`/`.line`/etc on the
|
|
44
|
+
// host page would inherit them.
|
|
45
|
+
const scopedBaseline = this.cssScoper.scope(baselineCss, `.${scopeClass}`);
|
|
46
|
+
const probeStyleEl = document.createElement('style');
|
|
47
|
+
probeStyleEl.textContent = scopedBaseline + scopedCss;
|
|
48
|
+
document.head.appendChild(probeStyleEl);
|
|
49
|
+
const probeContainer = document.createElement('div');
|
|
50
|
+
probeContainer.className = scopeClass;
|
|
51
|
+
probeContainer.style.cssText = 'position:fixed;left:-99999px;visibility:hidden;pointer-events:none;';
|
|
52
|
+
document.body.appendChild(probeContainer);
|
|
53
|
+
const usedCssVars = this.cssVarReferenceScanner.scan(baselineCss + scopedCss);
|
|
54
|
+
return {
|
|
55
|
+
kind,
|
|
56
|
+
scopedCss,
|
|
57
|
+
filters: style.svgFilters ?? SvgFilterBundle.empty({
|
|
58
|
+
scopeAt: () => SvgFilterScope.empty(),
|
|
59
|
+
lengthFactorsAt: () => ({ pxPerEm: 0, pxPerCqh: 0 }),
|
|
60
|
+
}),
|
|
61
|
+
inlineStyles: style.inlineStyles,
|
|
62
|
+
alignment: style.alignment,
|
|
63
|
+
rendering: style.rendering,
|
|
64
|
+
wordOverrides: style.wordOverrides ?? ElementRenderOverrides.empty(),
|
|
65
|
+
segmentOverrides: style.segmentOverrides ?? ElementRenderOverrides.empty(),
|
|
66
|
+
decorationPlacements: style.decorationPlacements ?? new Map(),
|
|
67
|
+
probeStyleElement: probeStyleEl,
|
|
68
|
+
probeContainer,
|
|
69
|
+
scopeClass,
|
|
70
|
+
inlineStyleEmitter: new InlineStyleEmitter(usedCssVars),
|
|
71
|
+
baselineNeeds,
|
|
72
|
+
baselineCss,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
prependSegmentPaddingRule(css, rendering) {
|
|
76
|
+
const rule = this.segmentPaddingCssRuleBuilder.build(rendering.padding);
|
|
77
|
+
return rule ? `${rule}\n${css}` : css;
|
|
78
|
+
}
|
|
79
|
+
hasDecorationsForKind(doc, kind) {
|
|
80
|
+
for (const section of doc.sections) {
|
|
81
|
+
if (section.kind !== kind)
|
|
82
|
+
continue;
|
|
83
|
+
for (const word of section.getWords()) {
|
|
84
|
+
if (word.decoration)
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=PreparedStyleFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreparedStyleFactory.js","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/PreparedStyleFactory.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAA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AAE,KAAK,CAAC,YAAY;YAChC,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,aAAa,EAAE,KAAK,CAAC,aAAa,IAAI,sBAAsB,CAAC,KAAK,EAAE;YACpE,gBAAgB,EAAE,KAAK,CAAC,gBAAgB,IAAI,sBAAsB,CAAC,KAAK,EAAE;YAC1E,oBAAoB,EAAE,KAAK,CAAC,oBAAoB,IAAI,IAAI,GAAG,EAAmC;YAC9F,iBAAiB,EAAE,YAAY;YAC/B,cAAc;YACd,UAAU;YACV,kBAAkB,EAAE,IAAI,kBAAkB,CAAC,WAAW,CAAC;YACvD,aAAa;YACb,WAAW;SACZ,CAAC;IACJ,CAAC;IAEO,yBAAyB,CAAC,GAAW,EAAE,SAA0B;QACvE,MAAM,IAAI,GAAG,IAAI,CAAC,4BAA4B,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACxE,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;IACxC,CAAC;IAEO,qBAAqB,CAAC,GAAa,EAAE,IAAY;QACvD,KAAK,MAAM,OAAO,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;YACnC,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI;gBAAE,SAAS;YACpC,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;gBACtC,IAAI,IAAI,CAAC,UAAU;oBAAE,OAAO,IAAI,CAAC;YACnC,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { VideoFrameRegion } from '../../rendering/types/VideoFrameSource';
|
|
2
|
+
/**
|
|
3
|
+
* Cache of segment paint regions keyed by `(kind, segmentId)`. Looks
|
|
4
|
+
* up an entry or computes and stores one in a single call. `clear`
|
|
5
|
+
* drops every entry.
|
|
6
|
+
*/
|
|
7
|
+
export declare class SegmentPaintRegionCache {
|
|
8
|
+
private readonly regionByKey;
|
|
9
|
+
getOrCompute(kind: string, segmentId: string, compute: () => VideoFrameRegion): VideoFrameRegion;
|
|
10
|
+
clear(): void;
|
|
11
|
+
private composeKey;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=SegmentPaintRegionCache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentPaintRegionCache.d.ts","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/SegmentPaintRegionCache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAElF;;;;GAIG;AACH,qBAAa,uBAAuB;IAClC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAuC;IAEnE,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,gBAAgB,GAAG,gBAAgB;IAUhG,KAAK,IAAI,IAAI;IAIb,OAAO,CAAC,UAAU;CAGnB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache of segment paint regions keyed by `(kind, segmentId)`. Looks
|
|
3
|
+
* up an entry or computes and stores one in a single call. `clear`
|
|
4
|
+
* drops every entry.
|
|
5
|
+
*/
|
|
6
|
+
export class SegmentPaintRegionCache {
|
|
7
|
+
regionByKey = new Map();
|
|
8
|
+
getOrCompute(kind, segmentId, compute) {
|
|
9
|
+
const key = this.composeKey(kind, segmentId);
|
|
10
|
+
let region = this.regionByKey.get(key);
|
|
11
|
+
if (!region) {
|
|
12
|
+
region = compute();
|
|
13
|
+
this.regionByKey.set(key, region);
|
|
14
|
+
}
|
|
15
|
+
return region;
|
|
16
|
+
}
|
|
17
|
+
clear() {
|
|
18
|
+
this.regionByKey.clear();
|
|
19
|
+
}
|
|
20
|
+
composeKey(kind, segmentId) {
|
|
21
|
+
return `${kind}:${segmentId}`;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=SegmentPaintRegionCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentPaintRegionCache.js","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/SegmentPaintRegionCache.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,OAAO,uBAAuB;IACjB,WAAW,GAAG,IAAI,GAAG,EAA4B,CAAC;IAEnE,YAAY,CAAC,IAAY,EAAE,SAAiB,EAAE,OAA+B;QAC3E,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC7C,IAAI,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,GAAG,OAAO,EAAE,CAAC;YACnB,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,KAAK;QACH,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;IAEO,UAAU,CAAC,IAAY,EAAE,SAAiB;QAChD,OAAO,GAAG,IAAI,IAAI,SAAS,EAAE,CAAC;IAChC,CAAC;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VideoFrameRegion } from '
|
|
1
|
+
import type { VideoFrameRegion } from '../../rendering/types/VideoFrameSource';
|
|
2
2
|
/**
|
|
3
3
|
* Anchor placement of a wrapper element within the viewport: the
|
|
4
4
|
* absolute point its anchor edge lands on (in viewport pixels) and
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentPaintRegionResolver.d.ts","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/SegmentPaintRegionResolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAElF;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,iFAAiF;IACjF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,oGAAoG;IACpG,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC;IACrC,8CAA8C;IAC9C,QAAQ,CAAC,SAAS,EAAE,sBAAsB,CAAC;IAC3C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,sGAAsG;IACtG,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED;;;;;;;GAOG;AACH,qBAAa,0BAA0B;IAErC,OAAO,CAAC,KAAK,EAAE,uBAAuB,GAAG,gBAAgB;IAezD,OAAO,CAAC,aAAa;CAuBtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentPaintRegionResolver.js","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/SegmentPaintRegionResolver.ts"],"names":[],"mappings":"AA+BA;;;;;;;GAOG;AACH,MAAM,OAAO,0BAA0B;IAErC,OAAO,CAAC,KAA8B;QACpC,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC3C,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,gCAAgC,KAAK,CAAC,aAAa,eAAe,KAAK,CAAC,cAAc,KAAK,CAAC;QACjH,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CA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,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,QAAQ,CAAC,CAAC,CAAC;QAC7D,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC,CAAC,CAAC;QAC3D,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC,WAAW,GAAG,QAAQ,CAAC,CAAC,CAAC;QACvG,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,YAAY,GAAG,QAAQ,CAAC,CAAC,CAAC;QACzG,OAAO;YACL,CAAC,EAAE,IAAI;YACP,CAAC,EAAE,GAAG;YACN,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;YAChC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;SAClC,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Segment } from '../../document/Segment';
|
|
2
|
+
import type { Line } from '../../document/Line';
|
|
3
|
+
import type { Word } from '../../document/Word';
|
|
4
|
+
import type { Decoration } from '../../document/Decoration';
|
|
5
|
+
import type { ElementRenderOverrides } from '../../rendering/types/ElementRenderOverrides';
|
|
6
|
+
/** A word the segment subtree pulls out of line flow because its id carries an alignment override. */
|
|
7
|
+
export interface PositionedSubtreeWord {
|
|
8
|
+
readonly word: Word;
|
|
9
|
+
readonly line: Line;
|
|
10
|
+
readonly indexInLine: number;
|
|
11
|
+
}
|
|
12
|
+
/** A decoration the segment subtree pulls out of line flow because its id carries an alignment override. */
|
|
13
|
+
export interface PositionedSubtreeDecoration {
|
|
14
|
+
readonly word: Word;
|
|
15
|
+
readonly line: Line;
|
|
16
|
+
readonly indexInLine: number;
|
|
17
|
+
readonly decoration: Decoration;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The breakdown of a segment into the subtrees a consumer needs to
|
|
21
|
+
* render: the words that move to their own anchor, the decorations
|
|
22
|
+
* that move to their own anchor, the set of word ids the main subtree
|
|
23
|
+
* skips, and whether every word in the segment has been positioned
|
|
24
|
+
* (in which case the main subtree is skipped entirely so its
|
|
25
|
+
* background chrome doesn't paint as an empty shell).
|
|
26
|
+
*/
|
|
27
|
+
export interface SegmentSubtreeDecomposition {
|
|
28
|
+
readonly positionedWords: ReadonlyArray<PositionedSubtreeWord>;
|
|
29
|
+
readonly positionedDecorations: ReadonlyArray<PositionedSubtreeDecoration>;
|
|
30
|
+
readonly excludedWordIds: ReadonlySet<string>;
|
|
31
|
+
readonly everyWordIsPositioned: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Pure policy: given the segment and its style's word-level alignment
|
|
35
|
+
* overrides, decides which words and decorations leave the main flow
|
|
36
|
+
* and what the main subtree must skip. Stateless, DOM-free, side-
|
|
37
|
+
* effect free.
|
|
38
|
+
*/
|
|
39
|
+
export declare class SegmentSubtreeDecomposer {
|
|
40
|
+
decompose(segment: Segment, wordOverrides: ElementRenderOverrides): SegmentSubtreeDecomposition;
|
|
41
|
+
private collectPositionedWords;
|
|
42
|
+
private collectPositionedDecorations;
|
|
43
|
+
private allWordsExcluded;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=SegmentSubtreeDecomposer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentSubtreeDecomposer.d.ts","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/SegmentSubtreeDecomposer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iDAAiD,CAAC;AAE9F,sGAAsG;AACtG,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,4GAA4G;AAC5G,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;CACjC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,eAAe,EAAE,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAC/D,QAAQ,CAAC,qBAAqB,EAAE,aAAa,CAAC,2BAA2B,CAAC,CAAC;IAC3E,QAAQ,CAAC,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC9C,QAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAC;CACzC;AAED;;;;;GAKG;AACH,qBAAa,wBAAwB;IAEnC,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,sBAAsB,GAAG,2BAA2B;IAQ/F,OAAO,CAAC,sBAAsB;IAW9B,OAAO,CAAC,4BAA4B;IAapC,OAAO,CAAC,gBAAgB;CAQzB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure policy: given the segment and its style's word-level alignment
|
|
3
|
+
* overrides, decides which words and decorations leave the main flow
|
|
4
|
+
* and what the main subtree must skip. Stateless, DOM-free, side-
|
|
5
|
+
* effect free.
|
|
6
|
+
*/
|
|
7
|
+
export class SegmentSubtreeDecomposer {
|
|
8
|
+
decompose(segment, wordOverrides) {
|
|
9
|
+
const positionedWords = this.collectPositionedWords(segment, wordOverrides);
|
|
10
|
+
const positionedDecorations = this.collectPositionedDecorations(segment, wordOverrides);
|
|
11
|
+
const excludedWordIds = new Set(positionedWords.map((p) => p.word.id));
|
|
12
|
+
const everyWordIsPositioned = this.allWordsExcluded(segment, excludedWordIds);
|
|
13
|
+
return { positionedWords, positionedDecorations, excludedWordIds, everyWordIsPositioned };
|
|
14
|
+
}
|
|
15
|
+
collectPositionedWords(segment, wordOverrides) {
|
|
16
|
+
const out = [];
|
|
17
|
+
for (const line of segment.lines) {
|
|
18
|
+
for (let indexInLine = 0; indexInLine < line.words.length; indexInLine++) {
|
|
19
|
+
const word = line.words[indexInLine];
|
|
20
|
+
if (wordOverrides.get(word.id)?.alignment)
|
|
21
|
+
out.push({ word, line, indexInLine });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return out;
|
|
25
|
+
}
|
|
26
|
+
collectPositionedDecorations(segment, wordOverrides) {
|
|
27
|
+
const out = [];
|
|
28
|
+
for (const line of segment.lines) {
|
|
29
|
+
for (let indexInLine = 0; indexInLine < line.words.length; indexInLine++) {
|
|
30
|
+
const word = line.words[indexInLine];
|
|
31
|
+
const decoration = word.decoration;
|
|
32
|
+
if (!decoration)
|
|
33
|
+
continue;
|
|
34
|
+
if (wordOverrides.get(decoration.id)?.alignment)
|
|
35
|
+
out.push({ word, line, indexInLine, decoration });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return out;
|
|
39
|
+
}
|
|
40
|
+
allWordsExcluded(segment, excludedWordIds) {
|
|
41
|
+
for (const line of segment.lines) {
|
|
42
|
+
for (const word of line.words) {
|
|
43
|
+
if (!excludedWordIds.has(word.id))
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=SegmentSubtreeDecomposer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentSubtreeDecomposer.js","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/SegmentSubtreeDecomposer.ts"],"names":[],"mappings":"AAoCA;;;;;GAKG;AACH,MAAM,OAAO,wBAAwB;IAEnC,SAAS,CAAC,OAAgB,EAAE,aAAqC;QAC/D,MAAM,eAAe,GAAG,IAAI,CAAC,sBAAsB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;QAC5E,MAAM,qBAAqB,GAAG,IAAI,CAAC,4BAA4B,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;QACxF,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QACvE,MAAM,qBAAqB,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;QAC9E,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,eAAe,EAAE,qBAAqB,EAAE,CAAC;IAC5F,CAAC;IAEO,sBAAsB,CAAC,OAAgB,EAAE,aAAqC;QACpF,MAAM,GAAG,GAA4B,EAAE,CAAC;QACxC,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YACjC,KAAK,IAAI,WAAW,GAAG,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,CAAC;gBACzE,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAE,CAAC;gBACtC,IAAI,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,SAAS;oBAAE,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;YACnF,CAAC;QACH,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAEO,4BAA4B,CAAC,OAAgB,EAAE,aAAqC;QAC1F,MAAM,GAAG,GAAkC,EAAE,CAAC;QAC9C,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YACjC,KAAK,IAAI,WAAW,GAAG,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,CAAC;gBACzE,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAE,CAAC;gBACtC,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;gBACnC,IAAI,CAAC,UAAU;oBAAE,SAAS;gBAC1B,IAAI,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,SAAS;oBAAE,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,CAAC;YACrG,CAAC;QACH,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAEO,gBAAgB,CAAC,OAAgB,EAAE,eAAoC;QAC7E,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YACjC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;gBAC9B,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;oBAAE,OAAO,KAAK,CAAC;YAClD,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { Segment } from '../../document/Segment';
|
|
2
|
+
import type { Line } from '../../document/Line';
|
|
3
|
+
import type { Word } from '../../document/Word';
|
|
4
|
+
import type { InlineStyleMap } from '../../rendering/types/InlineStyleMap';
|
|
5
|
+
import type { InlineStyleEmitter } from '../../rendering/styles/InlineStyleEmitter';
|
|
6
|
+
import type { ElementRenderOverrides } from '../../rendering/types/ElementRenderOverrides';
|
|
7
|
+
import type { DecorationPlacementSide } from '../../rendering/types/DecorationPlacementSide';
|
|
8
|
+
import type { WordSplitter } from '../../splitting/WordSplitter';
|
|
9
|
+
/**
|
|
10
|
+
* Per-style inputs every build call needs. `inlineStyleEmitter`
|
|
11
|
+
* encapsulates inline-style serialization so the builder stays free
|
|
12
|
+
* of CSS-variable filtering and escaping concerns.
|
|
13
|
+
*/
|
|
14
|
+
export interface SegmentSubtreeStyleInput {
|
|
15
|
+
readonly scopeClass: string;
|
|
16
|
+
readonly baseInlineStyles: InlineStyleMap;
|
|
17
|
+
readonly wordOverrides: ElementRenderOverrides;
|
|
18
|
+
readonly splitWordsIntoLetters: boolean;
|
|
19
|
+
readonly includeVideoFrameLayer: boolean;
|
|
20
|
+
readonly extraWrapperStyles: InlineStyleMap;
|
|
21
|
+
/** Decorations lifted out of line flow, keyed by decoration id. Absent ids render inline next to their host word. */
|
|
22
|
+
readonly decorationPlacements: ReadonlyMap<string, DecorationPlacementSide>;
|
|
23
|
+
readonly inlineStyleEmitter: InlineStyleEmitter;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Builds the `wrapper → segment → lines → words/letters` HTML
|
|
27
|
+
* subtree for a segment at a given time, applying the segment's
|
|
28
|
+
* classes, time-driven CSS variables, base typography styles, and
|
|
29
|
+
* per-word overrides consistently. The output is the same HTML
|
|
30
|
+
* shape every consumer embeds (an SVG `<foreignObject>`, a
|
|
31
|
+
* measurement probe, etc.).
|
|
32
|
+
*
|
|
33
|
+
* Stateless — all per-style inputs arrive on every call through
|
|
34
|
+
* {@link SegmentSubtreeStyleInput}.
|
|
35
|
+
*/
|
|
36
|
+
export declare class SegmentSubtreeHtmlBuilder {
|
|
37
|
+
private readonly wordSplitter;
|
|
38
|
+
constructor(wordSplitter: WordSplitter);
|
|
39
|
+
/**
|
|
40
|
+
* Builds the wrapper + segment subtree containing every line and
|
|
41
|
+
* word of the segment. Words whose ids appear in `excludedWordIds`
|
|
42
|
+
* are skipped entirely — they are not rendered in the line, so
|
|
43
|
+
* neighbours reflow into the freed slot.
|
|
44
|
+
*
|
|
45
|
+
* `indexInSection` is the segment's zero-based position inside its
|
|
46
|
+
* owning section; published as `--segment-index` on the segment node.
|
|
47
|
+
*/
|
|
48
|
+
buildSegmentSubtree(style: SegmentSubtreeStyleInput, seg: Segment, t: number, excludedWordIds: ReadonlySet<string>, indexInSection: number): string;
|
|
49
|
+
/**
|
|
50
|
+
* Builds the wrapper + segment subtree containing a single
|
|
51
|
+
* line-and-word chain around `word`. Used for synthesizing the
|
|
52
|
+
* minimum context a word needs when it has been promoted out of
|
|
53
|
+
* the main flow by a per-word alignment override.
|
|
54
|
+
*
|
|
55
|
+
* `indexInSection` / `indexInLine` keep the published timing /
|
|
56
|
+
* structural variables (`--segment-index`, `--word-index`) consistent
|
|
57
|
+
* with the original tree position.
|
|
58
|
+
*/
|
|
59
|
+
buildSingleWordSubtree(style: SegmentSubtreeStyleInput, seg: Segment, line: Line, word: Word, t: number, indexInSection: number, indexInLine: number): string;
|
|
60
|
+
/**
|
|
61
|
+
* Builds the wrapper + segment subtree containing only the
|
|
62
|
+
* decoration glyph attached to `word`. Used when a per-decoration
|
|
63
|
+
* alignment override paints the glyph at its own anchor instead of
|
|
64
|
+
* inline next to its host word.
|
|
65
|
+
*/
|
|
66
|
+
buildSingleDecorationSubtree(style: SegmentSubtreeStyleInput, seg: Segment, line: Line, word: Word, t: number, indexInSection: number): string;
|
|
67
|
+
private wrapInScope;
|
|
68
|
+
private composeWrapperStyle;
|
|
69
|
+
private composeSegmentHtml;
|
|
70
|
+
private buildLineWrapperHtml;
|
|
71
|
+
private buildLineHtml;
|
|
72
|
+
private maybeVideoFrameLayerHtml;
|
|
73
|
+
private buildWordHtml;
|
|
74
|
+
private shouldEmitInlineDecoration;
|
|
75
|
+
private buildPromotedDecorationsContainerHtml;
|
|
76
|
+
private collectPromotedDecorationsHtml;
|
|
77
|
+
private buildDecorationSpanHtml;
|
|
78
|
+
private escapeHtml;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=SegmentSubtreeHtmlBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentSubtreeHtmlBuilder.d.ts","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/SegmentSubtreeHtmlBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAKnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iDAAiD,CAAC;AAC9F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kDAAkD,CAAC;AAChG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAMpE;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,gBAAgB,EAAE,cAAc,CAAC;IAC1C,QAAQ,CAAC,aAAa,EAAE,sBAAsB,CAAC;IAC/C,QAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAC;IACxC,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAC;IACzC,QAAQ,CAAC,kBAAkB,EAAE,cAAc,CAAC;IAC5C,qHAAqH;IACrH,QAAQ,CAAC,oBAAoB,EAAE,WAAW,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;IAC5E,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;CACjD;AAED;;;;;;;;;;GAUG;AACH,qBAAa,yBAAyB;IAExB,OAAO,CAAC,QAAQ,CAAC,YAAY;gBAAZ,YAAY,EAAE,YAAY;IAEvD;;;;;;;;OAQG;IACH,mBAAmB,CACjB,KAAK,EAAE,wBAAwB,EAC/B,GAAG,EAAE,OAAO,EACZ,CAAC,EAAE,MAAM,EACT,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,EACpC,cAAc,EAAE,MAAM,GACrB,MAAM;IAWT;;;;;;;;;OASG;IACH,sBAAsB,CACpB,KAAK,EAAE,wBAAwB,EAC/B,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,IAAI,EACV,CAAC,EAAE,MAAM,EACT,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,MAAM,GAClB,MAAM;IAQT;;;;;OAKG;IACH,4BAA4B,CAC1B,KAAK,EAAE,wBAAwB,EAC/B,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,IAAI,EACV,CAAC,EAAE,MAAM,EACT,cAAc,EAAE,MAAM,GACrB,MAAM;IAQT,OAAO,CAAC,WAAW;IAYnB,OAAO,CAAC,mBAAmB;IAM3B,OAAO,CAAC,kBAAkB;IAY1B,OAAO,CAAC,oBAAoB;IAY5B,OAAO,CAAC,aAAa;IA2BrB,OAAO,CAAC,wBAAwB;IAMhC,OAAO,CAAC,aAAa;IA+BrB,OAAO,CAAC,0BAA0B;IAQlC,OAAO,CAAC,qCAAqC;IAc7C,OAAO,CAAC,8BAA8B;IAuBtC,OAAO,CAAC,uBAAuB;IAa/B,OAAO,CAAC,UAAU;CAGnB"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { Decoration } from '../../document/Decoration';
|
|
2
|
+
import { CssVariable } from '../../document/CssVariable';
|
|
3
|
+
import { Letter } from '../../document/Letter';
|
|
4
|
+
import { VIDEO_FRAME_LAYER_CLASS } from '../../rendering/styles/VideoFrameLayerClass';
|
|
5
|
+
const SEGMENT_DECORATIONS_ABOVE_CLASS = 'segment-decorations-above';
|
|
6
|
+
const SEGMENT_DECORATIONS_BELOW_CLASS = 'segment-decorations-below';
|
|
7
|
+
/**
|
|
8
|
+
* Builds the `wrapper → segment → lines → words/letters` HTML
|
|
9
|
+
* subtree for a segment at a given time, applying the segment's
|
|
10
|
+
* classes, time-driven CSS variables, base typography styles, and
|
|
11
|
+
* per-word overrides consistently. The output is the same HTML
|
|
12
|
+
* shape every consumer embeds (an SVG `<foreignObject>`, a
|
|
13
|
+
* measurement probe, etc.).
|
|
14
|
+
*
|
|
15
|
+
* Stateless — all per-style inputs arrive on every call through
|
|
16
|
+
* {@link SegmentSubtreeStyleInput}.
|
|
17
|
+
*/
|
|
18
|
+
export class SegmentSubtreeHtmlBuilder {
|
|
19
|
+
wordSplitter;
|
|
20
|
+
constructor(wordSplitter) {
|
|
21
|
+
this.wordSplitter = wordSplitter;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Builds the wrapper + segment subtree containing every line and
|
|
25
|
+
* word of the segment. Words whose ids appear in `excludedWordIds`
|
|
26
|
+
* are skipped entirely — they are not rendered in the line, so
|
|
27
|
+
* neighbours reflow into the freed slot.
|
|
28
|
+
*
|
|
29
|
+
* `indexInSection` is the segment's zero-based position inside its
|
|
30
|
+
* owning section; published as `--segment-index` on the segment node.
|
|
31
|
+
*/
|
|
32
|
+
buildSegmentSubtree(style, seg, t, excludedWordIds, indexInSection) {
|
|
33
|
+
const segTime = seg.time;
|
|
34
|
+
const linesHtml = [...seg.lines]
|
|
35
|
+
.map((line) => this.buildLineHtml(style, line, t, excludedWordIds, segTime))
|
|
36
|
+
.join('');
|
|
37
|
+
const aboveHtml = this.buildPromotedDecorationsContainerHtml(style, seg, t, 'above', segTime);
|
|
38
|
+
const belowHtml = this.buildPromotedDecorationsContainerHtml(style, seg, t, 'below', segTime);
|
|
39
|
+
const innerHtml = this.maybeVideoFrameLayerHtml(style) + aboveHtml + linesHtml + belowHtml;
|
|
40
|
+
return this.wrapInScope(style, seg, t, indexInSection, innerHtml);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Builds the wrapper + segment subtree containing a single
|
|
44
|
+
* line-and-word chain around `word`. Used for synthesizing the
|
|
45
|
+
* minimum context a word needs when it has been promoted out of
|
|
46
|
+
* the main flow by a per-word alignment override.
|
|
47
|
+
*
|
|
48
|
+
* `indexInSection` / `indexInLine` keep the published timing /
|
|
49
|
+
* structural variables (`--segment-index`, `--word-index`) consistent
|
|
50
|
+
* with the original tree position.
|
|
51
|
+
*/
|
|
52
|
+
buildSingleWordSubtree(style, seg, line, word, t, indexInSection, indexInLine) {
|
|
53
|
+
const segTime = seg.time;
|
|
54
|
+
const wordHtml = this.buildWordHtml(style, word, t, segTime, indexInLine);
|
|
55
|
+
const lineHtml = this.buildLineWrapperHtml(style, line, t, segTime, wordHtml);
|
|
56
|
+
const innerHtml = this.maybeVideoFrameLayerHtml(style) + lineHtml;
|
|
57
|
+
return this.wrapInScope(style, seg, t, indexInSection, innerHtml);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Builds the wrapper + segment subtree containing only the
|
|
61
|
+
* decoration glyph attached to `word`. Used when a per-decoration
|
|
62
|
+
* alignment override paints the glyph at its own anchor instead of
|
|
63
|
+
* inline next to its host word.
|
|
64
|
+
*/
|
|
65
|
+
buildSingleDecorationSubtree(style, seg, line, word, t, indexInSection) {
|
|
66
|
+
const segTime = seg.time;
|
|
67
|
+
const decorationHtml = this.buildDecorationSpanHtml(style, word.decoration, t, segTime, word.time);
|
|
68
|
+
const lineHtml = this.buildLineWrapperHtml(style, line, t, segTime, decorationHtml);
|
|
69
|
+
const innerHtml = this.maybeVideoFrameLayerHtml(style) + lineHtml;
|
|
70
|
+
return this.wrapInScope(style, seg, t, indexInSection, innerHtml);
|
|
71
|
+
}
|
|
72
|
+
wrapInScope(style, seg, t, indexInSection, innerHtml) {
|
|
73
|
+
const wrapperStyle = this.composeWrapperStyle(style);
|
|
74
|
+
const segHtml = this.composeSegmentHtml(style, seg, t, indexInSection, innerHtml);
|
|
75
|
+
return `<div class="${style.scopeClass}" style="${wrapperStyle}">${segHtml}</div>`;
|
|
76
|
+
}
|
|
77
|
+
composeWrapperStyle(style) {
|
|
78
|
+
const merged = { ...style.baseInlineStyles, ...style.extraWrapperStyles };
|
|
79
|
+
const inlineStyleString = style.inlineStyleEmitter.serializeStyles(merged);
|
|
80
|
+
return `display: inline-block; width: max-content; min-width: 0; min-height: 0; ${inlineStyleString}`;
|
|
81
|
+
}
|
|
82
|
+
composeSegmentHtml(style, seg, t, indexInSection, innerHtml) {
|
|
83
|
+
const classes = seg.getCssClasses(t).join(' ');
|
|
84
|
+
const segStyle = style.inlineStyleEmitter.serializeAnimatedVars(seg.getCssVariables(t, { indexInSection }));
|
|
85
|
+
return `<div class="${classes}" style="${segStyle}">${innerHtml}</div>`;
|
|
86
|
+
}
|
|
87
|
+
buildLineWrapperHtml(style, line, t, segTime, innerHtml) {
|
|
88
|
+
const classes = line.getCssClasses(t).join(' ');
|
|
89
|
+
const lineStyle = style.inlineStyleEmitter.serializeAnimatedVars(line.getCssVariables(t, { segTime }));
|
|
90
|
+
return `<div class="${classes}" style="${lineStyle}">${innerHtml}</div>`;
|
|
91
|
+
}
|
|
92
|
+
buildLineHtml(style, line, t, excludedWordIds, segTime) {
|
|
93
|
+
const visibleWords = [];
|
|
94
|
+
for (let i = 0; i < line.words.length; i++) {
|
|
95
|
+
const word = line.words[i];
|
|
96
|
+
if (excludedWordIds.has(word.id))
|
|
97
|
+
continue;
|
|
98
|
+
visibleWords.push({ word, indexInLine: i });
|
|
99
|
+
}
|
|
100
|
+
// A line with no remaining words is omitted entirely — emitting an
|
|
101
|
+
// empty `<div class="line">` would still paint line-level
|
|
102
|
+
// decorations (bubble backgrounds, tails, sibling-combinator gaps)
|
|
103
|
+
// with no content to anchor them.
|
|
104
|
+
if (visibleWords.length === 0)
|
|
105
|
+
return '';
|
|
106
|
+
const wordsHtml = visibleWords
|
|
107
|
+
.map(({ word, indexInLine }) => this.buildWordHtml(style, word, t, segTime, indexInLine))
|
|
108
|
+
.join('');
|
|
109
|
+
return this.buildLineWrapperHtml(style, line, t, segTime, wordsHtml);
|
|
110
|
+
}
|
|
111
|
+
// Lives inside `.segment` so the segment's own clipping and
|
|
112
|
+
// stacking context apply to the layer the same way they apply
|
|
113
|
+
// to any other child.
|
|
114
|
+
maybeVideoFrameLayerHtml(style) {
|
|
115
|
+
return style.includeVideoFrameLayer
|
|
116
|
+
? `<div class="${VIDEO_FRAME_LAYER_CLASS}"></div>`
|
|
117
|
+
: '';
|
|
118
|
+
}
|
|
119
|
+
buildWordHtml(style, word, t, segTime, indexInLine) {
|
|
120
|
+
const wordClasses = word.getCssClasses(t);
|
|
121
|
+
const wordVars = word.getCssVariables(t, { segTime, indexInLine });
|
|
122
|
+
const overrideStyle = style.inlineStyleEmitter.serializeStyles(style.wordOverrides.get(word.id)?.inlineStyles);
|
|
123
|
+
const decorationHtml = this.shouldEmitInlineDecoration(style, word)
|
|
124
|
+
? this.buildDecorationSpanHtml(style, word.decoration, t, segTime, word.time)
|
|
125
|
+
: '';
|
|
126
|
+
const trailHtml = word.decoration ? this.escapeHtml(word.decoration.trail) : '';
|
|
127
|
+
if (!style.splitWordsIntoLetters) {
|
|
128
|
+
const wordStyle = style.inlineStyleEmitter.serializeAnimatedVars(wordVars) + overrideStyle;
|
|
129
|
+
return `<span class="${wordClasses.join(' ')}" style="${wordStyle}">${this.escapeHtml(word.displayText)}${decorationHtml}${trailHtml}</span>`;
|
|
130
|
+
}
|
|
131
|
+
const letters = this.wordSplitter.split(word.displayText);
|
|
132
|
+
const wordStyle = style.inlineStyleEmitter.serializeAnimatedVars({ ...wordVars, [CssVariable.LETTER_COUNT]: String(letters.length) }) + overrideStyle;
|
|
133
|
+
const lettersHtml = letters.map((letter, i) => {
|
|
134
|
+
const letterStyle = style.inlineStyleEmitter.serializeAnimatedVars({ [CssVariable.LETTER_INDEX]: String(i) });
|
|
135
|
+
return `<span class="${Letter.CSS_CLASS}" style="${letterStyle}">${this.escapeHtml(letter)}</span>`;
|
|
136
|
+
}).join('');
|
|
137
|
+
return `<span class="${wordClasses.join(' ')}" style="${wordStyle}">${lettersHtml}${decorationHtml}${trailHtml}</span>`;
|
|
138
|
+
}
|
|
139
|
+
shouldEmitInlineDecoration(style, word) {
|
|
140
|
+
if (!word.decoration)
|
|
141
|
+
return false;
|
|
142
|
+
const decorationId = word.decoration.id;
|
|
143
|
+
if (style.wordOverrides.get(decorationId)?.alignment)
|
|
144
|
+
return false;
|
|
145
|
+
if (style.decorationPlacements.has(decorationId))
|
|
146
|
+
return false;
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
buildPromotedDecorationsContainerHtml(style, seg, t, side, segTime) {
|
|
150
|
+
if (style.decorationPlacements.size === 0)
|
|
151
|
+
return '';
|
|
152
|
+
const decorationsHtml = this.collectPromotedDecorationsHtml(style, seg, t, side, segTime);
|
|
153
|
+
if (!decorationsHtml)
|
|
154
|
+
return '';
|
|
155
|
+
const containerClass = side === 'above' ? SEGMENT_DECORATIONS_ABOVE_CLASS : SEGMENT_DECORATIONS_BELOW_CLASS;
|
|
156
|
+
return `<div class="${containerClass}">${decorationsHtml}</div>`;
|
|
157
|
+
}
|
|
158
|
+
collectPromotedDecorationsHtml(style, seg, t, side, segTime) {
|
|
159
|
+
let html = '';
|
|
160
|
+
for (const line of seg.lines) {
|
|
161
|
+
for (const word of line.words) {
|
|
162
|
+
if (!word.decoration)
|
|
163
|
+
continue;
|
|
164
|
+
const decorationId = word.decoration.id;
|
|
165
|
+
if (style.decorationPlacements.get(decorationId) !== side)
|
|
166
|
+
continue;
|
|
167
|
+
// A manual alignment override takes the decoration out of the
|
|
168
|
+
// segment subtree entirely — the caller paints it at its own
|
|
169
|
+
// anchor, so the segment-side container must skip it too.
|
|
170
|
+
if (style.wordOverrides.get(decorationId)?.alignment)
|
|
171
|
+
continue;
|
|
172
|
+
html += this.buildDecorationSpanHtml(style, word.decoration, t, segTime, word.time);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return html;
|
|
176
|
+
}
|
|
177
|
+
buildDecorationSpanHtml(style, decoration, t, segTime, wordTime) {
|
|
178
|
+
if (!decoration)
|
|
179
|
+
return '';
|
|
180
|
+
const overrideStyle = style.inlineStyleEmitter.serializeStyles(style.wordOverrides.get(decoration.id)?.inlineStyles);
|
|
181
|
+
const animatedVars = style.inlineStyleEmitter.serializeAnimatedVars(decoration.getCssVariables(t, { segTime, wordTime }));
|
|
182
|
+
return `<span class="${Decoration.CSS_CLASS}" style="${animatedVars}${overrideStyle}">${this.escapeHtml(decoration.glyph)}</span>`;
|
|
183
|
+
}
|
|
184
|
+
escapeHtml(text) {
|
|
185
|
+
return text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=SegmentSubtreeHtmlBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentSubtreeHtmlBuilder.js","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/SegmentSubtreeHtmlBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAOlD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AAEzF,MAAM,+BAA+B,GAAG,2BAA2B,CAAC;AACpE,MAAM,+BAA+B,GAAG,2BAA2B,CAAC;AAmBpE;;;;;;;;;;GAUG;AACH,MAAM,OAAO,yBAAyB;IAEP;IAA7B,YAA6B,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;IAAG,CA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CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,SAAS,CAAC;IACrI,CAAC;IAEO,UAAU,CAAC,IAAY;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACjF,CAAC;CACF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Segment } from '../../document/Segment';
|
|
2
|
+
import type { SegmentSubtreeHtmlBuilder } from '../../rendering/subtitle/SegmentSubtreeHtmlBuilder';
|
|
3
|
+
import type { VideoFrameVarsBuilder } from '../../rendering/subtitle/VideoFrameVarsBuilder';
|
|
4
|
+
import type { SvgFilterMaterializer } from '../../rendering/subtitle/SvgFilterMaterializer';
|
|
5
|
+
import type { PreparedStyle } from '../../rendering/subtitle/PreparedStyle';
|
|
6
|
+
import type { SegmentSubtreeDecomposer } from '../../rendering/subtitle/SegmentSubtreeDecomposer';
|
|
7
|
+
export interface WrapperRender {
|
|
8
|
+
html: string;
|
|
9
|
+
defs: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Builds the HTML wrapper for one render tile. Handles three subtree
|
|
13
|
+
* shapes: the main segment subtree, a sibling subtree for a per-word
|
|
14
|
+
* alignment override that pulls the word out of line flow, and a
|
|
15
|
+
* sibling subtree for a decoration-only override that pins the glyph
|
|
16
|
+
* at its own anchor. Each subtree carries its own anchor; the
|
|
17
|
+
* positioned siblings appear after the main wrapper, with their
|
|
18
|
+
* original slot in the line omitted so neighbours reflow. Aggregates
|
|
19
|
+
* the SVG `<filter>` defs each subtree needs into the tile's `defs`.
|
|
20
|
+
*/
|
|
21
|
+
export declare class SegmentWrapperRenderer {
|
|
22
|
+
private readonly subtreeBuilder;
|
|
23
|
+
private readonly subtreeDecomposer;
|
|
24
|
+
private readonly filterMaterializer;
|
|
25
|
+
private readonly videoFrameVarsBuilder;
|
|
26
|
+
private readonly width;
|
|
27
|
+
private readonly height;
|
|
28
|
+
constructor(subtreeBuilder: SegmentSubtreeHtmlBuilder, subtreeDecomposer: SegmentSubtreeDecomposer, filterMaterializer: SvgFilterMaterializer, videoFrameVarsBuilder: VideoFrameVarsBuilder, width: number, height: number);
|
|
29
|
+
buildWrapperHtml(style: PreparedStyle, seg: Segment, t: number, indexInSection: number, nextUid: () => number): Promise<WrapperRender>;
|
|
30
|
+
/**
|
|
31
|
+
* The positioned siblings pin an element at its own explicit anchor,
|
|
32
|
+
* so the text-behind-actor state variables stay off their wrapper —
|
|
33
|
+
* a style rule reacting to the state (e.g. a lift) would displace
|
|
34
|
+
* the element from the exact spot it was pinned to.
|
|
35
|
+
*/
|
|
36
|
+
private withoutBehindActorState;
|
|
37
|
+
private buildSegmentSubtreeHtml;
|
|
38
|
+
private buildPositionedWordSubtreeHtml;
|
|
39
|
+
private buildPositionedDecorationSubtreeHtml;
|
|
40
|
+
private composeAnchorStyle;
|
|
41
|
+
private composeStyleInput;
|
|
42
|
+
private mergeExtras;
|
|
43
|
+
private resolveAlignment;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=SegmentWrapperRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentWrapperRenderer.d.ts","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/SegmentWrapperRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAIzD,OAAO,KAAK,EAAE,yBAAyB,EAA4B,MAAM,uDAAuD,CAAC;AACjI,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAC;AAC/F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAC;AAC/F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,KAAK,EAGV,wBAAwB,EACzB,MAA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