@tscaps/engine 0.1.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/LICENSE +21 -0
- package/README.md +349 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/modules/css/BrowserCssResourceEmbedder.d.ts +5 -0
- package/dist/modules/css/BrowserCssResourceEmbedder.d.ts.map +1 -0
- package/dist/modules/css/BrowserCssResourceEmbedder.js +41 -0
- package/dist/modules/css/BrowserCssResourceEmbedder.js.map +1 -0
- package/dist/modules/css/CssMinifier.d.ts +12 -0
- package/dist/modules/css/CssMinifier.d.ts.map +1 -0
- package/dist/modules/css/CssMinifier.js +47 -0
- package/dist/modules/css/CssMinifier.js.map +1 -0
- package/dist/modules/css/CssResourceEmbedder.d.ts +4 -0
- package/dist/modules/css/CssResourceEmbedder.d.ts.map +1 -0
- package/dist/modules/css/CssResourceEmbedder.js +2 -0
- package/dist/modules/css/CssResourceEmbedder.js.map +1 -0
- package/dist/modules/css/CssScoper.d.ts +16 -0
- package/dist/modules/css/CssScoper.d.ts.map +1 -0
- package/dist/modules/css/CssScoper.js +109 -0
- package/dist/modules/css/CssScoper.js.map +1 -0
- package/dist/modules/css/NoopCssResourceEmbedder.d.ts +12 -0
- package/dist/modules/css/NoopCssResourceEmbedder.d.ts.map +1 -0
- package/dist/modules/css/NoopCssResourceEmbedder.js +13 -0
- package/dist/modules/css/NoopCssResourceEmbedder.js.map +1 -0
- package/dist/modules/css/index.d.ts +6 -0
- package/dist/modules/css/index.d.ts.map +1 -0
- package/dist/modules/css/index.js +5 -0
- package/dist/modules/css/index.js.map +1 -0
- package/dist/modules/document/CssVariable.d.ts +46 -0
- package/dist/modules/document/CssVariable.d.ts.map +1 -0
- package/dist/modules/document/CssVariable.js +47 -0
- package/dist/modules/document/CssVariable.js.map +1 -0
- package/dist/modules/document/Document.d.ts +43 -0
- package/dist/modules/document/Document.d.ts.map +1 -0
- package/dist/modules/document/Document.js +86 -0
- package/dist/modules/document/Document.js.map +1 -0
- package/dist/modules/document/DocumentEditor.d.ts +111 -0
- package/dist/modules/document/DocumentEditor.d.ts.map +1 -0
- package/dist/modules/document/DocumentEditor.js +555 -0
- package/dist/modules/document/DocumentEditor.js.map +1 -0
- package/dist/modules/document/Letter.d.ts +17 -0
- package/dist/modules/document/Letter.d.ts.map +1 -0
- package/dist/modules/document/Letter.js +17 -0
- package/dist/modules/document/Letter.js.map +1 -0
- package/dist/modules/document/Line.d.ts +31 -0
- package/dist/modules/document/Line.d.ts.map +1 -0
- package/dist/modules/document/Line.js +94 -0
- package/dist/modules/document/Line.js.map +1 -0
- package/dist/modules/document/LineState.d.ts +6 -0
- package/dist/modules/document/LineState.d.ts.map +1 -0
- package/dist/modules/document/LineState.js +7 -0
- package/dist/modules/document/LineState.js.map +1 -0
- package/dist/modules/document/NarrationPace.d.ts +20 -0
- package/dist/modules/document/NarrationPace.d.ts.map +1 -0
- package/dist/modules/document/NarrationPace.js +60 -0
- package/dist/modules/document/NarrationPace.js.map +1 -0
- package/dist/modules/document/Section.d.ts +45 -0
- package/dist/modules/document/Section.d.ts.map +1 -0
- package/dist/modules/document/Section.js +94 -0
- package/dist/modules/document/Section.js.map +1 -0
- package/dist/modules/document/Segment.d.ts +40 -0
- package/dist/modules/document/Segment.d.ts.map +1 -0
- package/dist/modules/document/Segment.js +85 -0
- package/dist/modules/document/Segment.js.map +1 -0
- package/dist/modules/document/Tag.d.ts +24 -0
- package/dist/modules/document/Tag.d.ts.map +1 -0
- package/dist/modules/document/Tag.js +37 -0
- package/dist/modules/document/Tag.js.map +1 -0
- package/dist/modules/document/TimeFragment.d.ts +11 -0
- package/dist/modules/document/TimeFragment.d.ts.map +1 -0
- package/dist/modules/document/TimeFragment.js +29 -0
- package/dist/modules/document/TimeFragment.js.map +1 -0
- package/dist/modules/document/Word.d.ts +40 -0
- package/dist/modules/document/Word.d.ts.map +1 -0
- package/dist/modules/document/Word.js +114 -0
- package/dist/modules/document/Word.js.map +1 -0
- package/dist/modules/document/WordState.d.ts +6 -0
- package/dist/modules/document/WordState.d.ts.map +1 -0
- package/dist/modules/document/WordState.js +7 -0
- package/dist/modules/document/WordState.js.map +1 -0
- package/dist/modules/document/index.d.ts +14 -0
- package/dist/modules/document/index.d.ts.map +1 -0
- package/dist/modules/document/index.js +14 -0
- package/dist/modules/document/index.js.map +1 -0
- package/dist/modules/effect/CarryQuotesEffect.d.ts +47 -0
- package/dist/modules/effect/CarryQuotesEffect.d.ts.map +1 -0
- package/dist/modules/effect/CarryQuotesEffect.js +181 -0
- package/dist/modules/effect/CarryQuotesEffect.js.map +1 -0
- package/dist/modules/effect/Effect.d.ts +16 -0
- package/dist/modules/effect/Effect.d.ts.map +1 -0
- package/dist/modules/effect/Effect.js +2 -0
- package/dist/modules/effect/Effect.js.map +1 -0
- package/dist/modules/effect/GapFreeEffect.d.ts +24 -0
- package/dist/modules/effect/GapFreeEffect.d.ts.map +1 -0
- package/dist/modules/effect/GapFreeEffect.js +67 -0
- package/dist/modules/effect/GapFreeEffect.js.map +1 -0
- package/dist/modules/effect/RemovePunctuationEffect.d.ts +21 -0
- package/dist/modules/effect/RemovePunctuationEffect.d.ts.map +1 -0
- package/dist/modules/effect/RemovePunctuationEffect.js +52 -0
- package/dist/modules/effect/RemovePunctuationEffect.js.map +1 -0
- package/dist/modules/effect/SmartLowercaseEffect.d.ts +21 -0
- package/dist/modules/effect/SmartLowercaseEffect.d.ts.map +1 -0
- package/dist/modules/effect/SmartLowercaseEffect.js +45 -0
- package/dist/modules/effect/SmartLowercaseEffect.js.map +1 -0
- package/dist/modules/effect/SmartPunctuationEffect.d.ts +25 -0
- package/dist/modules/effect/SmartPunctuationEffect.d.ts.map +1 -0
- package/dist/modules/effect/SmartPunctuationEffect.js +68 -0
- package/dist/modules/effect/SmartPunctuationEffect.js.map +1 -0
- package/dist/modules/effect/index.d.ts +7 -0
- package/dist/modules/effect/index.d.ts.map +1 -0
- package/dist/modules/effect/index.js +6 -0
- package/dist/modules/effect/index.js.map +1 -0
- package/dist/modules/pipeline/PipelineProgress.d.ts +30 -0
- package/dist/modules/pipeline/PipelineProgress.d.ts.map +1 -0
- package/dist/modules/pipeline/PipelineProgress.js +2 -0
- package/dist/modules/pipeline/PipelineProgress.js.map +1 -0
- package/dist/modules/pipeline/RenderPipeline.d.ts +105 -0
- package/dist/modules/pipeline/RenderPipeline.d.ts.map +1 -0
- package/dist/modules/pipeline/RenderPipeline.js +232 -0
- package/dist/modules/pipeline/RenderPipeline.js.map +1 -0
- package/dist/modules/pipeline/RenderPipelineBuilder.d.ts +143 -0
- package/dist/modules/pipeline/RenderPipelineBuilder.d.ts.map +1 -0
- package/dist/modules/pipeline/RenderPipelineBuilder.js +317 -0
- package/dist/modules/pipeline/RenderPipelineBuilder.js.map +1 -0
- package/dist/modules/pipeline/index.d.ts +6 -0
- package/dist/modules/pipeline/index.d.ts.map +1 -0
- package/dist/modules/pipeline/index.js +3 -0
- package/dist/modules/pipeline/index.js.map +1 -0
- package/dist/modules/profiling/Profiler.d.ts +115 -0
- package/dist/modules/profiling/Profiler.d.ts.map +1 -0
- package/dist/modules/profiling/Profiler.js +316 -0
- package/dist/modules/profiling/Profiler.js.map +1 -0
- package/dist/modules/profiling/index.d.ts +2 -0
- package/dist/modules/profiling/index.d.ts.map +1 -0
- package/dist/modules/profiling/index.js +2 -0
- package/dist/modules/profiling/index.js.map +1 -0
- package/dist/modules/rendering/AlignmentConfig.d.ts +21 -0
- package/dist/modules/rendering/AlignmentConfig.d.ts.map +1 -0
- package/dist/modules/rendering/AlignmentConfig.js +2 -0
- package/dist/modules/rendering/AlignmentConfig.js.map +1 -0
- package/dist/modules/rendering/BoxEdges.d.ts +8 -0
- package/dist/modules/rendering/BoxEdges.d.ts.map +1 -0
- package/dist/modules/rendering/BoxEdges.js +2 -0
- package/dist/modules/rendering/BoxEdges.js.map +1 -0
- package/dist/modules/rendering/BrowserOverlayFrameRenderer.d.ts +12 -0
- package/dist/modules/rendering/BrowserOverlayFrameRenderer.d.ts.map +1 -0
- package/dist/modules/rendering/BrowserOverlayFrameRenderer.js +31 -0
- package/dist/modules/rendering/BrowserOverlayFrameRenderer.js.map +1 -0
- package/dist/modules/rendering/BrowserSubtitleFrameRenderer.d.ts +57 -0
- package/dist/modules/rendering/BrowserSubtitleFrameRenderer.d.ts.map +1 -0
- package/dist/modules/rendering/BrowserSubtitleFrameRenderer.js +775 -0
- package/dist/modules/rendering/BrowserSubtitleFrameRenderer.js.map +1 -0
- package/dist/modules/rendering/ElementRenderOverrides.d.ts +15 -0
- package/dist/modules/rendering/ElementRenderOverrides.d.ts.map +1 -0
- package/dist/modules/rendering/ElementRenderOverrides.js +24 -0
- package/dist/modules/rendering/ElementRenderOverrides.js.map +1 -0
- package/dist/modules/rendering/InlineStyleMap.d.ts +9 -0
- package/dist/modules/rendering/InlineStyleMap.d.ts.map +1 -0
- package/dist/modules/rendering/InlineStyleMap.js +2 -0
- package/dist/modules/rendering/InlineStyleMap.js.map +1 -0
- package/dist/modules/rendering/LayeredSubtitleFrame.d.ts +20 -0
- package/dist/modules/rendering/LayeredSubtitleFrame.d.ts.map +1 -0
- package/dist/modules/rendering/LayeredSubtitleFrame.js +36 -0
- package/dist/modules/rendering/LayeredSubtitleFrame.js.map +1 -0
- package/dist/modules/rendering/OverlayFrameRenderer.d.ts +27 -0
- package/dist/modules/rendering/OverlayFrameRenderer.d.ts.map +1 -0
- package/dist/modules/rendering/OverlayFrameRenderer.js +2 -0
- package/dist/modules/rendering/OverlayFrameRenderer.js.map +1 -0
- package/dist/modules/rendering/RenderingConfig.d.ts +22 -0
- package/dist/modules/rendering/RenderingConfig.d.ts.map +1 -0
- package/dist/modules/rendering/RenderingConfig.js +2 -0
- package/dist/modules/rendering/RenderingConfig.js.map +1 -0
- package/dist/modules/rendering/ScopedRenderOverride.d.ts +19 -0
- package/dist/modules/rendering/ScopedRenderOverride.d.ts.map +1 -0
- package/dist/modules/rendering/ScopedRenderOverride.js +2 -0
- package/dist/modules/rendering/ScopedRenderOverride.js.map +1 -0
- package/dist/modules/rendering/SegmentPaintRegionResolver.d.ts +41 -0
- package/dist/modules/rendering/SegmentPaintRegionResolver.d.ts.map +1 -0
- package/dist/modules/rendering/SegmentPaintRegionResolver.js +47 -0
- package/dist/modules/rendering/SegmentPaintRegionResolver.js.map +1 -0
- package/dist/modules/rendering/SegmentSubtreeHtmlBuilder.d.ts +58 -0
- package/dist/modules/rendering/SegmentSubtreeHtmlBuilder.d.ts.map +1 -0
- package/dist/modules/rendering/SegmentSubtreeHtmlBuilder.js +132 -0
- package/dist/modules/rendering/SegmentSubtreeHtmlBuilder.js.map +1 -0
- package/dist/modules/rendering/SubtitleFrameRenderer.d.ts +111 -0
- package/dist/modules/rendering/SubtitleFrameRenderer.d.ts.map +1 -0
- package/dist/modules/rendering/SubtitleFrameRenderer.js +2 -0
- package/dist/modules/rendering/SubtitleFrameRenderer.js.map +1 -0
- package/dist/modules/rendering/VideoFrameLayerClass.d.ts +21 -0
- package/dist/modules/rendering/VideoFrameLayerClass.d.ts.map +1 -0
- package/dist/modules/rendering/VideoFrameLayerClass.js +21 -0
- package/dist/modules/rendering/VideoFrameLayerClass.js.map +1 -0
- package/dist/modules/rendering/VideoFrameSource.d.ts +29 -0
- package/dist/modules/rendering/VideoFrameSource.d.ts.map +1 -0
- package/dist/modules/rendering/VideoFrameSource.js +2 -0
- package/dist/modules/rendering/VideoFrameSource.js.map +1 -0
- package/dist/modules/rendering/index.d.ts +14 -0
- package/dist/modules/rendering/index.d.ts.map +1 -0
- package/dist/modules/rendering/index.js +6 -0
- package/dist/modules/rendering/index.js.map +1 -0
- package/dist/modules/splitting/BalancedLineSplitter.d.ts +24 -0
- package/dist/modules/splitting/BalancedLineSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/BalancedLineSplitter.js +81 -0
- package/dist/modules/splitting/BalancedLineSplitter.js.map +1 -0
- package/dist/modules/splitting/BalancedPixelWidthLineSplitter.d.ts +31 -0
- package/dist/modules/splitting/BalancedPixelWidthLineSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/BalancedPixelWidthLineSplitter.js +99 -0
- package/dist/modules/splitting/BalancedPixelWidthLineSplitter.js.map +1 -0
- package/dist/modules/splitting/BoundarySegmentSplitter.d.ts +19 -0
- package/dist/modules/splitting/BoundarySegmentSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/BoundarySegmentSplitter.js +38 -0
- package/dist/modules/splitting/BoundarySegmentSplitter.js.map +1 -0
- package/dist/modules/splitting/CompositeSegmentSplitter.d.ts +8 -0
- package/dist/modules/splitting/CompositeSegmentSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/CompositeSegmentSplitter.js +12 -0
- package/dist/modules/splitting/CompositeSegmentSplitter.js.map +1 -0
- package/dist/modules/splitting/DomProbeCanvasTextMeasurer.d.ts +56 -0
- package/dist/modules/splitting/DomProbeCanvasTextMeasurer.d.ts.map +1 -0
- package/dist/modules/splitting/DomProbeCanvasTextMeasurer.js +197 -0
- package/dist/modules/splitting/DomProbeCanvasTextMeasurer.js.map +1 -0
- package/dist/modules/splitting/GraphemeWordSplitter.d.ts +11 -0
- package/dist/modules/splitting/GraphemeWordSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/GraphemeWordSplitter.js +12 -0
- package/dist/modules/splitting/GraphemeWordSplitter.js.map +1 -0
- package/dist/modules/splitting/LimitByCharsSegmentSplitter.d.ts +15 -0
- package/dist/modules/splitting/LimitByCharsSegmentSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/LimitByCharsSegmentSplitter.js +64 -0
- package/dist/modules/splitting/LimitByCharsSegmentSplitter.js.map +1 -0
- package/dist/modules/splitting/LimitByScaledCharsSegmentSplitter.d.ts +30 -0
- package/dist/modules/splitting/LimitByScaledCharsSegmentSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/LimitByScaledCharsSegmentSplitter.js +66 -0
- package/dist/modules/splitting/LimitByScaledCharsSegmentSplitter.js.map +1 -0
- package/dist/modules/splitting/LimitByWordsSegmentSplitter.d.ts +12 -0
- package/dist/modules/splitting/LimitByWordsSegmentSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/LimitByWordsSegmentSplitter.js +25 -0
- package/dist/modules/splitting/LimitByWordsSegmentSplitter.js.map +1 -0
- package/dist/modules/splitting/LineSplitter.d.ts +10 -0
- package/dist/modules/splitting/LineSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/LineSplitter.js +2 -0
- package/dist/modules/splitting/LineSplitter.js.map +1 -0
- package/dist/modules/splitting/PauseBasedSegmentSplitter.d.ts +24 -0
- package/dist/modules/splitting/PauseBasedSegmentSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/PauseBasedSegmentSplitter.js +43 -0
- package/dist/modules/splitting/PauseBasedSegmentSplitter.js.map +1 -0
- package/dist/modules/splitting/SegmentSplitter.d.ts +10 -0
- package/dist/modules/splitting/SegmentSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/SegmentSplitter.js +2 -0
- package/dist/modules/splitting/SegmentSplitter.js.map +1 -0
- package/dist/modules/splitting/SpeakerChangeSegmentSplitter.d.ts +17 -0
- package/dist/modules/splitting/SpeakerChangeSegmentSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/SpeakerChangeSegmentSplitter.js +46 -0
- package/dist/modules/splitting/SpeakerChangeSegmentSplitter.js.map +1 -0
- package/dist/modules/splitting/TextMeasurer.d.ts +15 -0
- package/dist/modules/splitting/TextMeasurer.d.ts.map +1 -0
- package/dist/modules/splitting/TextMeasurer.js +2 -0
- package/dist/modules/splitting/TextMeasurer.js.map +1 -0
- package/dist/modules/splitting/WordSplitter.d.ts +8 -0
- package/dist/modules/splitting/WordSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/WordSplitter.js +2 -0
- package/dist/modules/splitting/WordSplitter.js.map +1 -0
- package/dist/modules/splitting/index.d.ts +24 -0
- package/dist/modules/splitting/index.d.ts.map +1 -0
- package/dist/modules/splitting/index.js +12 -0
- package/dist/modules/splitting/index.js.map +1 -0
- package/dist/modules/svg-filter/SvgFilter.d.ts +16 -0
- package/dist/modules/svg-filter/SvgFilter.d.ts.map +1 -0
- package/dist/modules/svg-filter/SvgFilter.js +28 -0
- package/dist/modules/svg-filter/SvgFilter.js.map +1 -0
- package/dist/modules/svg-filter/SvgFilterBundle.d.ts +16 -0
- package/dist/modules/svg-filter/SvgFilterBundle.d.ts.map +1 -0
- package/dist/modules/svg-filter/SvgFilterBundle.js +20 -0
- package/dist/modules/svg-filter/SvgFilterBundle.js.map +1 -0
- package/dist/modules/svg-filter/SvgFilterDefinitions.d.ts +16 -0
- package/dist/modules/svg-filter/SvgFilterDefinitions.d.ts.map +1 -0
- package/dist/modules/svg-filter/SvgFilterDefinitions.js +25 -0
- package/dist/modules/svg-filter/SvgFilterDefinitions.js.map +1 -0
- package/dist/modules/svg-filter/SvgFilterDefinitionsParser.d.ts +21 -0
- package/dist/modules/svg-filter/SvgFilterDefinitionsParser.d.ts.map +1 -0
- package/dist/modules/svg-filter/SvgFilterDefinitionsParser.js +50 -0
- package/dist/modules/svg-filter/SvgFilterDefinitionsParser.js.map +1 -0
- package/dist/modules/svg-filter/SvgFilterLengthResolver.d.ts +17 -0
- package/dist/modules/svg-filter/SvgFilterLengthResolver.d.ts.map +1 -0
- package/dist/modules/svg-filter/SvgFilterLengthResolver.js +27 -0
- package/dist/modules/svg-filter/SvgFilterLengthResolver.js.map +1 -0
- package/dist/modules/svg-filter/SvgFilterScope.d.ts +18 -0
- package/dist/modules/svg-filter/SvgFilterScope.d.ts.map +1 -0
- package/dist/modules/svg-filter/SvgFilterScope.js +28 -0
- package/dist/modules/svg-filter/SvgFilterScope.js.map +1 -0
- package/dist/modules/svg-filter/SvgFilterScopeProvider.d.ts +52 -0
- package/dist/modules/svg-filter/SvgFilterScopeProvider.d.ts.map +1 -0
- package/dist/modules/svg-filter/SvgFilterScopeProvider.js +2 -0
- package/dist/modules/svg-filter/SvgFilterScopeProvider.js.map +1 -0
- package/dist/modules/svg-filter/SvgFilterScoper.d.ts +60 -0
- package/dist/modules/svg-filter/SvgFilterScoper.d.ts.map +1 -0
- package/dist/modules/svg-filter/SvgFilterScoper.js +58 -0
- package/dist/modules/svg-filter/SvgFilterScoper.js.map +1 -0
- package/dist/modules/svg-filter/index.d.ts +10 -0
- package/dist/modules/svg-filter/index.d.ts.map +1 -0
- package/dist/modules/svg-filter/index.js +8 -0
- package/dist/modules/svg-filter/index.js.map +1 -0
- package/dist/modules/tagging/RegexTagger.d.ts +11 -0
- package/dist/modules/tagging/RegexTagger.d.ts.map +1 -0
- package/dist/modules/tagging/RegexTagger.js +32 -0
- package/dist/modules/tagging/RegexTagger.js.map +1 -0
- package/dist/modules/tagging/SpanTagger.d.ts +25 -0
- package/dist/modules/tagging/SpanTagger.d.ts.map +1 -0
- package/dist/modules/tagging/SpanTagger.js +73 -0
- package/dist/modules/tagging/SpanTagger.js.map +1 -0
- package/dist/modules/tagging/StructureTagger.d.ts +20 -0
- package/dist/modules/tagging/StructureTagger.d.ts.map +1 -0
- package/dist/modules/tagging/StructureTagger.js +74 -0
- package/dist/modules/tagging/StructureTagger.js.map +1 -0
- package/dist/modules/tagging/Tagger.d.ts +5 -0
- package/dist/modules/tagging/Tagger.d.ts.map +1 -0
- package/dist/modules/tagging/Tagger.js +5 -0
- package/dist/modules/tagging/Tagger.js.map +1 -0
- package/dist/modules/tagging/WordlistTagger.d.ts +11 -0
- package/dist/modules/tagging/WordlistTagger.d.ts.map +1 -0
- package/dist/modules/tagging/WordlistTagger.js +31 -0
- package/dist/modules/tagging/WordlistTagger.js.map +1 -0
- package/dist/modules/tagging/index.d.ts +6 -0
- package/dist/modules/tagging/index.d.ts.map +1 -0
- package/dist/modules/tagging/index.js +6 -0
- package/dist/modules/tagging/index.js.map +1 -0
- package/dist/modules/transcription/AudioDecoder.d.ts +11 -0
- package/dist/modules/transcription/AudioDecoder.d.ts.map +1 -0
- package/dist/modules/transcription/AudioDecoder.js +2 -0
- package/dist/modules/transcription/AudioDecoder.js.map +1 -0
- package/dist/modules/transcription/BrowserAudioDecoder.d.ts +13 -0
- package/dist/modules/transcription/BrowserAudioDecoder.d.ts.map +1 -0
- package/dist/modules/transcription/BrowserAudioDecoder.js +34 -0
- package/dist/modules/transcription/BrowserAudioDecoder.js.map +1 -0
- package/dist/modules/transcription/PassthroughTranscriber.d.ts +20 -0
- package/dist/modules/transcription/PassthroughTranscriber.d.ts.map +1 -0
- package/dist/modules/transcription/PassthroughTranscriber.js +23 -0
- package/dist/modules/transcription/PassthroughTranscriber.js.map +1 -0
- package/dist/modules/transcription/PreDecodedAudioDecoder.d.ts +12 -0
- package/dist/modules/transcription/PreDecodedAudioDecoder.d.ts.map +1 -0
- package/dist/modules/transcription/PreDecodedAudioDecoder.js +14 -0
- package/dist/modules/transcription/PreDecodedAudioDecoder.js.map +1 -0
- package/dist/modules/transcription/SrtTranscriber.d.ts +33 -0
- package/dist/modules/transcription/SrtTranscriber.d.ts.map +1 -0
- package/dist/modules/transcription/SrtTranscriber.js +111 -0
- package/dist/modules/transcription/SrtTranscriber.js.map +1 -0
- package/dist/modules/transcription/Transcriber.d.ts +23 -0
- package/dist/modules/transcription/Transcriber.d.ts.map +1 -0
- package/dist/modules/transcription/Transcriber.js +2 -0
- package/dist/modules/transcription/Transcriber.js.map +1 -0
- package/dist/modules/transcription/WhisperTranscriber.d.ts +44 -0
- package/dist/modules/transcription/WhisperTranscriber.d.ts.map +1 -0
- package/dist/modules/transcription/WhisperTranscriber.js +162 -0
- package/dist/modules/transcription/WhisperTranscriber.js.map +1 -0
- package/dist/modules/transcription/index.d.ts +8 -0
- package/dist/modules/transcription/index.d.ts.map +1 -0
- package/dist/modules/transcription/index.js +6 -0
- package/dist/modules/transcription/index.js.map +1 -0
- package/dist/modules/video/RenderJob.d.ts +95 -0
- package/dist/modules/video/RenderJob.d.ts.map +1 -0
- package/dist/modules/video/RenderJob.js +2 -0
- package/dist/modules/video/RenderJob.js.map +1 -0
- package/dist/modules/video/VideoRenderer.d.ts +5 -0
- package/dist/modules/video/VideoRenderer.d.ts.map +1 -0
- package/dist/modules/video/VideoRenderer.js +2 -0
- package/dist/modules/video/VideoRenderer.js.map +1 -0
- package/dist/modules/video/index.d.ts +33 -0
- package/dist/modules/video/index.d.ts.map +1 -0
- package/dist/modules/video/index.js +17 -0
- package/dist/modules/video/index.js.map +1 -0
- package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.d.ts +69 -0
- package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.js +206 -0
- package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.js.map +1 -0
- package/dist/modules/video/mediabunny/audio/AudioTrackBridge.d.ts +24 -0
- package/dist/modules/video/mediabunny/audio/AudioTrackBridge.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/audio/AudioTrackBridge.js +2 -0
- package/dist/modules/video/mediabunny/audio/AudioTrackBridge.js.map +1 -0
- package/dist/modules/video/mediabunny/audio/AudioTrackBridgeFactory.d.ts +20 -0
- package/dist/modules/video/mediabunny/audio/AudioTrackBridgeFactory.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/audio/AudioTrackBridgeFactory.js +2 -0
- package/dist/modules/video/mediabunny/audio/AudioTrackBridgeFactory.js.map +1 -0
- package/dist/modules/video/mediabunny/audio/DefaultAudioTrackBridgeFactory.d.ts +11 -0
- package/dist/modules/video/mediabunny/audio/DefaultAudioTrackBridgeFactory.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/audio/DefaultAudioTrackBridgeFactory.js +32 -0
- package/dist/modules/video/mediabunny/audio/DefaultAudioTrackBridgeFactory.js.map +1 -0
- package/dist/modules/video/mediabunny/audio/DiscardAudioTrackBridge.d.ts +12 -0
- package/dist/modules/video/mediabunny/audio/DiscardAudioTrackBridge.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/audio/DiscardAudioTrackBridge.js +14 -0
- package/dist/modules/video/mediabunny/audio/DiscardAudioTrackBridge.js.map +1 -0
- package/dist/modules/video/mediabunny/audio/PassthroughAudioTrackBridge.d.ts +28 -0
- package/dist/modules/video/mediabunny/audio/PassthroughAudioTrackBridge.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/audio/PassthroughAudioTrackBridge.js +52 -0
- package/dist/modules/video/mediabunny/audio/PassthroughAudioTrackBridge.js.map +1 -0
- package/dist/modules/video/mediabunny/audio/TranscodeAudioTrackBridge.d.ts +25 -0
- package/dist/modules/video/mediabunny/audio/TranscodeAudioTrackBridge.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/audio/TranscodeAudioTrackBridge.js +52 -0
- package/dist/modules/video/mediabunny/audio/TranscodeAudioTrackBridge.js.map +1 -0
- package/dist/modules/video/mediabunny/caption/BatchedSubtitleLayerSource.d.ts +32 -0
- package/dist/modules/video/mediabunny/caption/BatchedSubtitleLayerSource.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/caption/BatchedSubtitleLayerSource.js +60 -0
- package/dist/modules/video/mediabunny/caption/BatchedSubtitleLayerSource.js.map +1 -0
- package/dist/modules/video/mediabunny/caption/ComposedSubtitleLayerSource.d.ts +27 -0
- package/dist/modules/video/mediabunny/caption/ComposedSubtitleLayerSource.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/caption/ComposedSubtitleLayerSource.js +72 -0
- package/dist/modules/video/mediabunny/caption/ComposedSubtitleLayerSource.js.map +1 -0
- package/dist/modules/video/mediabunny/caption/SubtitleLayerSource.d.ts +32 -0
- package/dist/modules/video/mediabunny/caption/SubtitleLayerSource.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/caption/SubtitleLayerSource.js +2 -0
- package/dist/modules/video/mediabunny/caption/SubtitleLayerSource.js.map +1 -0
- package/dist/modules/video/mediabunny/caption/VideoBoundSubtitleLayerSource.d.ts +25 -0
- package/dist/modules/video/mediabunny/caption/VideoBoundSubtitleLayerSource.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/caption/VideoBoundSubtitleLayerSource.js +37 -0
- package/dist/modules/video/mediabunny/caption/VideoBoundSubtitleLayerSource.js.map +1 -0
- package/dist/modules/video/mediabunny/codec/CodecPolicy.d.ts +32 -0
- package/dist/modules/video/mediabunny/codec/CodecPolicy.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/codec/CodecPolicy.js +2 -0
- package/dist/modules/video/mediabunny/codec/CodecPolicy.js.map +1 -0
- package/dist/modules/video/mediabunny/codec/DefaultCodecPolicy.d.ts +59 -0
- package/dist/modules/video/mediabunny/codec/DefaultCodecPolicy.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/codec/DefaultCodecPolicy.js +110 -0
- package/dist/modules/video/mediabunny/codec/DefaultCodecPolicy.js.map +1 -0
- package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoder.d.ts +27 -0
- package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoder.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoder.js +44 -0
- package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoder.js.map +1 -0
- package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoderFactory.d.ts +10 -0
- package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoderFactory.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoderFactory.js +15 -0
- package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoderFactory.js.map +1 -0
- package/dist/modules/video/mediabunny/encoder/VideoTrackEncoder.d.ts +29 -0
- package/dist/modules/video/mediabunny/encoder/VideoTrackEncoder.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/encoder/VideoTrackEncoder.js +2 -0
- package/dist/modules/video/mediabunny/encoder/VideoTrackEncoder.js.map +1 -0
- package/dist/modules/video/mediabunny/encoder/VideoTrackEncoderFactory.d.ts +16 -0
- package/dist/modules/video/mediabunny/encoder/VideoTrackEncoderFactory.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/encoder/VideoTrackEncoderFactory.js +2 -0
- package/dist/modules/video/mediabunny/encoder/VideoTrackEncoderFactory.js.map +1 -0
- package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.d.ts +25 -0
- package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.js +74 -0
- package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.js.map +1 -0
- package/dist/modules/video/mediabunny/frame/CustomWebCodecsVideoFrameDecoder.d.ts +26 -0
- package/dist/modules/video/mediabunny/frame/CustomWebCodecsVideoFrameDecoder.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/frame/CustomWebCodecsVideoFrameDecoder.js +147 -0
- package/dist/modules/video/mediabunny/frame/CustomWebCodecsVideoFrameDecoder.js.map +1 -0
- package/dist/modules/video/mediabunny/frame/DefaultVideoFrameDecoderFactory.d.ts +12 -0
- package/dist/modules/video/mediabunny/frame/DefaultVideoFrameDecoderFactory.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/frame/DefaultVideoFrameDecoderFactory.js +25 -0
- package/dist/modules/video/mediabunny/frame/DefaultVideoFrameDecoderFactory.js.map +1 -0
- package/dist/modules/video/mediabunny/frame/FrameCompositor.d.ts +30 -0
- package/dist/modules/video/mediabunny/frame/FrameCompositor.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/frame/FrameCompositor.js +2 -0
- package/dist/modules/video/mediabunny/frame/FrameCompositor.js.map +1 -0
- package/dist/modules/video/mediabunny/frame/HtmlVideoElementVideoFrameDecoder.d.ts +44 -0
- package/dist/modules/video/mediabunny/frame/HtmlVideoElementVideoFrameDecoder.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/frame/HtmlVideoElementVideoFrameDecoder.js +334 -0
- package/dist/modules/video/mediabunny/frame/HtmlVideoElementVideoFrameDecoder.js.map +1 -0
- package/dist/modules/video/mediabunny/frame/LayeredFrameCompositor.d.ts +10 -0
- package/dist/modules/video/mediabunny/frame/LayeredFrameCompositor.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/frame/LayeredFrameCompositor.js +17 -0
- package/dist/modules/video/mediabunny/frame/LayeredFrameCompositor.js.map +1 -0
- package/dist/modules/video/mediabunny/frame/VideoFrameDecoder.d.ts +30 -0
- package/dist/modules/video/mediabunny/frame/VideoFrameDecoder.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/frame/VideoFrameDecoder.js +2 -0
- package/dist/modules/video/mediabunny/frame/VideoFrameDecoder.js.map +1 -0
- package/dist/modules/video/mediabunny/frame/VideoFrameDecoderFactory.d.ts +22 -0
- package/dist/modules/video/mediabunny/frame/VideoFrameDecoderFactory.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/frame/VideoFrameDecoderFactory.js +2 -0
- package/dist/modules/video/mediabunny/frame/VideoFrameDecoderFactory.js.map +1 -0
- package/dist/modules/video/mediabunny/frame/WebCodecsVideoFrameDecoder.d.ts +17 -0
- package/dist/modules/video/mediabunny/frame/WebCodecsVideoFrameDecoder.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/frame/WebCodecsVideoFrameDecoder.js +48 -0
- package/dist/modules/video/mediabunny/frame/WebCodecsVideoFrameDecoder.js.map +1 -0
- package/dist/modules/video/mediabunny/output/MediaBunnyOutputTargetBuilder.d.ts +11 -0
- package/dist/modules/video/mediabunny/output/MediaBunnyOutputTargetBuilder.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/output/MediaBunnyOutputTargetBuilder.js +22 -0
- package/dist/modules/video/mediabunny/output/MediaBunnyOutputTargetBuilder.js.map +1 -0
- package/dist/modules/video/mediabunny/output/OutputTargetBuilder.d.ts +27 -0
- package/dist/modules/video/mediabunny/output/OutputTargetBuilder.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/output/OutputTargetBuilder.js +2 -0
- package/dist/modules/video/mediabunny/output/OutputTargetBuilder.js.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { SvgFilterScope } from '../svg-filter/SvgFilterScope';
|
|
2
|
+
/**
|
|
3
|
+
* Frame-level context the renderer passes when resolving the
|
|
4
|
+
* variable scope a filter materializes against. Carries the timestamp
|
|
5
|
+
* being rendered and the height of the render target in user-space
|
|
6
|
+
* px; the renderer adds its own render-time variables (video frame,
|
|
7
|
+
* dimensions) on top of the returned scope before passing it to
|
|
8
|
+
* `SvgFilter.materialize`.
|
|
9
|
+
*
|
|
10
|
+
* `renderHeightPx` is the height of the render target in px. The same
|
|
11
|
+
* content is rendered into targets of different heights, so
|
|
12
|
+
* font/viewport-relative filter lengths must be resolved against it
|
|
13
|
+
* per render — see `SvgFilterLengthResolver`.
|
|
14
|
+
*/
|
|
15
|
+
export interface SvgFilterRenderContext {
|
|
16
|
+
readonly currentTime: number;
|
|
17
|
+
readonly renderHeightPx: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Multipliers that convert font/viewport-relative lengths to
|
|
21
|
+
* user-space px for one render context. `SvgFilterLengthResolver`
|
|
22
|
+
* applies them to `em` / `cqh` tokens in a materialized filter body.
|
|
23
|
+
*/
|
|
24
|
+
export interface SvgFilterLengthFactors {
|
|
25
|
+
/** User-space px for one `em` at the resolved font-size. */
|
|
26
|
+
readonly pxPerEm: number;
|
|
27
|
+
/** User-space px for one `cqh` (1% of the render target height). */
|
|
28
|
+
readonly pxPerCqh: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Strategy that resolves the variable scope for one render context.
|
|
32
|
+
* The renderer invokes `scopeAt` once per output tile.
|
|
33
|
+
*
|
|
34
|
+
* Implementations whose scope does not depend on the context return
|
|
35
|
+
* the same scope on every call. Implementations whose scope varies
|
|
36
|
+
* with `currentTime` (typically deriving integer ticks from it)
|
|
37
|
+
* return a scope whose entries change per call.
|
|
38
|
+
*
|
|
39
|
+
* `lengthFactorsAt` supplies the px-per-`em` / px-per-`cqh`
|
|
40
|
+
* multipliers for the same context. SVG filter primitive attributes
|
|
41
|
+
* (`radius`, `stdDeviation`, `dx`, …) accept neither relative units
|
|
42
|
+
* nor `calc()`, so a filter that must track text size is authored in
|
|
43
|
+
* `em`/`cqh` and resolved to px at render time. The px-per-`em`
|
|
44
|
+
* factor depends on the consumer's font-size, which the engine does
|
|
45
|
+
* not know — hence it comes from the provider, while the engine
|
|
46
|
+
* supplies only the render height via the context.
|
|
47
|
+
*/
|
|
48
|
+
export interface SvgFilterScopeProvider {
|
|
49
|
+
scopeAt(context: SvgFilterRenderContext): SvgFilterScope;
|
|
50
|
+
lengthFactorsAt(context: SvgFilterRenderContext): SvgFilterLengthFactors;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=SvgFilterScopeProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SvgFilterScopeProvider.d.ts","sourceRoot":"","sources":["../../../src/modules/svg-filter/SvgFilterScopeProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEzE;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,4DAA4D;IAC5D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,oEAAoE;IACpE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,OAAO,EAAE,sBAAsB,GAAG,cAAc,CAAC;IACzD,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,sBAAsB,CAAC;CAC1E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SvgFilterScopeProvider.js","sourceRoot":"","sources":["../../../src/modules/svg-filter/SvgFilterScopeProvider.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output of `SvgFilterScoper.rewriteCss`. The stylesheet with every
|
|
3
|
+
* `url(#localId)` filter reference replaced by a CSS-variable
|
|
4
|
+
* indirection, plus the set of local ids that were rewritten — the
|
|
5
|
+
* caller must bind each one on an element that contains the
|
|
6
|
+
* filtered descendants.
|
|
7
|
+
*/
|
|
8
|
+
export interface CssRewriteResult {
|
|
9
|
+
readonly css: string;
|
|
10
|
+
readonly localIds: ReadonlySet<string>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Output of `SvgFilterScoper.scopeIds`. `idByLocal` maps each local
|
|
14
|
+
* id to its scoped counterpart (the value to emit inside
|
|
15
|
+
* `<filter id="…">` in the SVG defs block). `bindings` maps each
|
|
16
|
+
* CSS variable name to the `url(#scopedId)` expression to splice
|
|
17
|
+
* into a wrapper element's inline style.
|
|
18
|
+
*/
|
|
19
|
+
export interface IdScopeResult {
|
|
20
|
+
readonly idByLocal: ReadonlyMap<string, string>;
|
|
21
|
+
readonly bindings: ReadonlyMap<string, string>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Generates a unique namespace for a set of `<filter>` ids and pairs
|
|
25
|
+
* those scoped ids with the CSS variables that consuming elements
|
|
26
|
+
* use to reach them. The same scheme rewrites the stylesheet's
|
|
27
|
+
* `url(#id)` references so the binding chain is closed.
|
|
28
|
+
*
|
|
29
|
+
* The indirection is what lets independent filter sets coexist in
|
|
30
|
+
* the same SVG document without id collisions, and what makes
|
|
31
|
+
* per-tile filters compatible with stylesheets that animate
|
|
32
|
+
* `filter:` via `@keyframes`: an inline style cannot override an
|
|
33
|
+
* active animation value, but it CAN supply the variable the
|
|
34
|
+
* animation references, which is resolved per element through
|
|
35
|
+
* ordinary CSS variable inheritance.
|
|
36
|
+
*
|
|
37
|
+
* Only the top-level `<filter>` ids are rewritten. The SVG filter
|
|
38
|
+
* primitive id space (`in`, `result`, `feMergeNode in=...`) is local
|
|
39
|
+
* to each `<filter>` element and is left untouched.
|
|
40
|
+
*/
|
|
41
|
+
export declare class SvgFilterScoper {
|
|
42
|
+
/**
|
|
43
|
+
* Replaces every `url(#localId)` reference in the stylesheet with
|
|
44
|
+
* `var(--svg-filter-<localId>)`. The local ids that were
|
|
45
|
+
* encountered are returned so the caller knows which variables a
|
|
46
|
+
* consuming element must bind. Refs that point at an id the
|
|
47
|
+
* caller never binds resolve to the empty filter list at render
|
|
48
|
+
* time — equivalent to no filter.
|
|
49
|
+
*/
|
|
50
|
+
rewriteCss(css: string): CssRewriteResult;
|
|
51
|
+
/**
|
|
52
|
+
* Generates a scoped id for each local id under `scopeKey` and
|
|
53
|
+
* returns the inline-style bindings that wire each
|
|
54
|
+
* `--svg-filter-<localId>` to its scoped URL. `scopeKey` must be
|
|
55
|
+
* unique among coexisting filter sets in the same SVG document.
|
|
56
|
+
*/
|
|
57
|
+
scopeIds(localIds: Iterable<string>, scopeKey: string): IdScopeResult;
|
|
58
|
+
private bindingVarName;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=SvgFilterScoper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SvgFilterScoper.d.ts","sourceRoot":"","sources":["../../../src/modules/svg-filter/SvgFilterScoper.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACxC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChD,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,eAAe;IAC1B;;;;;;;OAOG;IACH,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB;IASzC;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,aAAa;IAWrE,OAAO,CAAC,cAAc;CAGvB"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const FILTER_URL_REF_RE = /url\(\s*(['"]?)#([a-zA-Z0-9_-]+)\1\s*\)/g;
|
|
2
|
+
const BINDING_VAR_PREFIX = '--svg-filter-';
|
|
3
|
+
/**
|
|
4
|
+
* Generates a unique namespace for a set of `<filter>` ids and pairs
|
|
5
|
+
* those scoped ids with the CSS variables that consuming elements
|
|
6
|
+
* use to reach them. The same scheme rewrites the stylesheet's
|
|
7
|
+
* `url(#id)` references so the binding chain is closed.
|
|
8
|
+
*
|
|
9
|
+
* The indirection is what lets independent filter sets coexist in
|
|
10
|
+
* the same SVG document without id collisions, and what makes
|
|
11
|
+
* per-tile filters compatible with stylesheets that animate
|
|
12
|
+
* `filter:` via `@keyframes`: an inline style cannot override an
|
|
13
|
+
* active animation value, but it CAN supply the variable the
|
|
14
|
+
* animation references, which is resolved per element through
|
|
15
|
+
* ordinary CSS variable inheritance.
|
|
16
|
+
*
|
|
17
|
+
* Only the top-level `<filter>` ids are rewritten. The SVG filter
|
|
18
|
+
* primitive id space (`in`, `result`, `feMergeNode in=...`) is local
|
|
19
|
+
* to each `<filter>` element and is left untouched.
|
|
20
|
+
*/
|
|
21
|
+
export class SvgFilterScoper {
|
|
22
|
+
/**
|
|
23
|
+
* Replaces every `url(#localId)` reference in the stylesheet with
|
|
24
|
+
* `var(--svg-filter-<localId>)`. The local ids that were
|
|
25
|
+
* encountered are returned so the caller knows which variables a
|
|
26
|
+
* consuming element must bind. Refs that point at an id the
|
|
27
|
+
* caller never binds resolve to the empty filter list at render
|
|
28
|
+
* time — equivalent to no filter.
|
|
29
|
+
*/
|
|
30
|
+
rewriteCss(css) {
|
|
31
|
+
const localIds = new Set();
|
|
32
|
+
const rewritten = css.replace(FILTER_URL_REF_RE, (_match, _quote, id) => {
|
|
33
|
+
localIds.add(id);
|
|
34
|
+
return `var(${this.bindingVarName(id)})`;
|
|
35
|
+
});
|
|
36
|
+
return { css: rewritten, localIds };
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Generates a scoped id for each local id under `scopeKey` and
|
|
40
|
+
* returns the inline-style bindings that wire each
|
|
41
|
+
* `--svg-filter-<localId>` to its scoped URL. `scopeKey` must be
|
|
42
|
+
* unique among coexisting filter sets in the same SVG document.
|
|
43
|
+
*/
|
|
44
|
+
scopeIds(localIds, scopeKey) {
|
|
45
|
+
const idByLocal = new Map();
|
|
46
|
+
const bindings = new Map();
|
|
47
|
+
for (const localId of localIds) {
|
|
48
|
+
const scopedId = `tscaps-filter-${scopeKey}-${localId}`;
|
|
49
|
+
idByLocal.set(localId, scopedId);
|
|
50
|
+
bindings.set(this.bindingVarName(localId), `url(#${scopedId})`);
|
|
51
|
+
}
|
|
52
|
+
return { idByLocal, bindings };
|
|
53
|
+
}
|
|
54
|
+
bindingVarName(localId) {
|
|
55
|
+
return `${BINDING_VAR_PREFIX}${localId}`;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=SvgFilterScoper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SvgFilterScoper.js","sourceRoot":"","sources":["../../../src/modules/svg-filter/SvgFilterScoper.ts"],"names":[],"mappings":"AAAA,MAAM,iBAAiB,GAAG,0CAA0C,CAAC;AAErE,MAAM,kBAAkB,GAAG,eAAe,CAAC;AA0B3C;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,eAAe;IAC1B;;;;;;;OAOG;IACH,UAAU,CAAC,GAAW;QACpB,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;QACnC,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE;YACtE,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACjB,OAAO,OAAO,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,GAAG,CAAC;QAC3C,CAAC,CAAC,CAAC;QACH,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtC,CAAC;IAED;;;;;OAKG;IACH,QAAQ,CAAC,QAA0B,EAAE,QAAgB;QACnD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;QAC5C,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAC;QAC3C,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,MAAM,QAAQ,GAAG,iBAAiB,QAAQ,IAAI,OAAO,EAAE,CAAC;YACxD,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YACjC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,QAAQ,QAAQ,GAAG,CAAC,CAAC;QAClE,CAAC;QACD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;IACjC,CAAC;IAEO,cAAc,CAAC,OAAe;QACpC,OAAO,GAAG,kBAAkB,GAAG,OAAO,EAAE,CAAC;IAC3C,CAAC;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { SvgFilter } from '../svg-filter/SvgFilter';
|
|
2
|
+
export { SvgFilterDefinitions } from '../svg-filter/SvgFilterDefinitions';
|
|
3
|
+
export { SvgFilterDefinitionsParser } from '../svg-filter/SvgFilterDefinitionsParser';
|
|
4
|
+
export { SvgFilterScope } from '../svg-filter/SvgFilterScope';
|
|
5
|
+
export { SvgFilterBundle } from '../svg-filter/SvgFilterBundle';
|
|
6
|
+
export { SvgFilterScoper } from '../svg-filter/SvgFilterScoper';
|
|
7
|
+
export { SvgFilterLengthResolver } from '../svg-filter/SvgFilterLengthResolver';
|
|
8
|
+
export type { CssRewriteResult, IdScopeResult } from '../svg-filter/SvgFilterScoper';
|
|
9
|
+
export type { SvgFilterScopeProvider, SvgFilterRenderContext, SvgFilterLengthFactors } from '../svg-filter/SvgFilterScopeProvider';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/svg-filter/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,0BAA0B,EAAE,MAAM,gDAAgD,CAAC;AAC5F,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AACtF,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAC3F,YAAY,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { SvgFilter } from '../svg-filter/SvgFilter';
|
|
2
|
+
export { SvgFilterDefinitions } from '../svg-filter/SvgFilterDefinitions';
|
|
3
|
+
export { SvgFilterDefinitionsParser } from '../svg-filter/SvgFilterDefinitionsParser';
|
|
4
|
+
export { SvgFilterScope } from '../svg-filter/SvgFilterScope';
|
|
5
|
+
export { SvgFilterBundle } from '../svg-filter/SvgFilterBundle';
|
|
6
|
+
export { SvgFilterScoper } from '../svg-filter/SvgFilterScoper';
|
|
7
|
+
export { SvgFilterLengthResolver } from '../svg-filter/SvgFilterLengthResolver';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/svg-filter/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,0BAA0B,EAAE,MAAM,gDAAgD,CAAC;AAC5F,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Tagger } from '../tagging/Tagger';
|
|
2
|
+
import { Document } from '../document/Document';
|
|
3
|
+
export declare class RegexTagger extends Tagger {
|
|
4
|
+
private readonly tagName;
|
|
5
|
+
private readonly regex;
|
|
6
|
+
constructor(tagName: string, pattern: string | RegExp, flags?: string);
|
|
7
|
+
tag(document: Document): Document;
|
|
8
|
+
private tagSegment;
|
|
9
|
+
private tagLine;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=RegexTagger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RegexTagger.d.ts","sourceRoot":"","sources":["../../../src/modules/tagging/RegexTagger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAMtD,qBAAa,WAAY,SAAQ,MAAM;IAInC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAH1B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;gBAGZ,OAAO,EAAE,MAAM,EAChC,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,KAAK,CAAC,EAAE,MAAM;IAOhB,GAAG,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IAOjC,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,OAAO;CAQhB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Tagger } from '../tagging/Tagger';
|
|
2
|
+
import { Line } from '../document/Line';
|
|
3
|
+
import { Tag } from '../document/Tag';
|
|
4
|
+
// Tags words whose text matches a given regular expression.
|
|
5
|
+
export class RegexTagger extends Tagger {
|
|
6
|
+
tagName;
|
|
7
|
+
regex;
|
|
8
|
+
constructor(tagName, pattern, flags) {
|
|
9
|
+
super();
|
|
10
|
+
this.tagName = tagName;
|
|
11
|
+
this.regex =
|
|
12
|
+
pattern instanceof RegExp ? pattern : new RegExp(pattern, flags ?? 'i');
|
|
13
|
+
}
|
|
14
|
+
tag(document) {
|
|
15
|
+
const sections = document.sections.map((section) => section.with({ segments: section.segments.map((segment) => this.tagSegment(segment)) }));
|
|
16
|
+
return document.with({ sections });
|
|
17
|
+
}
|
|
18
|
+
tagSegment(segment) {
|
|
19
|
+
const lines = segment.lines.map((line) => this.tagLine(line));
|
|
20
|
+
return segment.with({ lines });
|
|
21
|
+
}
|
|
22
|
+
tagLine(line) {
|
|
23
|
+
const words = line.words.map((word) => {
|
|
24
|
+
if (!this.regex.test(word.text))
|
|
25
|
+
return word;
|
|
26
|
+
const newSemanticTags = new Set([...word.semanticTags, Tag.of(this.tagName)]);
|
|
27
|
+
return word.with({ semanticTags: newSemanticTags });
|
|
28
|
+
});
|
|
29
|
+
return new Line({ words, structureTags: line.structureTags });
|
|
30
|
+
}
|
|
31
|
+
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E,KAAK,EAAE,CAAC,CAAC;IACjC,CAAC;IAEO,OAAO,CAAC,IAAU;QACxB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACpC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;gBAAE,OAAO,IAAI,CAAC;YAC7C,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,YAAY,EAAE,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAC9E,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,eAAe,EAAE,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,IAAI,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;IAChE,CAAC;CACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Tagger } from '../tagging/Tagger';
|
|
2
|
+
import { Document } from '../document/Document';
|
|
3
|
+
/**
|
|
4
|
+
* Tags every word that falls inside a span delimited by two
|
|
5
|
+
* boundary patterns: one that marks the word opening the span
|
|
6
|
+
* and one that marks the word closing it. Boundary words are
|
|
7
|
+
* tagged together with everything in between, and the span
|
|
8
|
+
* propagates across line, segment, and section boundaries.
|
|
9
|
+
*
|
|
10
|
+
* A word that matches both patterns is treated as a single-word
|
|
11
|
+
* span. A span that opens but never closes within the document
|
|
12
|
+
* is discarded: no word in it gets tagged.
|
|
13
|
+
*/
|
|
14
|
+
export declare class SpanTagger extends Tagger {
|
|
15
|
+
private readonly tagName;
|
|
16
|
+
private readonly openPattern;
|
|
17
|
+
private readonly closePattern;
|
|
18
|
+
constructor(tagName: string, openPattern: RegExp, closePattern: RegExp);
|
|
19
|
+
tag(document: Document): Document;
|
|
20
|
+
private collectSpannedWords;
|
|
21
|
+
private rebuildDocument;
|
|
22
|
+
private rebuildLine;
|
|
23
|
+
private withTag;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=SpanTagger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SpanTagger.d.ts","sourceRoot":"","sources":["../../../src/modules/tagging/SpanTagger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAKtD;;;;;;;;;;GAUG;AACH,qBAAa,UAAW,SAAQ,MAAM;IAElC,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,YAAY;gBAFZ,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM;IAKvC,GAAG,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IAKjC,OAAO,CAAC,mBAAmB;IA2B3B,OAAO,CAAC,eAAe;IAavB,OAAO,CAAC,WAAW;IAOnB,OAAO,CAAC,OAAO;CAIhB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Tagger } from '../tagging/Tagger';
|
|
2
|
+
import { Line } from '../document/Line';
|
|
3
|
+
import { Tag } from '../document/Tag';
|
|
4
|
+
/**
|
|
5
|
+
* Tags every word that falls inside a span delimited by two
|
|
6
|
+
* boundary patterns: one that marks the word opening the span
|
|
7
|
+
* and one that marks the word closing it. Boundary words are
|
|
8
|
+
* tagged together with everything in between, and the span
|
|
9
|
+
* propagates across line, segment, and section boundaries.
|
|
10
|
+
*
|
|
11
|
+
* A word that matches both patterns is treated as a single-word
|
|
12
|
+
* span. A span that opens but never closes within the document
|
|
13
|
+
* is discarded: no word in it gets tagged.
|
|
14
|
+
*/
|
|
15
|
+
export class SpanTagger extends Tagger {
|
|
16
|
+
tagName;
|
|
17
|
+
openPattern;
|
|
18
|
+
closePattern;
|
|
19
|
+
constructor(tagName, openPattern, closePattern) {
|
|
20
|
+
super();
|
|
21
|
+
this.tagName = tagName;
|
|
22
|
+
this.openPattern = openPattern;
|
|
23
|
+
this.closePattern = closePattern;
|
|
24
|
+
}
|
|
25
|
+
tag(document) {
|
|
26
|
+
const wordsToTag = this.collectSpannedWords(document);
|
|
27
|
+
return this.rebuildDocument(document, wordsToTag);
|
|
28
|
+
}
|
|
29
|
+
collectSpannedWords(document) {
|
|
30
|
+
const tagged = new Set();
|
|
31
|
+
let currentSpan = [];
|
|
32
|
+
let isInsideSpan = false;
|
|
33
|
+
for (const word of document.getWords()) {
|
|
34
|
+
const opens = this.openPattern.test(word.text);
|
|
35
|
+
const closes = this.closePattern.test(word.text);
|
|
36
|
+
if (isInsideSpan) {
|
|
37
|
+
currentSpan.push(word);
|
|
38
|
+
if (closes) {
|
|
39
|
+
currentSpan.forEach((spanWord) => tagged.add(spanWord));
|
|
40
|
+
currentSpan = [];
|
|
41
|
+
isInsideSpan = false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
else if (opens) {
|
|
45
|
+
currentSpan.push(word);
|
|
46
|
+
isInsideSpan = true;
|
|
47
|
+
if (closes) {
|
|
48
|
+
currentSpan.forEach((spanWord) => tagged.add(spanWord));
|
|
49
|
+
currentSpan = [];
|
|
50
|
+
isInsideSpan = false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return tagged;
|
|
55
|
+
}
|
|
56
|
+
rebuildDocument(document, taggedWords) {
|
|
57
|
+
const sections = document.sections.map((section) => section.with({
|
|
58
|
+
segments: section.segments.map((segment) => segment.with({
|
|
59
|
+
lines: segment.lines.map((line) => this.rebuildLine(line, taggedWords)),
|
|
60
|
+
})),
|
|
61
|
+
}));
|
|
62
|
+
return document.with({ sections });
|
|
63
|
+
}
|
|
64
|
+
rebuildLine(line, taggedWords) {
|
|
65
|
+
const words = line.words.map((word) => taggedWords.has(word) ? this.withTag(word) : word);
|
|
66
|
+
return new Line({ words, structureTags: line.structureTags, id: line.id });
|
|
67
|
+
}
|
|
68
|
+
withTag(word) {
|
|
69
|
+
const semanticTags = new Set([...word.semanticTags, Tag.of(this.tagName)]);
|
|
70
|
+
return word.with({ semanticTags });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=SpanTagger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SpanTagger.js","sourceRoot":"","sources":["../../../src/modules/tagging/SpanTagger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE9C,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C;;;;;;;;;;GAUG;AACH,MAAM,OAAO,UAAW,SAAQ,MAAM;IAEjB;IACA;IACA;IAHnB,YACmB,OAAe,EACf,WAAmB,EACnB,YAAoB;QAErC,KAAK,EAAE,CAAC;QAJS,YAAO,GAAP,OAAO,CAAQ;QACf,gBAAW,GAAX,WAAW,CAAQ;QACnB,iBAAY,GAAZ,YAAY,CAAQ;IAGvC,CAAC;IAED,GAAG,CAAC,QAAkB;QACpB,MAAM,UAAU,GAAG,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QACtD,OAAO,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACpD,CAAC;IAEO,mBAAmB,CAAC,QAAkB;QAC5C,MAAM,MAAM,GAAG,IAAI,GAAG,EAAQ,CAAC;QAC/B,IAAI,WAAW,GAAW,EAAE,CAAC;QAC7B,IAAI,YAAY,GAAG,KAAK,CAAC;QACzB,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC;YACvC,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,IAA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E,CAAC,CACH;SACF,CAAC,CACH,CAAC;QACF,OAAO,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;IACrC,CAAC;IAEO,WAAW,CAAC,IAAU,EAAE,WAAsB;QACpD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACpC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAClD,CAAC;QACF,OAAO,IAAI,IAAI,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IAC7E,CAAC;IAEO,OAAO,CAAC,IAAU;QACxB,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,YAAY,EAAE,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC3E,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC;IACrC,CAAC;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Tagger } from '../tagging/Tagger';
|
|
2
|
+
import { Document } from '../document/Document';
|
|
3
|
+
/**
|
|
4
|
+
* Assigns positional structure tags across the Document hierarchy:
|
|
5
|
+
* - Section-level: FIRST/LAST_SECTION_IN_DOCUMENT
|
|
6
|
+
* - Segment-level: FIRST/LAST_SEGMENT_IN_SECTION
|
|
7
|
+
* - Line-level: FIRST/LAST_LINE_IN_SECTION, FIRST/LAST_LINE_IN_SEGMENT
|
|
8
|
+
* - Word-level: FIRST/LAST_WORD_IN_SECTION, FIRST/LAST_WORD_IN_SEGMENT,
|
|
9
|
+
* FIRST/LAST_WORD_IN_LINE
|
|
10
|
+
*
|
|
11
|
+
* Runs once after splitting, before rendering.
|
|
12
|
+
*/
|
|
13
|
+
export declare class StructureTagger extends Tagger {
|
|
14
|
+
tag(document: Document): Document;
|
|
15
|
+
private tagSection;
|
|
16
|
+
private tagSegment;
|
|
17
|
+
private tagLine;
|
|
18
|
+
private tagWord;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=StructureTagger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StructureTagger.d.ts","sourceRoot":"","sources":["../../../src/modules/tagging/StructureTagger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAOtD;;;;;;;;;GASG;AACH,qBAAa,eAAgB,SAAQ,MAAM;IACzC,GAAG,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IAQjC,OAAO,CAAC,UAAU;IAelB,OAAO,CAAC,UAAU;IAmBlB,OAAO,CAAC,OAAO;IAuBf,OAAO,CAAC,OAAO;CAqBhB"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Tagger } from '../tagging/Tagger';
|
|
2
|
+
import { Line } from '../document/Line';
|
|
3
|
+
import { Tag, StructureTag } from '../document/Tag';
|
|
4
|
+
/**
|
|
5
|
+
* Assigns positional structure tags across the Document hierarchy:
|
|
6
|
+
* - Section-level: FIRST/LAST_SECTION_IN_DOCUMENT
|
|
7
|
+
* - Segment-level: FIRST/LAST_SEGMENT_IN_SECTION
|
|
8
|
+
* - Line-level: FIRST/LAST_LINE_IN_SECTION, FIRST/LAST_LINE_IN_SEGMENT
|
|
9
|
+
* - Word-level: FIRST/LAST_WORD_IN_SECTION, FIRST/LAST_WORD_IN_SEGMENT,
|
|
10
|
+
* FIRST/LAST_WORD_IN_LINE
|
|
11
|
+
*
|
|
12
|
+
* Runs once after splitting, before rendering.
|
|
13
|
+
*/
|
|
14
|
+
export class StructureTagger extends Tagger {
|
|
15
|
+
tag(document) {
|
|
16
|
+
const sections = document.sections;
|
|
17
|
+
const taggedSections = sections.map((section, secIdx) => this.tagSection(section, secIdx, sections.length));
|
|
18
|
+
return document.with({ sections: taggedSections });
|
|
19
|
+
}
|
|
20
|
+
tagSection(section, secIdx, totalSections) {
|
|
21
|
+
const tags = new Set();
|
|
22
|
+
if (secIdx === 0)
|
|
23
|
+
tags.add(Tag.of(StructureTag.FIRST_SECTION_IN_DOCUMENT));
|
|
24
|
+
if (secIdx === totalSections - 1)
|
|
25
|
+
tags.add(Tag.of(StructureTag.LAST_SECTION_IN_DOCUMENT));
|
|
26
|
+
const sectionWords = section.getWords();
|
|
27
|
+
const sectionLines = section.getLines();
|
|
28
|
+
const taggedSegments = section.segments.map((segment, segIdx) => this.tagSegment(segment, segIdx, section.segments.length, sectionWords, sectionLines));
|
|
29
|
+
return section.with({ segments: taggedSegments, structureTags: tags });
|
|
30
|
+
}
|
|
31
|
+
tagSegment(segment, segIdx, totalSegments, sectionWords, sectionLines) {
|
|
32
|
+
const tags = new Set();
|
|
33
|
+
if (segIdx === 0)
|
|
34
|
+
tags.add(Tag.of(StructureTag.FIRST_SEGMENT_IN_SECTION));
|
|
35
|
+
if (segIdx === totalSegments - 1)
|
|
36
|
+
tags.add(Tag.of(StructureTag.LAST_SEGMENT_IN_SECTION));
|
|
37
|
+
const segmentWords = segment.getWords();
|
|
38
|
+
const taggedLines = segment.lines.map((line, lineIdx) => this.tagLine(line, lineIdx, segment.lines.length, segmentWords, sectionWords, sectionLines));
|
|
39
|
+
return segment.with({ lines: taggedLines, structureTags: tags });
|
|
40
|
+
}
|
|
41
|
+
tagLine(line, lineIdx, totalLines, segmentWords, sectionWords, sectionLines) {
|
|
42
|
+
const tags = new Set();
|
|
43
|
+
if (lineIdx === 0)
|
|
44
|
+
tags.add(Tag.of(StructureTag.FIRST_LINE_IN_SEGMENT));
|
|
45
|
+
if (lineIdx === totalLines - 1)
|
|
46
|
+
tags.add(Tag.of(StructureTag.LAST_LINE_IN_SEGMENT));
|
|
47
|
+
const sectionLineIdx = sectionLines.indexOf(line);
|
|
48
|
+
if (sectionLineIdx === 0)
|
|
49
|
+
tags.add(Tag.of(StructureTag.FIRST_LINE_IN_SECTION));
|
|
50
|
+
if (sectionLineIdx === sectionLines.length - 1)
|
|
51
|
+
tags.add(Tag.of(StructureTag.LAST_LINE_IN_SECTION));
|
|
52
|
+
const taggedWords = line.words.map((word, wordIdx) => this.tagWord(word, wordIdx, line.words.length, segmentWords, sectionWords));
|
|
53
|
+
return new Line({ words: taggedWords, structureTags: tags, id: line.id });
|
|
54
|
+
}
|
|
55
|
+
tagWord(word, wordIdx, totalInLine, segmentWords, sectionWords) {
|
|
56
|
+
const tags = new Set();
|
|
57
|
+
if (wordIdx === 0)
|
|
58
|
+
tags.add(Tag.of(StructureTag.FIRST_WORD_IN_LINE));
|
|
59
|
+
if (wordIdx === totalInLine - 1)
|
|
60
|
+
tags.add(Tag.of(StructureTag.LAST_WORD_IN_LINE));
|
|
61
|
+
const segWordIdx = segmentWords.indexOf(word);
|
|
62
|
+
if (segWordIdx === 0)
|
|
63
|
+
tags.add(Tag.of(StructureTag.FIRST_WORD_IN_SEGMENT));
|
|
64
|
+
if (segWordIdx === segmentWords.length - 1)
|
|
65
|
+
tags.add(Tag.of(StructureTag.LAST_WORD_IN_SEGMENT));
|
|
66
|
+
const sectionWordIdx = sectionWords.indexOf(word);
|
|
67
|
+
if (sectionWordIdx === 0)
|
|
68
|
+
tags.add(Tag.of(StructureTag.FIRST_WORD_IN_SECTION));
|
|
69
|
+
if (sectionWordIdx === sectionWords.length - 1)
|
|
70
|
+
tags.add(Tag.of(StructureTag.LAST_WORD_IN_SECTION));
|
|
71
|
+
return word.with({ structureTags: tags });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=StructureTagger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StructureTagger.js","sourceRoot":"","sources":["../../../src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F,MAAM,UAAU,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAI,UAAU,KAAK,CAAC;YAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC,CAAC;QAC3E,IAAI,UAAU,KAAK,YAAY,CAAC,MAAM,GAAG,CAAC;YAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC,CAAC;QAEhG,MAAM,cAAc,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAClD,IAAI,cAAc,KAAK,CAAC;YAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC,CAAC;QAC/E,IAAI,cAAc,KAAK,YAAY,CAAC,MAAM,GAAG,CAAC;YAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC,CAAC;QAEpG,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5C,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tagger.d.ts","sourceRoot":"","sources":["../../../src/modules/tagging/Tagger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAIxD,8BAAsB,MAAM;IAC1B,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;CAC3C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tagger.js","sourceRoot":"","sources":["../../../src/modules/tagging/Tagger.ts"],"names":[],"mappings":"AAEA,4CAA4C;AAC5C,kEAAkE;AAClE,MAAM,OAAgB,MAAM;CAE3B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Tagger } from '../tagging/Tagger';
|
|
2
|
+
import { Document } from '../document/Document';
|
|
3
|
+
export declare class WordlistTagger extends Tagger {
|
|
4
|
+
private readonly tagName;
|
|
5
|
+
private readonly wordSet;
|
|
6
|
+
constructor(tagName: string, words: string[]);
|
|
7
|
+
tag(document: Document): Document;
|
|
8
|
+
private tagSegment;
|
|
9
|
+
private tagLine;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=WordlistTagger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WordlistTagger.d.ts","sourceRoot":"","sources":["../../../src/modules/tagging/WordlistTagger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAMtD,qBAAa,cAAe,SAAQ,MAAM;IAItC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAH1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAc;gBAGnB,OAAO,EAAE,MAAM,EAChC,KAAK,EAAE,MAAM,EAAE;IAMjB,GAAG,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ;IAOjC,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,OAAO;CAQhB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Tagger } from '../tagging/Tagger';
|
|
2
|
+
import { Line } from '../document/Line';
|
|
3
|
+
import { Tag } from '../document/Tag';
|
|
4
|
+
// Tags words that appear in a predefined word list (case-insensitive).
|
|
5
|
+
export class WordlistTagger extends Tagger {
|
|
6
|
+
tagName;
|
|
7
|
+
wordSet;
|
|
8
|
+
constructor(tagName, words) {
|
|
9
|
+
super();
|
|
10
|
+
this.tagName = tagName;
|
|
11
|
+
this.wordSet = new Set(words.map((w) => w.toLowerCase()));
|
|
12
|
+
}
|
|
13
|
+
tag(document) {
|
|
14
|
+
const sections = document.sections.map((section) => section.with({ segments: section.segments.map((segment) => this.tagSegment(segment)) }));
|
|
15
|
+
return document.with({ sections });
|
|
16
|
+
}
|
|
17
|
+
tagSegment(segment) {
|
|
18
|
+
const lines = segment.lines.map((line) => this.tagLine(line));
|
|
19
|
+
return segment.with({ lines });
|
|
20
|
+
}
|
|
21
|
+
tagLine(line) {
|
|
22
|
+
const words = line.words.map((word) => {
|
|
23
|
+
if (!this.wordSet.has(word.text.toLowerCase()))
|
|
24
|
+
return word;
|
|
25
|
+
const newSemanticTags = new Set([...word.semanticTags, Tag.of(this.tagName)]);
|
|
26
|
+
return word.with({ semanticTags: newSemanticTags });
|
|
27
|
+
});
|
|
28
|
+
return new Line({ words, structureTags: line.structureTags });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=WordlistTagger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WordlistTagger.js","sourceRoot":"","sources":["../../../src/modules/tagging/WordlistTagger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGjD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,uEAAuE;AACvE,MAAM,OAAO,cAAe,SAAQ,MAAM;IAIrB;IAHF,OAAO,CAAc;IAEtC,YACmB,OAAe,EAChC,KAAe;QAEf,KAAK,EAAE,CAAC;QAHS,YAAO,GAAP,OAAO,CAAQ;QAIhC,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IAC5D,CAAC;IAED,GAAG,CAAC,QAAkB;QACpB,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CACjD,O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ger';
|
|
4
|
+
export { WordlistTagger } from '../tagging/WordlistTagger';
|
|
5
|
+
export { SpanTagger } from '../tagging/SpanTagger';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/tagging/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Tagger } from '../tagging/Tagger';
|
|
2
|
+
export { StructureTagger } from '../tagging/StructureTagger';
|
|
3
|
+
export { RegexTagger } from '../tagging/RegexTagger';
|
|
4
|
+
export { WordlistTagger } from '../tagging/WordlistTagger';
|
|
5
|
+
export { SpanTagger } from '../tagging/SpanTagger';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/tagging/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decodes an audio/video Blob to mono PCM at the requested sample rate.
|
|
3
|
+
* Implementations choose how to do this — using browser Web Audio APIs,
|
|
4
|
+
* a pure-JS WAV parser, or trusting a pre-decoded byte stream — so the
|
|
5
|
+
* decode strategy is decoupled from the consumer (e.g. WhisperTranscriber)
|
|
6
|
+
* and from the platform (main thread vs Worker context).
|
|
7
|
+
*/
|
|
8
|
+
export interface AudioDecoder {
|
|
9
|
+
decode(audio: Blob, targetSampleRate: number): Promise<Float32Array>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=AudioDecoder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AudioDecoder.d.ts","sourceRoot":"","sources":["../../../src/modules/transcription/AudioDecoder.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CACtE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AudioDecoder.js","sourceRoot":"","sources":["../../../src/modules/transcription/AudioDecoder.ts"],"names":[],"mappings":""}
|