@tscaps/engine 0.1.1 → 0.3.0
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 +48 -10
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/modules/bidi/BidiAnalyzer.d.ts +23 -0
- package/dist/modules/bidi/BidiAnalyzer.d.ts.map +1 -0
- package/dist/modules/bidi/BidiAnalyzer.js +2 -0
- package/dist/modules/bidi/BidiAnalyzer.js.map +1 -0
- package/dist/modules/bidi/BidiCharacterClassifier.d.ts +13 -0
- package/dist/modules/bidi/BidiCharacterClassifier.d.ts.map +1 -0
- package/dist/modules/bidi/BidiCharacterClassifier.js +2 -0
- package/dist/modules/bidi/BidiCharacterClassifier.js.map +1 -0
- package/dist/modules/bidi/BidiJsAnalyzer.d.ts +14 -0
- package/dist/modules/bidi/BidiJsAnalyzer.d.ts.map +1 -0
- package/dist/modules/bidi/BidiJsAnalyzer.js +19 -0
- package/dist/modules/bidi/BidiJsAnalyzer.js.map +1 -0
- package/dist/modules/bidi/BidiJsCharacterClassifier.d.ts +8 -0
- package/dist/modules/bidi/BidiJsCharacterClassifier.d.ts.map +1 -0
- package/dist/modules/bidi/BidiJsCharacterClassifier.js +19 -0
- package/dist/modules/bidi/BidiJsCharacterClassifier.js.map +1 -0
- package/dist/modules/bidi/CursiveScriptDetector.d.ts +12 -0
- package/dist/modules/bidi/CursiveScriptDetector.d.ts.map +1 -0
- package/dist/modules/bidi/CursiveScriptDetector.js +20 -0
- package/dist/modules/bidi/CursiveScriptDetector.js.map +1 -0
- package/dist/modules/bidi/HorizontalSide.d.ts +18 -0
- package/dist/modules/bidi/HorizontalSide.d.ts.map +1 -0
- package/dist/modules/bidi/HorizontalSide.js +3 -0
- package/dist/modules/bidi/HorizontalSide.js.map +1 -0
- package/dist/modules/bidi/HorizontalSideResolver.d.ts +21 -0
- package/dist/modules/bidi/HorizontalSideResolver.d.ts.map +1 -0
- package/dist/modules/bidi/HorizontalSideResolver.js +27 -0
- package/dist/modules/bidi/HorizontalSideResolver.js.map +1 -0
- package/dist/modules/bidi/StrongCharacterMajorityTextDirectionDetector.d.ts +24 -0
- package/dist/modules/bidi/StrongCharacterMajorityTextDirectionDetector.d.ts.map +1 -0
- package/dist/modules/bidi/StrongCharacterMajorityTextDirectionDetector.js +34 -0
- package/dist/modules/bidi/StrongCharacterMajorityTextDirectionDetector.js.map +1 -0
- package/dist/modules/bidi/TextDirection.d.ts +9 -0
- package/dist/modules/bidi/TextDirection.d.ts.map +1 -0
- package/dist/modules/bidi/TextDirection.js +2 -0
- package/dist/modules/bidi/TextDirection.js.map +1 -0
- package/dist/modules/bidi/TextDirectionDetector.d.ts +12 -0
- package/dist/modules/bidi/TextDirectionDetector.d.ts.map +1 -0
- package/dist/modules/bidi/TextDirectionDetector.js +2 -0
- package/dist/modules/bidi/TextDirectionDetector.js.map +1 -0
- package/dist/modules/bidi/WordFragment.d.ts +34 -0
- package/dist/modules/bidi/WordFragment.d.ts.map +1 -0
- package/dist/modules/bidi/WordFragment.js +2 -0
- package/dist/modules/bidi/WordFragment.js.map +1 -0
- package/dist/modules/bidi/WordFragmenter.d.ts +43 -0
- package/dist/modules/bidi/WordFragmenter.d.ts.map +1 -0
- package/dist/modules/bidi/WordFragmenter.js +112 -0
- package/dist/modules/bidi/WordFragmenter.js.map +1 -0
- package/dist/modules/bidi/index.d.ts +14 -0
- package/dist/modules/bidi/index.d.ts.map +1 -0
- package/dist/modules/bidi/index.js +8 -0
- package/dist/modules/bidi/index.js.map +1 -0
- package/dist/modules/css/CssBlockSealer.d.ts +30 -0
- package/dist/modules/css/CssBlockSealer.d.ts.map +1 -0
- package/dist/modules/css/CssBlockSealer.js +64 -0
- package/dist/modules/css/CssBlockSealer.js.map +1 -0
- package/dist/modules/css/CssCustomPropertyDefinitionScanner.d.ts +13 -0
- package/dist/modules/css/CssCustomPropertyDefinitionScanner.d.ts.map +1 -0
- package/dist/modules/css/CssCustomPropertyDefinitionScanner.js +24 -0
- package/dist/modules/css/CssCustomPropertyDefinitionScanner.js.map +1 -0
- package/dist/modules/css/CssFilterReferenceScanner.d.ts +15 -0
- package/dist/modules/css/CssFilterReferenceScanner.d.ts.map +1 -0
- package/dist/modules/css/CssFilterReferenceScanner.js +22 -0
- package/dist/modules/css/CssFilterReferenceScanner.js.map +1 -0
- package/dist/modules/css/CssFragmentParser.d.ts +53 -0
- package/dist/modules/css/CssFragmentParser.d.ts.map +1 -0
- package/dist/modules/css/CssFragmentParser.js +127 -0
- package/dist/modules/css/CssFragmentParser.js.map +1 -0
- package/dist/modules/css/CssKeyframeNamespacer.d.ts +21 -0
- package/dist/modules/css/CssKeyframeNamespacer.d.ts.map +1 -0
- package/dist/modules/css/CssKeyframeNamespacer.js +48 -0
- package/dist/modules/css/CssKeyframeNamespacer.js.map +1 -0
- package/dist/modules/css/CssKeyframesScanner.d.ts +29 -0
- package/dist/modules/css/CssKeyframesScanner.d.ts.map +1 -0
- package/dist/modules/css/CssKeyframesScanner.js +102 -0
- package/dist/modules/css/CssKeyframesScanner.js.map +1 -0
- package/dist/modules/css/CssLayer.d.ts +20 -0
- package/dist/modules/css/CssLayer.d.ts.map +1 -0
- package/dist/modules/css/CssLayer.js +21 -0
- package/dist/modules/css/CssLayer.js.map +1 -0
- package/dist/modules/css/CssScoper.d.ts +31 -2
- package/dist/modules/css/CssScoper.d.ts.map +1 -1
- package/dist/modules/css/CssScoper.js +168 -79
- package/dist/modules/css/CssScoper.js.map +1 -1
- package/dist/modules/css/CssSelectorClassScanner.d.ts +25 -0
- package/dist/modules/css/CssSelectorClassScanner.d.ts.map +1 -0
- package/dist/modules/css/CssSelectorClassScanner.js +91 -0
- package/dist/modules/css/CssSelectorClassScanner.js.map +1 -0
- package/dist/modules/css/CssVarReferenceScanner.d.ts +16 -0
- package/dist/modules/css/CssVarReferenceScanner.d.ts.map +1 -0
- package/dist/modules/css/CssVarReferenceScanner.js +27 -0
- package/dist/modules/css/CssVarReferenceScanner.js.map +1 -0
- package/dist/modules/css/index.d.ts +9 -0
- package/dist/modules/css/index.d.ts.map +1 -1
- package/dist/modules/css/index.js +9 -0
- package/dist/modules/css/index.js.map +1 -1
- package/dist/modules/document/CssClass.d.ts +20 -0
- package/dist/modules/document/CssClass.d.ts.map +1 -0
- package/dist/modules/document/CssClass.js +21 -0
- package/dist/modules/document/CssClass.js.map +1 -0
- package/dist/modules/document/CssVariable.d.ts +21 -6
- package/dist/modules/document/CssVariable.d.ts.map +1 -1
- package/dist/modules/document/CssVariable.js +27 -5
- package/dist/modules/document/CssVariable.js.map +1 -1
- package/dist/modules/document/DataAttribute.d.ts +26 -0
- package/dist/modules/document/DataAttribute.d.ts.map +1 -0
- package/dist/modules/document/DataAttribute.js +27 -0
- package/dist/modules/document/DataAttribute.js.map +1 -0
- 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 +51 -9
- package/dist/modules/document/DocumentEditor.d.ts.map +1 -1
- package/dist/modules/document/DocumentEditor.js +118 -26
- package/dist/modules/document/DocumentEditor.js.map +1 -1
- package/dist/modules/document/DocumentNodeId.d.ts +23 -0
- package/dist/modules/document/DocumentNodeId.d.ts.map +1 -0
- package/dist/modules/document/DocumentNodeId.js +31 -0
- package/dist/modules/document/DocumentNodeId.js.map +1 -0
- package/dist/modules/document/Line.d.ts +10 -7
- package/dist/modules/document/Line.d.ts.map +1 -1
- package/dist/modules/document/Line.js +13 -25
- package/dist/modules/document/Line.js.map +1 -1
- package/dist/modules/document/Section.d.ts +1 -8
- package/dist/modules/document/Section.d.ts.map +1 -1
- package/dist/modules/document/Section.js +4 -35
- package/dist/modules/document/Section.js.map +1 -1
- package/dist/modules/document/Segment.d.ts +24 -14
- package/dist/modules/document/Segment.d.ts.map +1 -1
- package/dist/modules/document/Segment.js +41 -23
- package/dist/modules/document/Segment.js.map +1 -1
- package/dist/modules/document/Word.d.ts +21 -8
- package/dist/modules/document/Word.d.ts.map +1 -1
- package/dist/modules/document/Word.js +34 -35
- package/dist/modules/document/Word.js.map +1 -1
- package/dist/modules/document/index.d.ts +5 -2
- package/dist/modules/document/index.d.ts.map +1 -1
- package/dist/modules/document/index.js +4 -1
- 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/GapFreeEffect.d.ts +15 -0
- package/dist/modules/effect/GapFreeEffect.d.ts.map +1 -1
- package/dist/modules/effect/GapFreeEffect.js +29 -4
- package/dist/modules/effect/GapFreeEffect.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 +13 -8
- 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 +43 -717
- package/dist/modules/rendering/BrowserSubtitleFrameRenderer.js.map +1 -1
- package/dist/modules/rendering/HorizontalPlacementResolver.d.ts +27 -0
- package/dist/modules/rendering/HorizontalPlacementResolver.d.ts.map +1 -0
- package/dist/modules/rendering/HorizontalPlacementResolver.js +31 -0
- package/dist/modules/rendering/HorizontalPlacementResolver.js.map +1 -0
- package/dist/modules/rendering/SubtitleFrameRenderer.d.ts +10 -5
- package/dist/modules/rendering/SubtitleFrameRenderer.d.ts.map +1 -1
- package/dist/modules/rendering/index.d.ts +16 -8
- package/dist/modules/rendering/index.d.ts.map +1 -1
- package/dist/modules/rendering/index.js +8 -2
- package/dist/modules/rendering/index.js.map +1 -1
- package/dist/modules/rendering/styles/BaselineCssComposer.d.ts +41 -0
- package/dist/modules/rendering/styles/BaselineCssComposer.d.ts.map +1 -0
- package/dist/modules/rendering/styles/BaselineCssComposer.js +64 -0
- package/dist/modules/rendering/styles/BaselineCssComposer.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 +35 -0
- package/dist/modules/rendering/styles/DecorationContainerBaselineCss.js.map +1 -0
- package/dist/modules/rendering/styles/FrozenFrameCss.d.ts +28 -0
- package/dist/modules/rendering/styles/FrozenFrameCss.d.ts.map +1 -0
- package/dist/modules/rendering/styles/FrozenFrameCss.js +28 -0
- package/dist/modules/rendering/styles/FrozenFrameCss.js.map +1 -0
- package/dist/modules/rendering/styles/InlineStyleEmitter.d.ts +20 -0
- package/dist/modules/rendering/styles/InlineStyleEmitter.d.ts.map +1 -0
- package/dist/modules/rendering/styles/InlineStyleEmitter.js +44 -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/{VideoFrameLayerClass.d.ts → styles/VideoFrameLayerBaselineCss.d.ts} +3 -10
- package/dist/modules/rendering/styles/VideoFrameLayerBaselineCss.d.ts.map +1 -0
- package/dist/modules/rendering/styles/VideoFrameLayerBaselineCss.js +15 -0
- package/dist/modules/rendering/styles/VideoFrameLayerBaselineCss.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 +21 -0
- package/dist/modules/rendering/subtitle/ActiveRenderSessionFactory.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/ActiveRenderSessionFactory.js +46 -0
- package/dist/modules/rendering/subtitle/ActiveRenderSessionFactory.js.map +1 -0
- package/dist/modules/rendering/subtitle/AnimationProbe.d.ts +39 -0
- package/dist/modules/rendering/subtitle/AnimationProbe.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/AnimationProbe.js +203 -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 +32 -0
- package/dist/modules/rendering/subtitle/BatchPlanner.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/BatchPlanner.js +93 -0
- package/dist/modules/rendering/subtitle/BatchPlanner.js.map +1 -0
- package/dist/modules/rendering/subtitle/PreparedStyle.d.ts +36 -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/{SegmentPaintRegionResolver.js → subtitle/SegmentPaintRegionResolver.js} +7 -4
- 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 +108 -0
- package/dist/modules/rendering/subtitle/SegmentSubtreeHtmlBuilder.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SegmentSubtreeHtmlBuilder.js +246 -0
- package/dist/modules/rendering/subtitle/SegmentSubtreeHtmlBuilder.js.map +1 -0
- package/dist/modules/rendering/subtitle/SegmentWrapperRenderer.d.ts +40 -0
- package/dist/modules/rendering/subtitle/SegmentWrapperRenderer.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SegmentWrapperRenderer.js +132 -0
- package/dist/modules/rendering/subtitle/SegmentWrapperRenderer.js.map +1 -0
- package/dist/modules/rendering/subtitle/SpriteSheetCompositor.d.ts +48 -0
- package/dist/modules/rendering/subtitle/SpriteSheetCompositor.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SpriteSheetCompositor.js +143 -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 +20 -0
- package/dist/modules/rendering/subtitle/SvgFilterMaterializer.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SvgFilterMaterializer.js +30 -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 +121 -0
- package/dist/modules/rendering/subtitle/VideoFrameVarsBuilder.js.map +1 -0
- package/dist/modules/rendering/types/AlignmentConfig.d.ts +33 -0
- package/dist/modules/rendering/types/AlignmentConfig.d.ts.map +1 -0
- package/dist/modules/rendering/types/AlignmentConfig.js +3 -0
- package/dist/modules/rendering/types/AlignmentConfig.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/types/ElementRenderOverrides.d.ts +23 -0
- package/dist/modules/rendering/types/ElementRenderOverrides.d.ts.map +1 -0
- package/dist/modules/rendering/types/ElementRenderOverrides.js +52 -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} +8 -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/types/ScopedRenderOverride.d.ts +24 -0
- 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/subtitle-file/AssSubtitleFileSerializer.d.ts +53 -0
- package/dist/modules/subtitle-file/AssSubtitleFileSerializer.d.ts.map +1 -0
- package/dist/modules/subtitle-file/AssSubtitleFileSerializer.js +133 -0
- package/dist/modules/subtitle-file/AssSubtitleFileSerializer.js.map +1 -0
- package/dist/modules/subtitle-file/SbvSubtitleFileSerializer.d.ts +20 -0
- package/dist/modules/subtitle-file/SbvSubtitleFileSerializer.d.ts.map +1 -0
- package/dist/modules/subtitle-file/SbvSubtitleFileSerializer.js +31 -0
- package/dist/modules/subtitle-file/SbvSubtitleFileSerializer.js.map +1 -0
- package/dist/modules/subtitle-file/SrtSubtitleFileSerializer.d.ts +21 -0
- package/dist/modules/subtitle-file/SrtSubtitleFileSerializer.d.ts.map +1 -0
- package/dist/modules/subtitle-file/SrtSubtitleFileSerializer.js +33 -0
- package/dist/modules/subtitle-file/SrtSubtitleFileSerializer.js.map +1 -0
- package/dist/modules/subtitle-file/SubtitleCue.d.ts +18 -0
- package/dist/modules/subtitle-file/SubtitleCue.d.ts.map +1 -0
- package/dist/modules/subtitle-file/SubtitleCue.js +20 -0
- package/dist/modules/subtitle-file/SubtitleCue.js.map +1 -0
- package/dist/modules/subtitle-file/SubtitleCueBuilder.d.ts +38 -0
- package/dist/modules/subtitle-file/SubtitleCueBuilder.d.ts.map +1 -0
- package/dist/modules/subtitle-file/SubtitleCueBuilder.js +106 -0
- package/dist/modules/subtitle-file/SubtitleCueBuilder.js.map +1 -0
- package/dist/modules/subtitle-file/SubtitleFileJob.d.ts +17 -0
- package/dist/modules/subtitle-file/SubtitleFileJob.d.ts.map +1 -0
- package/dist/modules/subtitle-file/SubtitleFileJob.js +2 -0
- package/dist/modules/subtitle-file/SubtitleFileJob.js.map +1 -0
- package/dist/modules/subtitle-file/SubtitleFileSerializer.d.ts +36 -0
- package/dist/modules/subtitle-file/SubtitleFileSerializer.d.ts.map +1 -0
- package/dist/modules/subtitle-file/SubtitleFileSerializer.js +44 -0
- package/dist/modules/subtitle-file/SubtitleFileSerializer.js.map +1 -0
- package/dist/modules/subtitle-file/SubtitleGranularity.d.ts +11 -0
- package/dist/modules/subtitle-file/SubtitleGranularity.d.ts.map +1 -0
- package/dist/modules/subtitle-file/SubtitleGranularity.js +2 -0
- package/dist/modules/subtitle-file/SubtitleGranularity.js.map +1 -0
- package/dist/modules/subtitle-file/SubtitleRow.d.ts +11 -0
- package/dist/modules/subtitle-file/SubtitleRow.d.ts.map +1 -0
- package/dist/modules/subtitle-file/SubtitleRow.js +14 -0
- package/dist/modules/subtitle-file/SubtitleRow.js.map +1 -0
- package/dist/modules/subtitle-file/SubtitleToken.d.ts +13 -0
- package/dist/modules/subtitle-file/SubtitleToken.d.ts.map +1 -0
- package/dist/modules/subtitle-file/SubtitleToken.js +15 -0
- package/dist/modules/subtitle-file/SubtitleToken.js.map +1 -0
- package/dist/modules/subtitle-file/TextSubtitleFileSerializer.d.ts +19 -0
- package/dist/modules/subtitle-file/TextSubtitleFileSerializer.d.ts.map +1 -0
- package/dist/modules/subtitle-file/TextSubtitleFileSerializer.js +24 -0
- package/dist/modules/subtitle-file/TextSubtitleFileSerializer.js.map +1 -0
- package/dist/modules/subtitle-file/Timecode.d.ts +20 -0
- package/dist/modules/subtitle-file/Timecode.d.ts.map +1 -0
- package/dist/modules/subtitle-file/Timecode.js +32 -0
- package/dist/modules/subtitle-file/Timecode.js.map +1 -0
- package/dist/modules/subtitle-file/TtmlSubtitleFileSerializer.d.ts +22 -0
- package/dist/modules/subtitle-file/TtmlSubtitleFileSerializer.d.ts.map +1 -0
- package/dist/modules/subtitle-file/TtmlSubtitleFileSerializer.js +57 -0
- package/dist/modules/subtitle-file/TtmlSubtitleFileSerializer.js.map +1 -0
- package/dist/modules/subtitle-file/VttSubtitleFileSerializer.d.ts +21 -0
- package/dist/modules/subtitle-file/VttSubtitleFileSerializer.d.ts.map +1 -0
- package/dist/modules/subtitle-file/VttSubtitleFileSerializer.js +39 -0
- package/dist/modules/subtitle-file/VttSubtitleFileSerializer.js.map +1 -0
- package/dist/modules/subtitle-file/index.d.ts +10 -0
- package/dist/modules/subtitle-file/index.d.ts.map +1 -0
- package/dist/modules/subtitle-file/index.js +8 -0
- package/dist/modules/subtitle-file/index.js.map +1 -0
- package/dist/modules/svg-filter/SvgFilter.d.ts +8 -1
- package/dist/modules/svg-filter/SvgFilter.d.ts.map +1 -1
- package/dist/modules/svg-filter/SvgFilter.js +9 -1
- package/dist/modules/svg-filter/SvgFilter.js.map +1 -1
- package/dist/modules/svg-filter/SvgFilterDefinitionsParser.d.ts +1 -0
- package/dist/modules/svg-filter/SvgFilterDefinitionsParser.d.ts.map +1 -1
- package/dist/modules/svg-filter/SvgFilterDefinitionsParser.js +9 -1
- package/dist/modules/svg-filter/SvgFilterDefinitionsParser.js.map +1 -1
- package/dist/modules/svg-filter/SvgFilterDefsRenderer.d.ts +44 -0
- package/dist/modules/svg-filter/SvgFilterDefsRenderer.d.ts.map +1 -0
- package/dist/modules/svg-filter/SvgFilterDefsRenderer.js +47 -0
- package/dist/modules/svg-filter/SvgFilterDefsRenderer.js.map +1 -0
- package/dist/modules/svg-filter/index.d.ts +2 -0
- package/dist/modules/svg-filter/index.d.ts.map +1 -1
- package/dist/modules/svg-filter/index.js +1 -0
- package/dist/modules/svg-filter/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 +42 -0
- package/dist/modules/tagging/PauseTagger.js.map +1 -0
- package/dist/modules/tagging/RegexTagger.js +1 -1
- package/dist/modules/tagging/RegexTagger.js.map +1 -1
- package/dist/modules/tagging/SpanTagger.js +1 -1
- package/dist/modules/tagging/SpanTagger.js.map +1 -1
- package/dist/modules/tagging/StructureTagger.d.ts +1 -2
- package/dist/modules/tagging/StructureTagger.d.ts.map +1 -1
- package/dist/modules/tagging/StructureTagger.js +12 -11
- package/dist/modules/tagging/StructureTagger.js.map +1 -1
- package/dist/modules/tagging/WordlistTagger.js +1 -1
- package/dist/modules/tagging/WordlistTagger.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/tags/AndTagCondition.d.ts +10 -0
- package/dist/modules/tags/AndTagCondition.d.ts.map +1 -0
- package/dist/modules/tags/AndTagCondition.js +14 -0
- package/dist/modules/tags/AndTagCondition.js.map +1 -0
- package/dist/modules/tags/HasTagCondition.d.ts +10 -0
- package/dist/modules/tags/HasTagCondition.d.ts.map +1 -0
- package/dist/modules/tags/HasTagCondition.js +18 -0
- package/dist/modules/tags/HasTagCondition.js.map +1 -0
- package/dist/modules/tags/NotTagCondition.d.ts +10 -0
- package/dist/modules/tags/NotTagCondition.d.ts.map +1 -0
- package/dist/modules/tags/NotTagCondition.js +14 -0
- package/dist/modules/tags/NotTagCondition.js.map +1 -0
- package/dist/modules/tags/OrTagCondition.d.ts +10 -0
- package/dist/modules/tags/OrTagCondition.d.ts.map +1 -0
- package/dist/modules/tags/OrTagCondition.js +14 -0
- package/dist/modules/tags/OrTagCondition.js.map +1 -0
- package/dist/modules/{document/Tag.d.ts → tags/StructureTag.d.ts} +4 -10
- package/dist/modules/tags/StructureTag.d.ts.map +1 -0
- package/dist/modules/{document/Tag.js → tags/StructureTag.js} +4 -19
- package/dist/modules/tags/StructureTag.js.map +1 -0
- package/dist/modules/tags/Tag.d.ts +8 -0
- package/dist/modules/tags/Tag.d.ts.map +1 -0
- package/dist/modules/tags/Tag.js +16 -0
- package/dist/modules/tags/Tag.js.map +1 -0
- package/dist/modules/tags/TagCondition.d.ts +12 -0
- package/dist/modules/tags/TagCondition.d.ts.map +1 -0
- package/dist/modules/tags/TagCondition.js +2 -0
- package/dist/modules/tags/TagCondition.js.map +1 -0
- package/dist/modules/tags/TagConditionParser.d.ts +21 -0
- package/dist/modules/tags/TagConditionParser.d.ts.map +1 -0
- package/dist/modules/tags/TagConditionParser.js +75 -0
- package/dist/modules/tags/TagConditionParser.js.map +1 -0
- package/dist/modules/tags/index.d.ts +9 -0
- package/dist/modules/tags/index.d.ts.map +1 -0
- package/dist/modules/tags/index.js +8 -0
- package/dist/modules/tags/index.js.map +1 -0
- package/dist/modules/transcription/AudioDecoder.d.ts +9 -4
- package/dist/modules/transcription/AudioDecoder.d.ts.map +1 -1
- package/dist/modules/transcription/BatchedMonoResampler.d.ts +45 -0
- package/dist/modules/transcription/BatchedMonoResampler.d.ts.map +1 -0
- package/dist/modules/transcription/BatchedMonoResampler.js +116 -0
- package/dist/modules/transcription/BatchedMonoResampler.js.map +1 -0
- package/dist/modules/transcription/CacheStorageModelFileCache.d.ts +38 -0
- package/dist/modules/transcription/CacheStorageModelFileCache.d.ts.map +1 -0
- package/dist/modules/transcription/CacheStorageModelFileCache.js +86 -0
- package/dist/modules/transcription/CacheStorageModelFileCache.js.map +1 -0
- package/dist/modules/transcription/CueDocumentBuilder.d.ts +40 -0
- package/dist/modules/transcription/CueDocumentBuilder.d.ts.map +1 -0
- package/dist/modules/transcription/CueDocumentBuilder.js +77 -0
- package/dist/modules/transcription/CueDocumentBuilder.js.map +1 -0
- package/dist/modules/transcription/CueParseResult.d.ts +16 -0
- package/dist/modules/transcription/CueParseResult.d.ts.map +1 -0
- package/dist/modules/transcription/CueParseResult.js +2 -0
- package/dist/modules/transcription/CueParseResult.js.map +1 -0
- package/dist/modules/transcription/CueTextTokenizer.d.ts +10 -0
- package/dist/modules/transcription/CueTextTokenizer.d.ts.map +1 -0
- package/dist/modules/transcription/CueTextTokenizer.js +21 -0
- package/dist/modules/transcription/CueTextTokenizer.js.map +1 -0
- package/dist/modules/transcription/CueTimecodeReader.d.ts +19 -0
- package/dist/modules/transcription/CueTimecodeReader.d.ts.map +1 -0
- package/dist/modules/transcription/CueTimecodeReader.js +45 -0
- package/dist/modules/transcription/CueTimecodeReader.js.map +1 -0
- package/dist/modules/transcription/CueWordReader.d.ts +12 -0
- package/dist/modules/transcription/CueWordReader.d.ts.map +1 -0
- package/dist/modules/transcription/CueWordReader.js +2 -0
- package/dist/modules/transcription/CueWordReader.js.map +1 -0
- package/dist/modules/transcription/EstimatedCueWordReader.d.ts +16 -0
- package/dist/modules/transcription/EstimatedCueWordReader.d.ts.map +1 -0
- package/dist/modules/transcription/EstimatedCueWordReader.js +17 -0
- package/dist/modules/transcription/EstimatedCueWordReader.js.map +1 -0
- package/dist/modules/transcription/LogitsProcessorListFactory.d.ts +43 -0
- package/dist/modules/transcription/LogitsProcessorListFactory.d.ts.map +1 -0
- package/dist/modules/transcription/LogitsProcessorListFactory.js +72 -0
- package/dist/modules/transcription/LogitsProcessorListFactory.js.map +1 -0
- package/dist/modules/transcription/MediaBunnyAudioDecoder.d.ts +27 -0
- package/dist/modules/transcription/MediaBunnyAudioDecoder.d.ts.map +1 -0
- package/dist/modules/transcription/MediaBunnyAudioDecoder.js +76 -0
- package/dist/modules/transcription/MediaBunnyAudioDecoder.js.map +1 -0
- package/dist/modules/transcription/ModelFileCache.d.ts +20 -0
- package/dist/modules/transcription/ModelFileCache.d.ts.map +1 -0
- package/dist/modules/transcription/ModelFileCache.js +2 -0
- package/dist/modules/transcription/ModelFileCache.js.map +1 -0
- package/dist/modules/transcription/ModelFileCacheUnavailableError.d.ts +18 -0
- package/dist/modules/transcription/ModelFileCacheUnavailableError.d.ts.map +1 -0
- package/dist/modules/transcription/ModelFileCacheUnavailableError.js +18 -0
- package/dist/modules/transcription/ModelFileCacheUnavailableError.js.map +1 -0
- package/dist/modules/transcription/SrtTranscriber.d.ts +24 -15
- package/dist/modules/transcription/SrtTranscriber.d.ts.map +1 -1
- package/dist/modules/transcription/SrtTranscriber.js +32 -90
- package/dist/modules/transcription/SrtTranscriber.js.map +1 -1
- package/dist/modules/transcription/SubtitleFileUnreadableError.d.ts +22 -0
- package/dist/modules/transcription/SubtitleFileUnreadableError.d.ts.map +1 -0
- package/dist/modules/transcription/SubtitleFileUnreadableError.js +22 -0
- package/dist/modules/transcription/SubtitleFileUnreadableError.js.map +1 -0
- package/dist/modules/transcription/TimestampedCueWordReader.d.ts +27 -0
- package/dist/modules/transcription/TimestampedCueWordReader.d.ts.map +1 -0
- package/dist/modules/transcription/TimestampedCueWordReader.js +52 -0
- package/dist/modules/transcription/TimestampedCueWordReader.js.map +1 -0
- package/dist/modules/transcription/Transcriber.d.ts +13 -0
- package/dist/modules/transcription/Transcriber.d.ts.map +1 -1
- package/dist/modules/transcription/TransformersRuntime.d.ts +50 -0
- package/dist/modules/transcription/TransformersRuntime.d.ts.map +1 -0
- package/dist/modules/transcription/TransformersRuntime.js +79 -0
- package/dist/modules/transcription/TransformersRuntime.js.map +1 -0
- package/dist/modules/transcription/VttTranscriber.d.ts +46 -0
- package/dist/modules/transcription/VttTranscriber.d.ts.map +1 -0
- package/dist/modules/transcription/VttTranscriber.js +80 -0
- package/dist/modules/transcription/VttTranscriber.js.map +1 -0
- package/dist/modules/transcription/WhisperChunkStitcher.d.ts +51 -0
- package/dist/modules/transcription/WhisperChunkStitcher.d.ts.map +1 -0
- package/dist/modules/transcription/WhisperChunkStitcher.js +101 -0
- package/dist/modules/transcription/WhisperChunkStitcher.js.map +1 -0
- package/dist/modules/transcription/WhisperDeviceUnavailableError.d.ts +16 -0
- package/dist/modules/transcription/WhisperDeviceUnavailableError.d.ts.map +1 -0
- package/dist/modules/transcription/WhisperDeviceUnavailableError.js +16 -0
- package/dist/modules/transcription/WhisperDeviceUnavailableError.js.map +1 -0
- package/dist/modules/transcription/WhisperInferenceFailedError.d.ts +16 -0
- package/dist/modules/transcription/WhisperInferenceFailedError.d.ts.map +1 -0
- package/dist/modules/transcription/WhisperInferenceFailedError.js +16 -0
- package/dist/modules/transcription/WhisperInferenceFailedError.js.map +1 -0
- package/dist/modules/transcription/WhisperInferenceProgressTracker.d.ts +61 -0
- package/dist/modules/transcription/WhisperInferenceProgressTracker.d.ts.map +1 -0
- package/dist/modules/transcription/WhisperInferenceProgressTracker.js +102 -0
- package/dist/modules/transcription/WhisperInferenceProgressTracker.js.map +1 -0
- package/dist/modules/transcription/WhisperLoopAbortLogitsProcessor.d.ts +38 -0
- package/dist/modules/transcription/WhisperLoopAbortLogitsProcessor.d.ts.map +1 -0
- package/dist/modules/transcription/WhisperLoopAbortLogitsProcessor.js +94 -0
- package/dist/modules/transcription/WhisperLoopAbortLogitsProcessor.js.map +1 -0
- package/dist/modules/transcription/WhisperModelLoadFailedError.d.ts +15 -0
- package/dist/modules/transcription/WhisperModelLoadFailedError.d.ts.map +1 -0
- package/dist/modules/transcription/WhisperModelLoadFailedError.js +15 -0
- package/dist/modules/transcription/WhisperModelLoadFailedError.js.map +1 -0
- package/dist/modules/transcription/WhisperTranscriber.d.ts +106 -7
- package/dist/modules/transcription/WhisperTranscriber.d.ts.map +1 -1
- package/dist/modules/transcription/WhisperTranscriber.js +312 -25
- package/dist/modules/transcription/WhisperTranscriber.js.map +1 -1
- package/dist/modules/transcription/WhisperWindowCoverage.d.ts +79 -0
- package/dist/modules/transcription/WhisperWindowCoverage.d.ts.map +1 -0
- package/dist/modules/transcription/WhisperWindowCoverage.js +129 -0
- package/dist/modules/transcription/WhisperWindowCoverage.js.map +1 -0
- package/dist/modules/transcription/WordTimingEstimator.d.ts +14 -0
- package/dist/modules/transcription/WordTimingEstimator.d.ts.map +1 -0
- package/dist/modules/transcription/WordTimingEstimator.js +33 -0
- package/dist/modules/transcription/WordTimingEstimator.js.map +1 -0
- package/dist/modules/transcription/index.d.ts +9 -2
- package/dist/modules/transcription/index.d.ts.map +1 -1
- package/dist/modules/transcription/index.js +6 -1
- 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 +207 -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 +4 -2
- package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.js +33 -23
- package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.js.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 +24 -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 +13 -10
- package/dist/modules/document/Tag.d.ts.map +0 -1
- package/dist/modules/document/Tag.js.map +0 -1
- package/dist/modules/rendering/AlignmentConfig.d.ts +0 -21
- package/dist/modules/rendering/AlignmentConfig.d.ts.map +0 -1
- package/dist/modules/rendering/AlignmentConfig.js +0 -2
- 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 +0 -15
- package/dist/modules/rendering/ElementRenderOverrides.d.ts.map +0 -1
- package/dist/modules/rendering/ElementRenderOverrides.js +0 -24
- 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 +0 -19
- 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 +0 -21
- 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/transcription/BrowserAudioDecoder.d.ts +0 -13
- package/dist/modules/transcription/BrowserAudioDecoder.d.ts.map +0 -1
- package/dist/modules/transcription/BrowserAudioDecoder.js +0 -34
- package/dist/modules/transcription/BrowserAudioDecoder.js.map +0 -1
- /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/{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
|
@@ -1,28 +1,15 @@
|
|
|
1
1
|
import { CssScoper } from '../css/CssScoper';
|
|
2
2
|
import { CssMinifier } from '../css/CssMinifier';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { SvgFilterBundle } from '../svg-filter/SvgFilterBundle';
|
|
6
|
-
import { SvgFilterScope } from '../svg-filter/SvgFilterScope';
|
|
3
|
+
import { CssVarReferenceScanner } from '../css/CssVarReferenceScanner';
|
|
4
|
+
import { BaselineCssComposer } from '../rendering/styles/BaselineCssComposer';
|
|
7
5
|
import { SvgFilterScoper } from '../svg-filter/SvgFilterScoper';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
// At 4K the same budget admits only ~2 tiles per batch.
|
|
16
|
-
const DEFAULT_MAX_BUFFER_PIXELS = 10 * 1080 * 1920;
|
|
17
|
-
const NO_EXCLUDED_WORDS = new Set();
|
|
18
|
-
// Safety bleed applied to the painted region for video-frame styles
|
|
19
|
-
// that don't declare a `rendering.padding`. 0.25em ≈ enough to cover
|
|
20
|
-
// a typical text-shadow, kept narrow so the crop still pays off.
|
|
21
|
-
const UNDECLARED_PADDING_SAFETY_EM = 0.25;
|
|
22
|
-
const BASELINE_CSS = `html { font-size: 16px; text-rendering: geometricPrecision; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
|
|
23
|
-
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; animation-fill-mode: both; animation-play-state: paused !important; }
|
|
24
|
-
.line { white-space: nowrap; }
|
|
25
|
-
${VIDEO_FRAME_LAYER_BASELINE_CSS}`;
|
|
6
|
+
import { SegmentPaddingCssRuleBuilder } from '../rendering/styles/SegmentPaddingCssRuleBuilder';
|
|
7
|
+
import { PreparedStyleFactory } from '../rendering/subtitle/PreparedStyleFactory';
|
|
8
|
+
import { SpriteSheetSizeProber } from '../rendering/subtitle/SpriteSheetSizeProber';
|
|
9
|
+
import { ActiveRenderSessionFactory } from '../rendering/subtitle/ActiveRenderSessionFactory';
|
|
10
|
+
import { WordFragmenter } from '../bidi/WordFragmenter';
|
|
11
|
+
import { BidiJsAnalyzer } from '../bidi/BidiJsAnalyzer';
|
|
12
|
+
import { CursiveScriptDetector } from '../bidi/CursiveScriptDetector';
|
|
26
13
|
/**
|
|
27
14
|
* Browser-native `SubtitleFrameRenderer` that builds each batch as a
|
|
28
15
|
* single SVG holding one `foreignObject` per unique visual state, and
|
|
@@ -40,29 +27,34 @@ ${VIDEO_FRAME_LAYER_BASELINE_CSS}`;
|
|
|
40
27
|
* stable relationship to what `img.decode` / `drawImage` accept.
|
|
41
28
|
*/
|
|
42
29
|
export class BrowserSubtitleFrameRenderer {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
30
|
+
preparedStyleFactory;
|
|
31
|
+
sizeProber;
|
|
32
|
+
sessionFactory;
|
|
46
33
|
session = null;
|
|
47
|
-
|
|
48
|
-
cssMinifier = new CssMinifier();
|
|
49
|
-
svgFilterScoper = new SvgFilterScoper();
|
|
34
|
+
preparedStyles = null;
|
|
50
35
|
width;
|
|
51
36
|
height;
|
|
37
|
+
constructor(preparedStyleFactory, sizeProber, sessionFactory) {
|
|
38
|
+
this.preparedStyleFactory = preparedStyleFactory;
|
|
39
|
+
this.sizeProber = sizeProber;
|
|
40
|
+
this.sessionFactory = sessionFactory;
|
|
41
|
+
}
|
|
52
42
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* the probed sprite-length cap, drives `getMaxBatchSize`. The
|
|
60
|
-
* default sizes a batch to ~80 MB of pixel buffer.
|
|
43
|
+
* Wires the default collaborator graph: a fresh `CssScoper`,
|
|
44
|
+
* `CssMinifier`, `CssVarReferenceScanner`, `BaselineCssComposer`,
|
|
45
|
+
* `SvgFilterScoper`, and `SegmentPaddingCssRuleBuilder` for the
|
|
46
|
+
* style preparation pipeline, plus the per-batch sprite-size prober
|
|
47
|
+
* and the per-session render-state factory. Pass `maxBufferPixels`
|
|
48
|
+
* to override the default per-batch pixel budget.
|
|
61
49
|
*/
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
50
|
+
static create(cssEmbedder, wordSplitter, options) {
|
|
51
|
+
const baselineCssComposer = new BaselineCssComposer();
|
|
52
|
+
const preparedStyleFactory = new PreparedStyleFactory(cssEmbedder, new CssScoper(), new CssMinifier(), new CssVarReferenceScanner(), baselineCssComposer, new SvgFilterScoper(), new SegmentPaddingCssRuleBuilder());
|
|
53
|
+
const sizeProber = options?.maxBufferPixels !== undefined
|
|
54
|
+
? new SpriteSheetSizeProber(options.maxBufferPixels)
|
|
55
|
+
: new SpriteSheetSizeProber();
|
|
56
|
+
const sessionFactory = new ActiveRenderSessionFactory(wordSplitter, new WordFragmenter(new BidiJsAnalyzer(), new CursiveScriptDetector()), baselineCssComposer);
|
|
57
|
+
return new BrowserSubtitleFrameRenderer(preparedStyleFactory, sizeProber, sessionFactory);
|
|
66
58
|
}
|
|
67
59
|
async open(doc, styles, width, height, videoFrameSource) {
|
|
68
60
|
const requiresFrame = Object.values(styles).some((s) => s.rendering.videoFrame.required);
|
|
@@ -73,53 +65,13 @@ export class BrowserSubtitleFrameRenderer {
|
|
|
73
65
|
this.height = height;
|
|
74
66
|
const prepared = {};
|
|
75
67
|
for (const [kind, style] of Object.entries(styles)) {
|
|
76
|
-
prepared[kind] = await this.
|
|
68
|
+
prepared[kind] = await this.preparedStyleFactory.create(kind, style, doc);
|
|
77
69
|
}
|
|
78
|
-
this.
|
|
70
|
+
this.preparedStyles = prepared;
|
|
71
|
+
this.session = this.sessionFactory.create(doc, prepared, width, height, videoFrameSource ?? null);
|
|
79
72
|
}
|
|
80
73
|
async getMaxBatchSize() {
|
|
81
|
-
|
|
82
|
-
for (const numberOfTiles of NUMBER_OF_TILES_TO_TEST) {
|
|
83
|
-
const isPortrait = this.width < this.height;
|
|
84
|
-
const scaledWidth = isPortrait ? this.width * numberOfTiles : this.width;
|
|
85
|
-
const scaledHeight = isPortrait ? this.height : this.height * numberOfTiles;
|
|
86
|
-
const length = scaledWidth * scaledHeight;
|
|
87
|
-
if (length > this.maxBufferPixels) {
|
|
88
|
-
return numberOfTiles;
|
|
89
|
-
}
|
|
90
|
-
if (!(await this.testTileSize(scaledWidth, scaledHeight))) {
|
|
91
|
-
return numberOfTiles;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return 1;
|
|
95
|
-
}
|
|
96
|
-
catch {
|
|
97
|
-
return 1;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Renders a green field with a red 2×2 marker in the bottom-right
|
|
102
|
-
* corner at the target size, decodes it, paints it, and reads back
|
|
103
|
-
* the corner pixel. Some hosts decode oversize SVGs but leave the
|
|
104
|
-
* far edges of the raster blank — the readback catches that.
|
|
105
|
-
*/
|
|
106
|
-
async testTileSize(width, height) {
|
|
107
|
-
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}"><rect width="100%" height="100%" fill="green"/><rect x="${width - 2}" y="${height - 2}" width="2" height="2" fill="red"/></svg>`;
|
|
108
|
-
const img = new Image();
|
|
109
|
-
img.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
|
|
110
|
-
try {
|
|
111
|
-
await img.decode();
|
|
112
|
-
const canvas = new OffscreenCanvas(width, height);
|
|
113
|
-
const ctx = canvas.getContext('2d');
|
|
114
|
-
if (!ctx)
|
|
115
|
-
return false;
|
|
116
|
-
ctx.drawImage(img, 0, 0);
|
|
117
|
-
const px = ctx.getImageData(width - 1, height - 1, 1, 1).data;
|
|
118
|
-
return px[0] > 200 && px[1] < 80 && px[2] < 80 && px[3] > 200;
|
|
119
|
-
}
|
|
120
|
-
catch {
|
|
121
|
-
return false;
|
|
122
|
-
}
|
|
74
|
+
return this.sizeProber.probe(this.width, this.height);
|
|
123
75
|
}
|
|
124
76
|
async getFrames(timestamps) {
|
|
125
77
|
if (!this.session)
|
|
@@ -135,641 +87,15 @@ export class BrowserSubtitleFrameRenderer {
|
|
|
135
87
|
close() {
|
|
136
88
|
this.session?.dispose();
|
|
137
89
|
this.session = null;
|
|
138
|
-
this.
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
const minified = this.cssMinifier.minify(style.css);
|
|
143
|
-
const embedded = await this.cssEmbedder.embed(minified);
|
|
144
|
-
const scopeClass = `tscaps-render-${kind}-${Math.random().toString(36).slice(2, 8)}`;
|
|
145
|
-
const { css: cssWithIndirectFilters } = this.svgFilterScoper.rewriteCss(embedded);
|
|
146
|
-
const scopedCss = this.cssScoper.scope(cssWithIndirectFilters, `.${scopeClass}`);
|
|
147
|
-
// Probe styles live in `document.head` while the renderer is
|
|
148
|
-
// open; without the scopeClass guard, any `.word`/`.line`/etc on
|
|
149
|
-
// the host page would inherit them.
|
|
150
|
-
const scopedBaseline = this.cssScoper.scope(BASELINE_CSS, `.${scopeClass}`);
|
|
151
|
-
const probeStyleEl = document.createElement('style');
|
|
152
|
-
probeStyleEl.textContent = scopedBaseline + scopedCss;
|
|
153
|
-
document.head.appendChild(probeStyleEl);
|
|
154
|
-
const probeContainer = document.createElement('div');
|
|
155
|
-
probeContainer.className = scopeClass;
|
|
156
|
-
probeContainer.style.cssText = 'position:fixed;left:-99999px;visibility:hidden;pointer-events:none;';
|
|
157
|
-
document.body.appendChild(probeContainer);
|
|
158
|
-
return {
|
|
159
|
-
kind,
|
|
160
|
-
scopedCss,
|
|
161
|
-
filters: style.svgFilters ?? SvgFilterBundle.empty({
|
|
162
|
-
scopeAt: () => SvgFilterScope.empty(),
|
|
163
|
-
lengthFactorsAt: () => ({ pxPerEm: 0, pxPerCqh: 0 }),
|
|
164
|
-
}),
|
|
165
|
-
inlineStyles: style.inlineStyles,
|
|
166
|
-
alignment: style.alignment,
|
|
167
|
-
rendering: style.rendering,
|
|
168
|
-
wordOverrides: style.wordOverrides ?? ElementRenderOverrides.empty(),
|
|
169
|
-
segmentOverrides: style.segmentOverrides ?? ElementRenderOverrides.empty(),
|
|
170
|
-
probeContainer,
|
|
171
|
-
scopeClass,
|
|
172
|
-
probeCache: new Map(),
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
class ActiveRenderSession {
|
|
177
|
-
doc;
|
|
178
|
-
styles;
|
|
179
|
-
width;
|
|
180
|
-
height;
|
|
181
|
-
videoFrameSource;
|
|
182
|
-
svgFilterScoper = new SvgFilterScoper();
|
|
183
|
-
svgFilterLengthResolver = new SvgFilterLengthResolver();
|
|
184
|
-
paintRegionResolver = new SegmentPaintRegionResolver();
|
|
185
|
-
paintRegionsBySegmentId = new Map();
|
|
186
|
-
subtreeBuilder;
|
|
187
|
-
constructor(doc, styles, wordSplitter, width, height, videoFrameSource) {
|
|
188
|
-
this.doc = doc;
|
|
189
|
-
this.styles = styles;
|
|
190
|
-
this.width = width;
|
|
191
|
-
this.height = height;
|
|
192
|
-
this.videoFrameSource = videoFrameSource;
|
|
193
|
-
this.subtreeBuilder = new SegmentSubtreeHtmlBuilder(wordSplitter);
|
|
194
|
-
}
|
|
195
|
-
async getFrames(timestamps) {
|
|
196
|
-
if (timestamps.length === 0)
|
|
197
|
-
return [];
|
|
198
|
-
const plan = this.planBatch(timestamps);
|
|
199
|
-
if (plan.groups.size === 0)
|
|
200
|
-
return timestamps.map(() => null);
|
|
201
|
-
const sprites = await this.renderGroups(plan.groups);
|
|
202
|
-
return this.buildFrames(plan.assignments, sprites);
|
|
203
|
-
}
|
|
204
|
-
dispose() {
|
|
205
|
-
for (const style of Object.values(this.styles)) {
|
|
206
|
-
style.probeContainer.remove();
|
|
207
|
-
style.probeCache.clear();
|
|
208
|
-
}
|
|
209
|
-
this.paintRegionsBySegmentId.clear();
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Splits timestamps into per-asset-key groups so each rendered SVG
|
|
213
|
-
* carries only the CSS and font payload its tiles actually need —
|
|
214
|
-
* sharing one data URL across kinds with disjoint assets transfers
|
|
215
|
-
* extra bytes for no amortization gain. Within each group,
|
|
216
|
-
* timestamps sharing a state key collapse into one tile.
|
|
217
|
-
*/
|
|
218
|
-
planBatch(timestamps) {
|
|
219
|
-
const groups = new Map();
|
|
220
|
-
const tilesByKey = new Map();
|
|
221
|
-
const assignments = timestamps.map((t) => {
|
|
222
|
-
const items = this.itemsAt(t);
|
|
223
|
-
if (items.length === 0)
|
|
224
|
-
return null;
|
|
225
|
-
const assetKey = this.computeAssetKey(items);
|
|
226
|
-
let group = groups.get(assetKey);
|
|
227
|
-
let groupTiles;
|
|
228
|
-
if (!group) {
|
|
229
|
-
group = { assetKey, uniqueTiles: [] };
|
|
230
|
-
groups.set(assetKey, group);
|
|
231
|
-
groupTiles = new Map();
|
|
232
|
-
tilesByKey.set(assetKey, groupTiles);
|
|
233
|
-
}
|
|
234
|
-
else {
|
|
235
|
-
groupTiles = tilesByKey.get(assetKey);
|
|
236
|
-
}
|
|
237
|
-
const stateKey = this.computeStateKey(items, t);
|
|
238
|
-
let tile = groupTiles.get(stateKey);
|
|
239
|
-
if (!tile) {
|
|
240
|
-
tile = { items, tileIndex: group.uniqueTiles.length };
|
|
241
|
-
group.uniqueTiles.push(tile);
|
|
242
|
-
groupTiles.set(stateKey, tile);
|
|
243
|
-
}
|
|
244
|
-
return { assetKey, tileIndex: tile.tileIndex };
|
|
245
|
-
});
|
|
246
|
-
return { groups, assignments };
|
|
247
|
-
}
|
|
248
|
-
async renderGroups(groups) {
|
|
249
|
-
const sprites = new Map();
|
|
250
|
-
for (const group of groups.values()) {
|
|
251
|
-
const img = await this.renderSpriteSheet(group.uniqueTiles);
|
|
252
|
-
sprites.set(group.assetKey, img);
|
|
253
|
-
}
|
|
254
|
-
return sprites;
|
|
255
|
-
}
|
|
256
|
-
buildFrames(assignments, sprites) {
|
|
257
|
-
const isPortrait = this.width < this.height;
|
|
258
|
-
return assignments.map((assn) => {
|
|
259
|
-
if (!assn)
|
|
260
|
-
return null;
|
|
261
|
-
const img = sprites.get(assn.assetKey);
|
|
262
|
-
const sx = isPortrait ? assn.tileIndex * this.width : 0;
|
|
263
|
-
const sy = isPortrait ? 0 : assn.tileIndex * this.height;
|
|
264
|
-
return {
|
|
265
|
-
draw: (ctx, dx, dy, dw, dh) => ctx.drawImage(img, sx, sy, this.width, this.height, dx, dy, dw, dh),
|
|
266
|
-
};
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
async renderSpriteSheet(tiles) {
|
|
270
|
-
const isPortrait = this.width < this.height;
|
|
271
|
-
const sheetW = isPortrait ? tiles.length * this.width : this.width;
|
|
272
|
-
const sheetH = isPortrait ? this.height : tiles.length * this.height;
|
|
273
|
-
let itemUid = 0;
|
|
274
|
-
const tileResults = await Promise.all(tiles.map((tile, i) => this.buildTileHtml(tile, i, isPortrait, this.width, this.height, () => itemUid++)));
|
|
275
|
-
const tilesHtml = tileResults.map((r) => r.html).join('');
|
|
276
|
-
const filterDefs = tileResults.map((r) => r.defs).filter(Boolean).join('');
|
|
277
|
-
const sectionCss = this.joinByKind(this.collectActiveKinds(tiles), (style) => style.scopedCss);
|
|
278
|
-
const defsBlock = filterDefs ? `<defs>${filterDefs}</defs>` : '';
|
|
279
|
-
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${sheetW}" height="${sheetH}">${defsBlock}<style>${BASELINE_CSS}${sectionCss}</style>${tilesHtml}</svg>`;
|
|
280
|
-
return this.decodeSvg(svg, tiles, sheetW, sheetH);
|
|
281
|
-
}
|
|
282
|
-
collectActiveKinds(tiles) {
|
|
283
|
-
const kinds = new Set();
|
|
284
|
-
for (const tile of tiles)
|
|
285
|
-
for (const item of tile.items)
|
|
286
|
-
kinds.add(item.style.kind);
|
|
287
|
-
return kinds;
|
|
288
|
-
}
|
|
289
|
-
joinByKind(kinds, pick) {
|
|
290
|
-
return [...kinds].map((kind) => pick(this.styles[kind])).filter(Boolean).join('\n');
|
|
291
|
-
}
|
|
292
|
-
async buildTileHtml(tile, i, isPortrait, width, height, nextUid) {
|
|
293
|
-
const tx = isPortrait ? i * width : 0;
|
|
294
|
-
const ty = isPortrait ? 0 : i * height;
|
|
295
|
-
const wrapperResults = await Promise.all(tile.items.map(({ style, seg, t }) => this.buildWrapperHtml(style, seg, t, width, height, nextUid)));
|
|
296
|
-
const wrappers = wrapperResults.map((r) => r.html).join('');
|
|
297
|
-
const defs = wrapperResults.map((r) => r.defs).filter(Boolean).join('');
|
|
298
|
-
const html = `<foreignObject x="${tx}" y="${ty}" width="${width}" height="${height}"><div xmlns="http://www.w3.org/1999/xhtml" style="position:relative;width:${width}px;height:${height}px;overflow:hidden;container-type:size;">${wrappers}</div></foreignObject>`;
|
|
299
|
-
return { html, defs };
|
|
300
|
-
}
|
|
301
|
-
async decodeSvg(svg, tiles, sheetW, sheetH) {
|
|
302
|
-
const img = new Image();
|
|
303
|
-
img.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
|
|
304
|
-
// `onload` can fire before custom fonts have finished applying,
|
|
305
|
-
// producing visually-laggy captures with foreignObject + @font-face.
|
|
306
|
-
// `decode()` only resolves once the image is fully paint-ready.
|
|
307
|
-
try {
|
|
308
|
-
await img.decode();
|
|
309
|
-
}
|
|
310
|
-
catch (e) {
|
|
311
|
-
const kinds = new Set();
|
|
312
|
-
for (const tile of tiles)
|
|
313
|
-
for (const item of tile.items)
|
|
314
|
-
kinds.add(item.style.kind);
|
|
315
|
-
console.error('[tscaps] subtitle SVG decode failed', {
|
|
316
|
-
error: e instanceof Error ? e.message : String(e),
|
|
317
|
-
kinds: [...kinds],
|
|
318
|
-
tiles: tiles.length,
|
|
319
|
-
sheetW,
|
|
320
|
-
sheetH,
|
|
321
|
-
svgLength: svg.length,
|
|
322
|
-
svgHead: svg.slice(0, 400),
|
|
323
|
-
});
|
|
324
|
-
throw new Error(`Subtitle render failed: ${e instanceof Error ? e.message : String(e)}`, { cause: e });
|
|
325
|
-
}
|
|
326
|
-
return img;
|
|
327
|
-
}
|
|
328
|
-
itemsAt(t) {
|
|
329
|
-
const items = [];
|
|
330
|
-
for (const seg of this.doc.getActiveSegments(t)) {
|
|
331
|
-
const style = this.styles[seg.getSection().kind];
|
|
332
|
-
if (style)
|
|
333
|
-
items.push({ seg, style, t });
|
|
334
|
-
}
|
|
335
|
-
return items;
|
|
336
|
-
}
|
|
337
|
-
computeAssetKey(items) {
|
|
338
|
-
const kinds = new Set();
|
|
339
|
-
for (const it of items)
|
|
340
|
-
kinds.add(it.style.kind);
|
|
341
|
-
return [...kinds].sort().join(',');
|
|
342
|
-
}
|
|
343
|
-
computeStateKey(items, t) {
|
|
344
|
-
return items.map(({ seg, style }) => {
|
|
345
|
-
const base = `${style.kind}:${seg.id}:${this.fingerprintSegmentState(seg, t)}`;
|
|
346
|
-
return this.isItemAnimating(style, seg, t) ? `${base}:${t.toFixed(3)}` : base;
|
|
347
|
-
}).join('|');
|
|
348
|
-
}
|
|
349
|
-
/**
|
|
350
|
-
* Captures every time-varying CSS class the segment subtree exposes
|
|
351
|
-
* (segment, lines, words) so two timestamps that resolve to the same
|
|
352
|
-
* computed style — and therefore the same rendered frame outside
|
|
353
|
-
* active animation windows — share a tile, while two timestamps with
|
|
354
|
-
* different class states (e.g. a line pre-narration vs. already
|
|
355
|
-
* narrated) stay distinct even when no word is active.
|
|
356
|
-
*/
|
|
357
|
-
fingerprintSegmentState(seg, t) {
|
|
358
|
-
const segClasses = seg.getCssClasses(t).join(',');
|
|
359
|
-
const lineFingerprints = [...seg.lines].map((line) => this.fingerprintLineState(line, t));
|
|
360
|
-
return `${segClasses}|{${lineFingerprints.join(';')}}`;
|
|
361
|
-
}
|
|
362
|
-
fingerprintLineState(line, t) {
|
|
363
|
-
const lineClasses = line.getCssClasses(t).join(',');
|
|
364
|
-
const wordClasses = [...line.words].map((w) => w.getCssClasses(t).join(',')).join('|');
|
|
365
|
-
return `${lineClasses}[${wordClasses}]`;
|
|
366
|
-
}
|
|
367
|
-
isItemAnimating(style, seg, t) {
|
|
368
|
-
// Letter-level CSS typically combines time vars via calc(), which
|
|
369
|
-
// destroys the fingerprint-based probe; treat the segment as
|
|
370
|
-
// always animating in that mode and redraw every frame.
|
|
371
|
-
if (style.rendering.splitWordsIntoLetters)
|
|
372
|
-
return true;
|
|
373
|
-
// Styles that bake the underlying video frame into their visuals
|
|
374
|
-
// change every tick by definition — no two timestamps share state.
|
|
375
|
-
if (style.rendering.videoFrame.required)
|
|
376
|
-
return true;
|
|
377
|
-
// Filter definitions whose materialized output can vary with
|
|
378
|
-
// `currentTime` likewise force per-frame redraw; conservatively
|
|
379
|
-
// treat any non-empty filter set as time-varying — the renderer
|
|
380
|
-
// has no introspection into the consumer's scope provider.
|
|
381
|
-
if (!style.filters.definitions.isEmpty())
|
|
382
|
-
return true;
|
|
383
|
-
const segClasses = seg.getCssClasses(t);
|
|
384
|
-
if (this.evalAnims(this.segmentTiming(style, segClasses), t, seg.time.start, seg.time.end))
|
|
385
|
-
return true;
|
|
386
|
-
return [...seg.lines].some((line) => {
|
|
387
|
-
const lineClasses = line.getCssClasses(t);
|
|
388
|
-
if (this.evalAnims(this.lineTiming(style, lineClasses, segClasses), t, seg.time.start, seg.time.end, line.time.start, line.time.end))
|
|
389
|
-
return true;
|
|
390
|
-
return [...line.words].some((word) => {
|
|
391
|
-
const wordClasses = word.getCssClasses(t);
|
|
392
|
-
return this.evalAnims(this.wordTiming(style, wordClasses, lineClasses, segClasses), t, seg.time.start, seg.time.end, line.time.start, line.time.end, word.time.start, word.time.end);
|
|
393
|
-
});
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
evalAnims(anims, t, segStart, segEnd, lineStart, lineEnd, wordStart, wordEnd) {
|
|
397
|
-
return anims.some((a) => {
|
|
398
|
-
let startT;
|
|
399
|
-
switch (a.cssVar) {
|
|
400
|
-
case CssVariable.SECTION_STARTS:
|
|
401
|
-
case CssVariable.SECTION_ENDS:
|
|
402
|
-
// Section-level animations are not yet wired into per-frame
|
|
403
|
-
// timing — treat them as never active.
|
|
404
|
-
return false;
|
|
405
|
-
case CssVariable.SEGMENT_STARTS:
|
|
406
|
-
startT = segStart;
|
|
407
|
-
break;
|
|
408
|
-
case CssVariable.SEGMENT_ENDS:
|
|
409
|
-
startT = segEnd;
|
|
410
|
-
break;
|
|
411
|
-
case CssVariable.LINE_NOT_NARRATED_YET_STARTS:
|
|
412
|
-
startT = segStart;
|
|
413
|
-
break;
|
|
414
|
-
case CssVariable.LINE_NOT_NARRATED_YET_ENDS:
|
|
415
|
-
startT = lineStart ?? segStart;
|
|
416
|
-
break;
|
|
417
|
-
case CssVariable.LINE_BEING_NARRATED_STARTS:
|
|
418
|
-
startT = lineStart ?? segStart;
|
|
419
|
-
break;
|
|
420
|
-
case CssVariable.LINE_BEING_NARRATED_ENDS:
|
|
421
|
-
startT = lineEnd ?? segEnd;
|
|
422
|
-
break;
|
|
423
|
-
case CssVariable.LINE_ALREADY_NARRATED_STARTS:
|
|
424
|
-
startT = lineEnd ?? segEnd;
|
|
425
|
-
break;
|
|
426
|
-
case CssVariable.LINE_ALREADY_NARRATED_ENDS:
|
|
427
|
-
startT = segEnd;
|
|
428
|
-
break;
|
|
429
|
-
case CssVariable.WORD_NOT_NARRATED_YET_STARTS:
|
|
430
|
-
startT = segStart;
|
|
431
|
-
break;
|
|
432
|
-
case CssVariable.WORD_NOT_NARRATED_YET_ENDS:
|
|
433
|
-
startT = wordStart ?? segStart;
|
|
434
|
-
break;
|
|
435
|
-
case CssVariable.WORD_BEING_NARRATED_STARTS:
|
|
436
|
-
startT = wordStart ?? segStart;
|
|
437
|
-
break;
|
|
438
|
-
case CssVariable.WORD_BEING_NARRATED_ENDS:
|
|
439
|
-
startT = wordEnd ?? segEnd;
|
|
440
|
-
break;
|
|
441
|
-
case CssVariable.WORD_ALREADY_NARRATED_STARTS:
|
|
442
|
-
startT = wordEnd ?? segEnd;
|
|
443
|
-
break;
|
|
444
|
-
case CssVariable.WORD_ALREADY_NARRATED_ENDS:
|
|
445
|
-
startT = segEnd;
|
|
446
|
-
break;
|
|
447
|
-
default: return false;
|
|
448
|
-
}
|
|
449
|
-
return t >= startT && t < startT + a.durationS;
|
|
450
|
-
});
|
|
451
|
-
}
|
|
452
|
-
/**
|
|
453
|
-
* Renders the segment and any words that have been promoted out of
|
|
454
|
-
* flow by a per-word alignment override. The promoted words appear as
|
|
455
|
-
* sibling anchors after the main wrapper; their original slot in the
|
|
456
|
-
* line is omitted so neighbours reflow into the freed space.
|
|
457
|
-
*/
|
|
458
|
-
async buildWrapperHtml(style, seg, t, width, height, nextUid) {
|
|
459
|
-
const segmentOverride = style.segmentOverrides.get(seg.id);
|
|
460
|
-
const segmentAlignment = { ...style.alignment, ...segmentOverride?.alignment };
|
|
461
|
-
const segmentInlineStylesOverride = segmentOverride?.inlineStyles;
|
|
462
|
-
const baseInlineStyles = segmentInlineStylesOverride
|
|
463
|
-
? { ...style.inlineStyles, ...segmentInlineStylesOverride }
|
|
464
|
-
: style.inlineStyles;
|
|
465
|
-
const positionedWords = this.collectPositionedWords(seg, style.wordOverrides);
|
|
466
|
-
const excludedWordIds = new Set(positionedWords.map((w) => w.id));
|
|
467
|
-
// Skip the main segment subtree entirely when every word has been
|
|
468
|
-
// pulled into a positioned-word sibling — otherwise the segment's
|
|
469
|
-
// own decorations (background, ::before chrome, padding) would
|
|
470
|
-
// paint as an empty shell on the frame. Positioned words render
|
|
471
|
-
// below regardless.
|
|
472
|
-
let html = '';
|
|
473
|
-
let defs = '';
|
|
474
|
-
if (!this.allWordsExcluded(seg, excludedWordIds)) {
|
|
475
|
-
const main = await this.buildSegmentSubtreeHtml(style, seg, t, width, height, segmentAlignment, baseInlineStyles, excludedWordIds, nextUid);
|
|
476
|
-
html = main.html;
|
|
477
|
-
defs = main.defs;
|
|
478
|
-
}
|
|
479
|
-
for (const word of positionedWords) {
|
|
480
|
-
const wordAlignmentOverride = style.wordOverrides.get(word.id)?.alignment;
|
|
481
|
-
const wordAlignment = { ...segmentAlignment, ...wordAlignmentOverride };
|
|
482
|
-
const line = this.findLineContainingWord(seg, word);
|
|
483
|
-
const built = await this.buildPositionedWordSubtreeHtml(style, seg, line, word, t, width, height, wordAlignment, baseInlineStyles, nextUid);
|
|
484
|
-
html += built.html;
|
|
485
|
-
defs += built.defs;
|
|
486
|
-
}
|
|
487
|
-
return { html, defs };
|
|
488
|
-
}
|
|
489
|
-
/**
|
|
490
|
-
* Builds the main anchor → wrapper → segment subtree at the
|
|
491
|
-
* segment's effective alignment. Words whose ids appear in
|
|
492
|
-
* `excludedWordIds` are omitted from the line so neighbours reflow;
|
|
493
|
-
* the caller renders them as separate positioned-word subtrees.
|
|
494
|
-
*/
|
|
495
|
-
async buildSegmentSubtreeHtml(style, seg, t, width, height, alignment, baseInlineStyles, excludedWordIds, nextUid) {
|
|
496
|
-
const resolved = this.resolveAlignment(alignment, width, height);
|
|
497
|
-
const engineVars = await this.buildEngineVars(style, seg, t, width, height, resolved);
|
|
498
|
-
const { defs, bindings } = this.materializeFilters(style, t, engineVars, nextUid);
|
|
499
|
-
const styleInput = this.composeStyleInput(style, this.mergeExtras(engineVars, bindings, baseInlineStyles));
|
|
500
|
-
const subtreeHtml = this.subtreeBuilder.buildSegmentSubtree(styleInput, seg, t, excludedWordIds);
|
|
501
|
-
const anchorStyle = this.composeAnchorStyle(resolved);
|
|
502
|
-
const html = `<div style="${anchorStyle}">${subtreeHtml}</div>`;
|
|
503
|
-
return { html, defs };
|
|
504
|
-
}
|
|
505
|
-
/**
|
|
506
|
-
* Builds a sibling anchor → wrapper → mini-segment subtree for a
|
|
507
|
-
* single word at its effective alignment. The synthetic chain
|
|
508
|
-
* (segment, single-line, single-word) carries the same time-driven
|
|
509
|
-
* classes and CSS variables as the main render so template rules
|
|
510
|
-
* apply identically; only the position differs.
|
|
511
|
-
*/
|
|
512
|
-
async buildPositionedWordSubtreeHtml(style, seg, line, word, t, width, height, alignment, baseInlineStyles, nextUid) {
|
|
513
|
-
const resolved = this.resolveAlignment(alignment, width, height);
|
|
514
|
-
const engineVars = await this.buildEngineVars(style, seg, t, width, height, resolved);
|
|
515
|
-
const { defs, bindings } = this.materializeFilters(style, t, engineVars, nextUid);
|
|
516
|
-
const styleInput = this.composeStyleInput(style, this.mergeExtras(engineVars, bindings, baseInlineStyles));
|
|
517
|
-
const subtreeHtml = this.subtreeBuilder.buildSingleWordSubtree(styleInput, seg, line, word, t);
|
|
518
|
-
const anchorStyle = this.composeAnchorStyle(resolved);
|
|
519
|
-
const html = `<div style="${anchorStyle}">${subtreeHtml}</div>`;
|
|
520
|
-
return { html, defs };
|
|
521
|
-
}
|
|
522
|
-
collectPositionedWords(seg, wordOverrides) {
|
|
523
|
-
const out = [];
|
|
524
|
-
for (const line of seg.lines) {
|
|
525
|
-
for (const word of line.words) {
|
|
526
|
-
if (wordOverrides.get(word.id)?.alignment)
|
|
527
|
-
out.push(word);
|
|
90
|
+
if (this.preparedStyles) {
|
|
91
|
+
for (const style of Object.values(this.preparedStyles)) {
|
|
92
|
+
style.probeStyleElement.remove();
|
|
93
|
+
style.probeContainer.remove();
|
|
528
94
|
}
|
|
95
|
+
this.preparedStyles = null;
|
|
529
96
|
}
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
allWordsExcluded(seg, excludedWordIds) {
|
|
533
|
-
for (const line of seg.lines) {
|
|
534
|
-
for (const word of line.words) {
|
|
535
|
-
if (!excludedWordIds.has(word.id))
|
|
536
|
-
return false;
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
return true;
|
|
540
|
-
}
|
|
541
|
-
findLineContainingWord(seg, word) {
|
|
542
|
-
for (const line of seg.lines) {
|
|
543
|
-
for (const w of line.words) {
|
|
544
|
-
if (w.id === word.id)
|
|
545
|
-
return line;
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
throw new Error(`Word ${word.id} not found in segment ${seg.id}`);
|
|
549
|
-
}
|
|
550
|
-
// Zero-sized grid anchor places the wrapper via `place-items`
|
|
551
|
-
// so the wrapper stays transform-free and doesn't form a
|
|
552
|
-
// stacking context (which would trap descendant
|
|
553
|
-
// `mix-blend-mode` away from the layer).
|
|
554
|
-
composeAnchorStyle(resolved) {
|
|
555
|
-
return `position: absolute; top: ${resolved.yPx}px; left: ${resolved.xPx}px; width: 0; height: 0; display: grid; grid-template: 0 / 0; align-items: ${resolved.vGridAlign}; justify-items: ${resolved.hGridAlign};`;
|
|
556
|
-
}
|
|
557
|
-
/**
|
|
558
|
-
* Per-call style input handed to the subtree builder, materialized
|
|
559
|
-
* from the prepared style plus the per-frame wrapper extras.
|
|
560
|
-
* Pulling this together once per call keeps the builder stateless
|
|
561
|
-
* and avoids re-deriving the same flags inside it.
|
|
562
|
-
*/
|
|
563
|
-
composeStyleInput(style, extraWrapperStyles) {
|
|
564
|
-
return {
|
|
565
|
-
scopeClass: style.scopeClass,
|
|
566
|
-
baseInlineStyles: style.inlineStyles,
|
|
567
|
-
wordOverrides: style.wordOverrides,
|
|
568
|
-
splitWordsIntoLetters: style.rendering.splitWordsIntoLetters,
|
|
569
|
-
includeVideoFrameLayer: style.rendering.videoFrame.required,
|
|
570
|
-
extraWrapperStyles,
|
|
571
|
-
};
|
|
572
|
-
}
|
|
573
|
-
/**
|
|
574
|
-
* Folds the engine-injected video-frame vars and filter-id bindings
|
|
575
|
-
* onto the base inline styles in cascade order so per-segment
|
|
576
|
-
* overrides win over the style's defaults when both are present.
|
|
577
|
-
*/
|
|
578
|
-
mergeExtras(engineVars, bindings, baseInlineStyles) {
|
|
579
|
-
return { ...baseInlineStyles, ...engineVars, ...Object.fromEntries(bindings) };
|
|
580
|
-
}
|
|
581
|
-
/**
|
|
582
|
-
* Reduces an `AlignmentConfig` to the concrete numbers the wrapper
|
|
583
|
-
* HTML and video-frame vars consume: the anchor point in pixels, the
|
|
584
|
-
* anchor-edge fraction in percent, and the matching grid keywords.
|
|
585
|
-
* Called per segment with the segment's effective alignment so that
|
|
586
|
-
* per-segment overrides flow through every downstream consumer.
|
|
587
|
-
*/
|
|
588
|
-
resolveAlignment(alignment, width, height) {
|
|
589
|
-
return {
|
|
590
|
-
yPx: Math.round(alignment.verticalOffset * height),
|
|
591
|
-
xPx: Math.round(alignment.horizontalOffset * width),
|
|
592
|
-
vAnchorPct: alignment.verticalAlign === 'top' ? 0 : alignment.verticalAlign === 'center' ? 50 : 100,
|
|
593
|
-
hAnchorPct: alignment.horizontalAlign === 'left' ? 0 : alignment.horizontalAlign === 'center' ? 50 : 100,
|
|
594
|
-
vGridAlign: alignment.verticalAlign === 'top' ? 'start' : alignment.verticalAlign === 'center' ? 'center' : 'end',
|
|
595
|
-
hGridAlign: alignment.horizontalAlign === 'left' ? 'start' : alignment.horizontalAlign === 'center' ? 'center' : 'end',
|
|
596
|
-
};
|
|
597
|
-
}
|
|
598
|
-
async buildEngineVars(style, seg, t, width, height, resolved) {
|
|
599
|
-
if (!style.rendering.videoFrame.required)
|
|
600
|
-
return {};
|
|
601
|
-
const region = this.resolvePaintRegion(style, seg, resolved, width, height);
|
|
602
|
-
// Offset vars assume the consuming element is a direct child of
|
|
603
|
-
// the wrapper: `%` resolves against the wrapper. The `region.x`/`y`
|
|
604
|
-
// bias positions the layer so the cropped frame's (0,0) lands on
|
|
605
|
-
// viewport `(region.x, region.y)`; when no crop applies the bias
|
|
606
|
-
// is zero and the layer covers the full viewport.
|
|
607
|
-
return {
|
|
608
|
-
[CssVariable.VIDEO_FRAME]: `url("${await this.videoFrameSource.getFrameAt(t, style.rendering.videoFrame.jpegQuality, region)}")`,
|
|
609
|
-
[CssVariable.SUBTITLE_REGION_WIDTH]: `${region.width}px`,
|
|
610
|
-
[CssVariable.SUBTITLE_REGION_HEIGHT]: `${region.height}px`,
|
|
611
|
-
[CssVariable.SUBTITLE_REGION_X]: `calc(${resolved.hAnchorPct}% - ${resolved.xPx - region.x}px)`,
|
|
612
|
-
[CssVariable.SUBTITLE_REGION_Y]: `calc(${resolved.vAnchorPct}% - ${resolved.yPx - region.y}px)`,
|
|
613
|
-
};
|
|
614
|
-
}
|
|
615
|
-
/**
|
|
616
|
-
* Looks up the painted region for `seg` in the per-session cache;
|
|
617
|
-
* on a miss, derives the region (full viewport when any word has a
|
|
618
|
-
* positioned override, otherwise the tight measured bbox) and
|
|
619
|
-
* caches it. Keyed by `${kind}:${seg.id}` to keep two styles'
|
|
620
|
-
* segments from colliding.
|
|
621
|
-
*
|
|
622
|
-
* The tight-crop optimization assumes every word stays inside the
|
|
623
|
-
* segment's in-flow bounding box. As soon as a word is repositioned
|
|
624
|
-
* outside that bbox, the same crop leaves its video-frame backdrop
|
|
625
|
-
* sampling pixels that aren't in the JPEG payload. Falling back to
|
|
626
|
-
* the full viewport for those segments restores correctness; the
|
|
627
|
-
* optimization recovers automatically the moment the user resets
|
|
628
|
-
* the override.
|
|
629
|
-
*/
|
|
630
|
-
resolvePaintRegion(style, seg, placement, viewportWidth, viewportHeight) {
|
|
631
|
-
const cacheKey = `${style.kind}:${seg.id}`;
|
|
632
|
-
const cached = this.paintRegionsBySegmentId.get(cacheKey);
|
|
633
|
-
if (cached)
|
|
634
|
-
return cached;
|
|
635
|
-
const region = this.hasPositionedWord(seg, style.wordOverrides)
|
|
636
|
-
? { x: 0, y: 0, width: viewportWidth, height: viewportHeight }
|
|
637
|
-
: this.measureSegmentPaintRegion(style, seg, placement, viewportWidth, viewportHeight);
|
|
638
|
-
this.paintRegionsBySegmentId.set(cacheKey, region);
|
|
639
|
-
return region;
|
|
640
|
-
}
|
|
641
|
-
measureSegmentPaintRegion(style, seg, placement, viewportWidth, viewportHeight) {
|
|
642
|
-
const segmentHtml = this.subtreeBuilder.buildSegmentSubtree(this.composeStyleInput(style, {}), seg, seg.time.start, NO_EXCLUDED_WORDS);
|
|
643
|
-
return this.paintRegionResolver.resolve({
|
|
644
|
-
segmentHtml,
|
|
645
|
-
probeContainer: style.probeContainer,
|
|
646
|
-
placement,
|
|
647
|
-
viewportWidth,
|
|
648
|
-
viewportHeight,
|
|
649
|
-
safetyBleedEm: style.rendering.padding === null ? UNDECLARED_PADDING_SAFETY_EM : 0,
|
|
650
|
-
});
|
|
651
|
-
}
|
|
652
|
-
hasPositionedWord(seg, wordOverrides) {
|
|
653
|
-
for (const line of seg.lines) {
|
|
654
|
-
for (const word of line.words) {
|
|
655
|
-
if (wordOverrides.get(word.id)?.alignment)
|
|
656
|
-
return true;
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
return false;
|
|
660
|
-
}
|
|
661
|
-
materializeFilters(style, t, engineVars, nextUid) {
|
|
662
|
-
const definitions = style.filters.definitions;
|
|
663
|
-
if (definitions.isEmpty())
|
|
664
|
-
return { defs: '', bindings: new Map() };
|
|
665
|
-
const context = { currentTime: t, renderHeightPx: this.height };
|
|
666
|
-
const consumerScope = style.filters.scopeProvider.scopeAt(context);
|
|
667
|
-
const scope = consumerScope.with(SvgFilterScope.fromEntries(Object.entries(engineVars)));
|
|
668
|
-
const lengthFactors = style.filters.scopeProvider.lengthFactorsAt(context);
|
|
669
|
-
const { idByLocal, bindings } = this.svgFilterScoper.scopeIds(definitions.ids, `${style.scopeClass}-${nextUid()}`);
|
|
670
|
-
const defs = definitions.filters
|
|
671
|
-
.map((filter) => {
|
|
672
|
-
const body = this.svgFilterLengthResolver.resolve(filter.materialize(scope), lengthFactors);
|
|
673
|
-
return `<filter id="${idByLocal.get(filter.id)}">${body}</filter>`;
|
|
674
|
-
})
|
|
675
|
-
.join('');
|
|
676
|
-
return { defs, bindings };
|
|
677
|
-
}
|
|
678
|
-
wordTiming(style, wordClasses, lineClasses, segClasses) {
|
|
679
|
-
const key = `w:${wordClasses.join(' ')}|l:${lineClasses.join(' ')}|s:${segClasses.join(' ')}`;
|
|
680
|
-
return this.getOrProbeTiming(style, key, () => {
|
|
681
|
-
const seg = document.createElement('div');
|
|
682
|
-
seg.className = segClasses.join(' ');
|
|
683
|
-
const line = document.createElement('div');
|
|
684
|
-
line.className = lineClasses.join(' ');
|
|
685
|
-
const word = document.createElement('span');
|
|
686
|
-
word.className = wordClasses.join(' ');
|
|
687
|
-
this.injectProbeMagic(word);
|
|
688
|
-
line.appendChild(word);
|
|
689
|
-
seg.appendChild(line);
|
|
690
|
-
style.probeContainer.appendChild(seg);
|
|
691
|
-
const timing = this.readAnimTimings(word);
|
|
692
|
-
style.probeContainer.removeChild(seg);
|
|
693
|
-
return timing;
|
|
694
|
-
});
|
|
695
|
-
}
|
|
696
|
-
lineTiming(style, lineClasses, segClasses) {
|
|
697
|
-
const key = `l:${lineClasses.join(' ')}|s:${segClasses.join(' ')}`;
|
|
698
|
-
return this.getOrProbeTiming(style, key, () => {
|
|
699
|
-
const seg = document.createElement('div');
|
|
700
|
-
seg.className = segClasses.join(' ');
|
|
701
|
-
const line = document.createElement('div');
|
|
702
|
-
line.className = lineClasses.join(' ');
|
|
703
|
-
this.injectProbeMagic(line);
|
|
704
|
-
seg.appendChild(line);
|
|
705
|
-
style.probeContainer.appendChild(seg);
|
|
706
|
-
const timing = this.readAnimTimings(line);
|
|
707
|
-
style.probeContainer.removeChild(seg);
|
|
708
|
-
return timing;
|
|
709
|
-
});
|
|
710
|
-
}
|
|
711
|
-
segmentTiming(style, segClasses) {
|
|
712
|
-
const key = `s:${segClasses.join(' ')}`;
|
|
713
|
-
return this.getOrProbeTiming(style, key, () => {
|
|
714
|
-
const seg = document.createElement('div');
|
|
715
|
-
seg.className = segClasses.join(' ');
|
|
716
|
-
this.injectProbeMagic(seg);
|
|
717
|
-
style.probeContainer.appendChild(seg);
|
|
718
|
-
const timing = this.readAnimTimings(seg);
|
|
719
|
-
style.probeContainer.removeChild(seg);
|
|
720
|
-
return timing;
|
|
721
|
-
});
|
|
722
|
-
}
|
|
723
|
-
// Each CssVariable gets a fingerprint-shaped duration value so the
|
|
724
|
-
// computed `animation-delay` on a probed element identifies which
|
|
725
|
-
// variable a rule consumed.
|
|
726
|
-
injectProbeMagic(el) {
|
|
727
|
-
Object.values(CssVariable).forEach((cssVar, index) => {
|
|
728
|
-
el.style.setProperty(cssVar, `${(index + 1) * FINGERPRINT_BASE_S}s`);
|
|
729
|
-
});
|
|
730
|
-
}
|
|
731
|
-
getOrProbeTiming(style, key, probe) {
|
|
732
|
-
let timing = style.probeCache.get(key);
|
|
733
|
-
if (!timing) {
|
|
734
|
-
timing = probe();
|
|
735
|
-
style.probeCache.set(key, timing);
|
|
736
|
-
}
|
|
737
|
-
return timing;
|
|
738
|
-
}
|
|
739
|
-
readAnimTimings(el) {
|
|
740
|
-
const computed = window.getComputedStyle(el);
|
|
741
|
-
const durations = this.parseDurationsS(computed.animationDuration);
|
|
742
|
-
const delays = this.parseDurationsS(computed.animationDelay);
|
|
743
|
-
const iterations = computed.animationIterationCount.split(',').map((s) => s.trim());
|
|
744
|
-
if (durations.every((d) => d === 0))
|
|
745
|
-
return [];
|
|
746
|
-
const anims = [];
|
|
747
|
-
const variables = Object.values(CssVariable);
|
|
748
|
-
for (let i = 0; i < durations.length; i++) {
|
|
749
|
-
const d = durations[i] ?? 0;
|
|
750
|
-
if (d === 0)
|
|
751
|
-
continue;
|
|
752
|
-
const dl = delays[i] ?? 0;
|
|
753
|
-
const fingerprintIndex = (dl / FINGERPRINT_BASE_S) - 1;
|
|
754
|
-
const cssVar = variables[fingerprintIndex];
|
|
755
|
-
if (!cssVar)
|
|
756
|
-
continue;
|
|
757
|
-
const isInfinite = (iterations[i] ?? '1') === 'infinite';
|
|
758
|
-
anims.push({ cssVar, durationS: isInfinite ? Infinity : d + 0.05 });
|
|
759
|
-
}
|
|
760
|
-
return anims;
|
|
761
|
-
}
|
|
762
|
-
parseDurationsS(value) {
|
|
763
|
-
if (!value)
|
|
764
|
-
return [0];
|
|
765
|
-
return value.split(',').map((s) => {
|
|
766
|
-
s = s.trim();
|
|
767
|
-
if (s.endsWith('ms'))
|
|
768
|
-
return parseFloat(s) / 1000;
|
|
769
|
-
if (s.endsWith('s'))
|
|
770
|
-
return parseFloat(s);
|
|
771
|
-
return 0;
|
|
772
|
-
});
|
|
97
|
+
this.width = undefined;
|
|
98
|
+
this.height = undefined;
|
|
773
99
|
}
|
|
774
100
|
}
|
|
775
101
|
//# sourceMappingURL=BrowserSubtitleFrameRenderer.js.map
|