@tscaps/engine 0.3.0 → 0.4.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 +35 -8
- package/dist/modules/document/CssVariable.d.ts +6 -0
- package/dist/modules/document/CssVariable.d.ts.map +1 -1
- package/dist/modules/document/CssVariable.js +6 -0
- package/dist/modules/document/CssVariable.js.map +1 -1
- package/dist/modules/document/Document.d.ts +3 -0
- package/dist/modules/document/Document.d.ts.map +1 -1
- package/dist/modules/document/Document.js +12 -1
- package/dist/modules/document/Document.js.map +1 -1
- package/dist/modules/document/DocumentEditor.d.ts +16 -4
- package/dist/modules/document/DocumentEditor.d.ts.map +1 -1
- package/dist/modules/document/DocumentEditor.js +14 -10
- package/dist/modules/document/DocumentEditor.js.map +1 -1
- package/dist/modules/document/Line.d.ts +6 -0
- package/dist/modules/document/Line.d.ts.map +1 -1
- package/dist/modules/document/Line.js +10 -0
- package/dist/modules/document/Line.js.map +1 -1
- package/dist/modules/document/Word.d.ts +8 -0
- package/dist/modules/document/Word.d.ts.map +1 -1
- package/dist/modules/document/Word.js +11 -1
- package/dist/modules/document/Word.js.map +1 -1
- package/dist/modules/pipeline/RenderPipelineBuilder.d.ts +1 -1
- package/dist/modules/pipeline/RenderPipelineBuilder.d.ts.map +1 -1
- package/dist/modules/pipeline/RenderPipelineBuilder.js +15 -5
- package/dist/modules/pipeline/RenderPipelineBuilder.js.map +1 -1
- package/dist/modules/rendering/BrowserSubtitleFrameRenderer.d.ts +18 -8
- package/dist/modules/rendering/BrowserSubtitleFrameRenderer.d.ts.map +1 -1
- package/dist/modules/rendering/BrowserSubtitleFrameRenderer.js +27 -21
- package/dist/modules/rendering/BrowserSubtitleFrameRenderer.js.map +1 -1
- package/dist/modules/rendering/SubtitleFrameRenderer.d.ts +41 -33
- package/dist/modules/rendering/SubtitleFrameRenderer.d.ts.map +1 -1
- package/dist/modules/rendering/index.d.ts +4 -0
- package/dist/modules/rendering/index.d.ts.map +1 -1
- package/dist/modules/rendering/index.js +2 -0
- package/dist/modules/rendering/index.js.map +1 -1
- package/dist/modules/rendering/subtitle/ActiveRenderSession.d.ts +13 -6
- package/dist/modules/rendering/subtitle/ActiveRenderSession.d.ts.map +1 -1
- package/dist/modules/rendering/subtitle/ActiveRenderSession.js +16 -9
- package/dist/modules/rendering/subtitle/ActiveRenderSession.js.map +1 -1
- package/dist/modules/rendering/subtitle/ActiveRenderSessionFactory.d.ts +5 -2
- package/dist/modules/rendering/subtitle/ActiveRenderSessionFactory.d.ts.map +1 -1
- package/dist/modules/rendering/subtitle/ActiveRenderSessionFactory.js +26 -8
- package/dist/modules/rendering/subtitle/ActiveRenderSessionFactory.js.map +1 -1
- package/dist/modules/rendering/subtitle/AnimationStateFingerprint.d.ts +20 -0
- package/dist/modules/rendering/subtitle/AnimationStateFingerprint.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/AnimationStateFingerprint.js +2 -0
- package/dist/modules/rendering/subtitle/AnimationStateFingerprint.js.map +1 -0
- package/dist/modules/rendering/subtitle/AssetGroupBuilder.d.ts +4 -0
- package/dist/modules/rendering/subtitle/AssetGroupBuilder.d.ts.map +1 -1
- package/dist/modules/rendering/subtitle/AssetGroupBuilder.js +8 -0
- package/dist/modules/rendering/subtitle/AssetGroupBuilder.js.map +1 -1
- package/dist/modules/rendering/subtitle/BatchPlanner.d.ts +50 -5
- package/dist/modules/rendering/subtitle/BatchPlanner.d.ts.map +1 -1
- package/dist/modules/rendering/subtitle/BatchPlanner.js +97 -15
- package/dist/modules/rendering/subtitle/BatchPlanner.js.map +1 -1
- package/dist/modules/rendering/subtitle/ElementWidthMeasurer.d.ts +56 -0
- package/dist/modules/rendering/subtitle/ElementWidthMeasurer.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/ElementWidthMeasurer.js +119 -0
- package/dist/modules/rendering/subtitle/ElementWidthMeasurer.js.map +1 -0
- package/dist/modules/rendering/subtitle/ElementWidths.d.ts +23 -0
- package/dist/modules/rendering/subtitle/ElementWidths.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/ElementWidths.js +29 -0
- package/dist/modules/rendering/subtitle/ElementWidths.js.map +1 -0
- package/dist/modules/rendering/subtitle/ImageDecodeSpriteSheetRasterProbe.d.ts +18 -0
- package/dist/modules/rendering/subtitle/ImageDecodeSpriteSheetRasterProbe.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/ImageDecodeSpriteSheetRasterProbe.js +42 -0
- package/dist/modules/rendering/subtitle/ImageDecodeSpriteSheetRasterProbe.js.map +1 -0
- package/dist/modules/rendering/subtitle/KeyframeScanAnimationStateFingerprint.d.ts +35 -0
- package/dist/modules/rendering/subtitle/KeyframeScanAnimationStateFingerprint.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/KeyframeScanAnimationStateFingerprint.js +64 -0
- package/dist/modules/rendering/subtitle/KeyframeScanAnimationStateFingerprint.js.map +1 -0
- package/dist/modules/rendering/subtitle/PreparedStyle.d.ts +2 -0
- package/dist/modules/rendering/subtitle/PreparedStyle.d.ts.map +1 -1
- package/dist/modules/rendering/subtitle/PreparedStyleFactory.d.ts.map +1 -1
- package/dist/modules/rendering/subtitle/PreparedStyleFactory.js +12 -1
- package/dist/modules/rendering/subtitle/PreparedStyleFactory.js.map +1 -1
- package/dist/modules/rendering/subtitle/SegmentAnchorVarsBuilder.d.ts +28 -0
- package/dist/modules/rendering/subtitle/SegmentAnchorVarsBuilder.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SegmentAnchorVarsBuilder.js +23 -0
- package/dist/modules/rendering/subtitle/SegmentAnchorVarsBuilder.js.map +1 -0
- package/dist/modules/rendering/subtitle/SegmentSubtreeHtmlBuilder.d.ts +3 -0
- package/dist/modules/rendering/subtitle/SegmentSubtreeHtmlBuilder.d.ts.map +1 -1
- package/dist/modules/rendering/subtitle/SegmentSubtreeHtmlBuilder.js +12 -3
- package/dist/modules/rendering/subtitle/SegmentSubtreeHtmlBuilder.js.map +1 -1
- package/dist/modules/rendering/subtitle/SegmentWrapperRenderer.d.ts +7 -1
- package/dist/modules/rendering/subtitle/SegmentWrapperRenderer.d.ts.map +1 -1
- package/dist/modules/rendering/subtitle/SegmentWrapperRenderer.js +23 -5
- package/dist/modules/rendering/subtitle/SegmentWrapperRenderer.js.map +1 -1
- package/dist/modules/rendering/subtitle/SpriteSheetProbeObserver.d.ts +29 -0
- package/dist/modules/rendering/subtitle/SpriteSheetProbeObserver.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SpriteSheetProbeObserver.js +2 -0
- package/dist/modules/rendering/subtitle/SpriteSheetProbeObserver.js.map +1 -0
- package/dist/modules/rendering/subtitle/SpriteSheetRasterProbe.d.ts +19 -0
- package/dist/modules/rendering/subtitle/SpriteSheetRasterProbe.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SpriteSheetRasterProbe.js +2 -0
- package/dist/modules/rendering/subtitle/SpriteSheetRasterProbe.js.map +1 -0
- package/dist/modules/rendering/subtitle/SpriteSheetSizeProbe.d.ts +31 -0
- package/dist/modules/rendering/subtitle/SpriteSheetSizeProbe.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SpriteSheetSizeProbe.js +89 -0
- package/dist/modules/rendering/subtitle/SpriteSheetSizeProbe.js.map +1 -0
- package/dist/modules/rendering/subtitle/SubtreeAnimationReading.d.ts +49 -0
- package/dist/modules/rendering/subtitle/SubtreeAnimationReading.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SubtreeAnimationReading.js +87 -0
- package/dist/modules/rendering/subtitle/SubtreeAnimationReading.js.map +1 -0
- package/dist/modules/rendering/subtitle/SubtreeAnimationSupport.d.ts +17 -0
- package/dist/modules/rendering/subtitle/SubtreeAnimationSupport.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SubtreeAnimationSupport.js +53 -0
- package/dist/modules/rendering/subtitle/SubtreeAnimationSupport.js.map +1 -0
- package/dist/modules/rendering/subtitle/SubtreeMountAnimationStateFingerprint.d.ts +62 -0
- package/dist/modules/rendering/subtitle/SubtreeMountAnimationStateFingerprint.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SubtreeMountAnimationStateFingerprint.js +153 -0
- package/dist/modules/rendering/subtitle/SubtreeMountAnimationStateFingerprint.js.map +1 -0
- package/dist/modules/rendering/subtitle/SvgFilterStateFingerprint.d.ts +47 -0
- package/dist/modules/rendering/subtitle/SvgFilterStateFingerprint.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SvgFilterStateFingerprint.js +69 -0
- package/dist/modules/rendering/subtitle/SvgFilterStateFingerprint.js.map +1 -0
- package/dist/modules/rendering/subtitle/UnknownAnimationStateFingerprint.d.ts +9 -0
- package/dist/modules/rendering/subtitle/UnknownAnimationStateFingerprint.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/UnknownAnimationStateFingerprint.js +10 -0
- package/dist/modules/rendering/subtitle/UnknownAnimationStateFingerprint.js.map +1 -0
- package/dist/modules/rendering/subtitle/VideoFrameVarsBuilder.d.ts.map +1 -1
- package/dist/modules/rendering/subtitle/VideoFrameVarsBuilder.js +2 -0
- package/dist/modules/rendering/subtitle/VideoFrameVarsBuilder.js.map +1 -1
- package/dist/modules/rendering/types/ElementRenderOverrides.d.ts +2 -0
- package/dist/modules/rendering/types/ElementRenderOverrides.d.ts.map +1 -1
- package/dist/modules/rendering/types/ElementRenderOverrides.js +4 -0
- package/dist/modules/rendering/types/ElementRenderOverrides.js.map +1 -1
- package/dist/modules/splitting/BalancedLineSplitter.d.ts +9 -0
- package/dist/modules/splitting/BalancedLineSplitter.d.ts.map +1 -1
- package/dist/modules/splitting/BalancedLineSplitter.js +15 -3
- package/dist/modules/splitting/BalancedLineSplitter.js.map +1 -1
- package/dist/modules/splitting/BalancedPixelWidthLineSplitter.d.ts +1 -4
- package/dist/modules/splitting/BalancedPixelWidthLineSplitter.d.ts.map +1 -1
- package/dist/modules/splitting/BalancedPixelWidthLineSplitter.js +5 -7
- package/dist/modules/splitting/BalancedPixelWidthLineSplitter.js.map +1 -1
- package/dist/modules/splitting/DomProbeCanvasTextMeasurer.d.ts +16 -7
- package/dist/modules/splitting/DomProbeCanvasTextMeasurer.d.ts.map +1 -1
- package/dist/modules/splitting/DomProbeCanvasTextMeasurer.js +44 -33
- package/dist/modules/splitting/DomProbeCanvasTextMeasurer.js.map +1 -1
- package/dist/modules/splitting/TextMeasurer.d.ts +9 -4
- package/dist/modules/splitting/TextMeasurer.d.ts.map +1 -1
- package/dist/modules/svg-filter/SvgFilter.d.ts +9 -0
- package/dist/modules/svg-filter/SvgFilter.d.ts.map +1 -1
- package/dist/modules/svg-filter/SvgFilter.js +17 -0
- package/dist/modules/svg-filter/SvgFilter.js.map +1 -1
- package/dist/modules/svg-filter/SvgFilterDefinitions.d.ts +7 -0
- package/dist/modules/svg-filter/SvgFilterDefinitions.d.ts.map +1 -1
- package/dist/modules/svg-filter/SvgFilterDefinitions.js +17 -0
- package/dist/modules/svg-filter/SvgFilterDefinitions.js.map +1 -1
- package/dist/modules/tagging/RegexTagger.js +1 -2
- package/dist/modules/tagging/RegexTagger.js.map +1 -1
- package/dist/modules/tagging/SpanTagger.js +1 -2
- package/dist/modules/tagging/SpanTagger.js.map +1 -1
- package/dist/modules/tagging/StructureTagger.js +1 -2
- package/dist/modules/tagging/StructureTagger.js.map +1 -1
- package/dist/modules/tagging/WordlistTagger.js +1 -2
- package/dist/modules/tagging/WordlistTagger.js.map +1 -1
- package/dist/modules/transcription/AudioSegmentLayout.d.ts +23 -0
- package/dist/modules/transcription/AudioSegmentLayout.d.ts.map +1 -0
- package/dist/modules/transcription/AudioSegmentLayout.js +40 -0
- package/dist/modules/transcription/AudioSegmentLayout.js.map +1 -0
- package/dist/modules/transcription/FallbackAudioDecoder.d.ts +25 -0
- package/dist/modules/transcription/FallbackAudioDecoder.d.ts.map +1 -0
- package/dist/modules/transcription/FallbackAudioDecoder.js +46 -0
- package/dist/modules/transcription/FallbackAudioDecoder.js.map +1 -0
- package/dist/modules/transcription/MediaBunnyAudioOnlyRemuxer.d.ts +71 -0
- package/dist/modules/transcription/MediaBunnyAudioOnlyRemuxer.d.ts.map +1 -0
- package/dist/modules/transcription/MediaBunnyAudioOnlyRemuxer.js +145 -0
- package/dist/modules/transcription/MediaBunnyAudioOnlyRemuxer.js.map +1 -0
- package/dist/modules/transcription/WebAudioAudioDecoder.d.ts +46 -0
- package/dist/modules/transcription/WebAudioAudioDecoder.d.ts.map +1 -0
- package/dist/modules/transcription/WebAudioAudioDecoder.js +123 -0
- package/dist/modules/transcription/WebAudioAudioDecoder.js.map +1 -0
- package/dist/modules/transcription/index.d.ts +4 -0
- package/dist/modules/transcription/index.d.ts.map +1 -1
- package/dist/modules/transcription/index.js +3 -0
- package/dist/modules/transcription/index.js.map +1 -1
- package/dist/modules/video/RenderJob.d.ts +23 -0
- package/dist/modules/video/RenderJob.d.ts.map +1 -1
- package/dist/modules/video/index.d.ts +5 -3
- package/dist/modules/video/index.d.ts.map +1 -1
- package/dist/modules/video/index.js +2 -0
- package/dist/modules/video/index.js.map +1 -1
- package/dist/modules/video/mediabunny/MediaBunnyTranscodeCoordinator.d.ts +33 -1
- package/dist/modules/video/mediabunny/MediaBunnyTranscodeCoordinator.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/MediaBunnyTranscodeCoordinator.js +97 -20
- package/dist/modules/video/mediabunny/MediaBunnyTranscodeCoordinator.js.map +1 -1
- package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.js +1 -0
- package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.js.map +1 -1
- package/dist/modules/video/mediabunny/caption/BatchedSubtitleLayerSource.d.ts +20 -9
- package/dist/modules/video/mediabunny/caption/BatchedSubtitleLayerSource.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/caption/BatchedSubtitleLayerSource.js +56 -14
- package/dist/modules/video/mediabunny/caption/BatchedSubtitleLayerSource.js.map +1 -1
- package/dist/modules/video/mediabunny/caption/ComposedSubtitleLayerSource.d.ts +29 -10
- package/dist/modules/video/mediabunny/caption/ComposedSubtitleLayerSource.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/caption/ComposedSubtitleLayerSource.js +48 -17
- package/dist/modules/video/mediabunny/caption/ComposedSubtitleLayerSource.js.map +1 -1
- package/dist/modules/video/mediabunny/caption/SubtitleLayerSource.d.ts +28 -11
- package/dist/modules/video/mediabunny/caption/SubtitleLayerSource.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/caption/VideoBoundSubtitleLayerSource.d.ts +33 -12
- package/dist/modules/video/mediabunny/caption/VideoBoundSubtitleLayerSource.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/caption/VideoBoundSubtitleLayerSource.js +53 -18
- package/dist/modules/video/mediabunny/caption/VideoBoundSubtitleLayerSource.js.map +1 -1
- package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoder.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoder.js +7 -3
- package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoder.js.map +1 -1
- package/dist/modules/video/mediabunny/frame/BufferedVideoFrameSource.d.ts +45 -0
- package/dist/modules/video/mediabunny/frame/BufferedVideoFrameSource.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/frame/BufferedVideoFrameSource.js +93 -0
- package/dist/modules/video/mediabunny/frame/BufferedVideoFrameSource.js.map +1 -0
- package/dist/modules/video/mediabunny/frame/DefaultVideoFrameDecoderFactory.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/frame/DefaultVideoFrameDecoderFactory.js +3 -1
- package/dist/modules/video/mediabunny/frame/DefaultVideoFrameDecoderFactory.js.map +1 -1
- package/dist/modules/video/mediabunny/frame/RetainedVideoFrame.d.ts +26 -0
- package/dist/modules/video/mediabunny/frame/RetainedVideoFrame.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/frame/RetainedVideoFrame.js +55 -0
- package/dist/modules/video/mediabunny/frame/RetainedVideoFrame.js.map +1 -0
- package/dist/modules/video/mediabunny/frame/VideoFrameDecoderFactory.d.ts +6 -1
- package/dist/modules/video/mediabunny/frame/VideoFrameDecoderFactory.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/frame/VideoFrameDecoderSelectionFailedError.d.ts +14 -0
- package/dist/modules/video/mediabunny/frame/VideoFrameDecoderSelectionFailedError.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/frame/VideoFrameDecoderSelectionFailedError.js +14 -0
- package/dist/modules/video/mediabunny/frame/VideoFrameDecoderSelectionFailedError.js.map +1 -0
- package/dist/modules/video/mediabunny/frame/WebCodecsOnlyVideoFrameDecoderFactory.d.ts +16 -0
- package/dist/modules/video/mediabunny/frame/WebCodecsOnlyVideoFrameDecoderFactory.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/frame/WebCodecsOnlyVideoFrameDecoderFactory.js +23 -0
- package/dist/modules/video/mediabunny/frame/WebCodecsOnlyVideoFrameDecoderFactory.js.map +1 -0
- package/dist/modules/video/mediabunny/painter/CaptionsOverlayFramePainter.d.ts +9 -3
- package/dist/modules/video/mediabunny/painter/CaptionsOverlayFramePainter.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/painter/CaptionsOverlayFramePainter.js +24 -7
- package/dist/modules/video/mediabunny/painter/CaptionsOverlayFramePainter.js.map +1 -1
- package/dist/modules/video/mediabunny/painter/FramePainter.d.ts +35 -14
- package/dist/modules/video/mediabunny/painter/FramePainter.d.ts.map +1 -1
- package/package.json +4 -1
- package/dist/modules/rendering/subtitle/AbstractAnim.d.ts +0 -13
- package/dist/modules/rendering/subtitle/AbstractAnim.d.ts.map +0 -1
- package/dist/modules/rendering/subtitle/AbstractAnim.js +0 -2
- package/dist/modules/rendering/subtitle/AbstractAnim.js.map +0 -1
- package/dist/modules/rendering/subtitle/AnimationProbe.d.ts +0 -39
- package/dist/modules/rendering/subtitle/AnimationProbe.d.ts.map +0 -1
- package/dist/modules/rendering/subtitle/AnimationProbe.js +0 -203
- package/dist/modules/rendering/subtitle/AnimationProbe.js.map +0 -1
- package/dist/modules/rendering/subtitle/SpriteSheetSizeProber.d.ts +0 -17
- package/dist/modules/rendering/subtitle/SpriteSheetSizeProber.d.ts.map +0 -1
- package/dist/modules/rendering/subtitle/SpriteSheetSizeProber.js +0 -58
- package/dist/modules/rendering/subtitle/SpriteSheetSizeProber.js.map +0 -1
- package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.d.ts +0 -27
- package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.d.ts.map +0 -1
- package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.js +0 -84
- package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.js.map +0 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const FIXTURE_CLASS = 'tscaps-subtree-animation-support-probe';
|
|
2
|
+
const FIXTURE_ANIMATION = 'tscaps-subtree-animation-support';
|
|
3
|
+
const FIXTURE_CSS = `
|
|
4
|
+
.${FIXTURE_CLASS}::before { content: ""; animation: ${FIXTURE_ANIMATION} 1s linear both; }
|
|
5
|
+
@keyframes ${FIXTURE_ANIMATION} { from { opacity: 0 } to { opacity: 1 } }
|
|
6
|
+
`;
|
|
7
|
+
const FIXTURE_STYLES = 'position:fixed;left:-99999px;visibility:hidden;pointer-events:none;';
|
|
8
|
+
/**
|
|
9
|
+
* Whether the browser can be asked what animations a subtree runs.
|
|
10
|
+
*
|
|
11
|
+
* Answered by mounting a fixture rather than by naming versions: the
|
|
12
|
+
* question needs `getAnimations` to exist, to honour the `subtree`
|
|
13
|
+
* option, and to report an effect that lives on a descendant's
|
|
14
|
+
* pseudo-element. One fixture exercises all three.
|
|
15
|
+
*
|
|
16
|
+
* Checked on first use and remembered for the lifetime of the
|
|
17
|
+
* instance.
|
|
18
|
+
*/
|
|
19
|
+
export class SubtreeAnimationSupport {
|
|
20
|
+
available = null;
|
|
21
|
+
isAvailable() {
|
|
22
|
+
if (this.available === null)
|
|
23
|
+
this.available = this.check();
|
|
24
|
+
return this.available;
|
|
25
|
+
}
|
|
26
|
+
check() {
|
|
27
|
+
const root = document.createElement('div');
|
|
28
|
+
if (typeof root.getAnimations !== 'function')
|
|
29
|
+
return false;
|
|
30
|
+
root.style.cssText = FIXTURE_STYLES;
|
|
31
|
+
const descendant = document.createElement('div');
|
|
32
|
+
descendant.className = FIXTURE_CLASS;
|
|
33
|
+
root.appendChild(descendant);
|
|
34
|
+
const styleElement = document.createElement('style');
|
|
35
|
+
styleElement.textContent = FIXTURE_CSS;
|
|
36
|
+
document.head.appendChild(styleElement);
|
|
37
|
+
document.body.appendChild(root);
|
|
38
|
+
try {
|
|
39
|
+
return root.getAnimations({ subtree: true }).length > 0;
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
// A browser that rejects the options argument outright cannot be
|
|
43
|
+
// asked the question at all, which is the same answer as one
|
|
44
|
+
// that returns nothing for it.
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
finally {
|
|
48
|
+
root.remove();
|
|
49
|
+
styleElement.remove();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=SubtreeAnimationSupport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubtreeAnimationSupport.js","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/SubtreeAnimationSupport.ts"],"names":[],"mappings":"AAAA,MAAM,aAAa,GAAG,wCAAwC,CAAC;AAC/D,MAAM,iBAAiB,GAAG,kCAAkC,CAAC;AAC7D,MAAM,WAAW,GAAG;KACf,aAAa,sCAAsC,iBAAiB;eAC1D,iBAAiB;CAC/B,CAAC;AACF,MAAM,cAAc,GAAG,qEAAqE,CAAC;AAE7F;;;;;;;;;;GAUG;AACH,MAAM,OAAO,uBAAuB;IAC1B,SAAS,GAAmB,IAAI,CAAC;IAEzC,WAAW;QACT,IAAI,IAAI,CAAC,SAAS,KAAK,IAAI;YAAE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAC3D,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAEO,KAAK;QACX,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC3C,IAAI,OAAO,IAAI,CAAC,aAAa,KAAK,UAAU;YAAE,OAAO,KAAK,CAAC;QAE3D,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,cAAc,CAAC;QACpC,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACjD,UAAU,CAAC,SAAS,GAAG,aAAa,CAAC;QACrC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QAE7B,MAAM,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QACrD,YAAY,CAAC,WAAW,GAAG,WAAW,CAAC;QACvC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;QACxC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;QAC1D,CAAC;QAAC,MAAM,CAAC;YACP,iEAAiE;YACjE,6DAA6D;YAC7D,+BAA+B;YAC/B,OAAO,KAAK,CAAC;QACf,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,MAAM,EAAE,CAAC;YACd,YAAY,CAAC,MAAM,EAAE,CAAC;QACxB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { Segment } from '../../document/Segment';
|
|
2
|
+
import type { PreparedStyle } from '../../rendering/subtitle/PreparedStyle';
|
|
3
|
+
import type { SegmentWrapperRenderer } from '../../rendering/subtitle/SegmentWrapperRenderer';
|
|
4
|
+
import type { SubtreeAnimationSupport } from '../../rendering/subtitle/SubtreeAnimationSupport';
|
|
5
|
+
import type { AnimationStateFingerprint } from '../../rendering/subtitle/AnimationStateFingerprint';
|
|
6
|
+
/**
|
|
7
|
+
* Mounts the segment's subtree and reads back what the browser reports
|
|
8
|
+
* running on it, which covers every rule reaching those elements —
|
|
9
|
+
* pseudo-elements and CSS the consumer supplied included.
|
|
10
|
+
*
|
|
11
|
+
* **Costly.** Every answer it cannot derive from an earlier one mounts
|
|
12
|
+
* a subtree and forces a style recalculation, measured at ~0.35 ms.
|
|
13
|
+
*
|
|
14
|
+
* An animation that has not started holds its first keyframe and one
|
|
15
|
+
* that has finished holds its last, so two timestamps whose animations
|
|
16
|
+
* all sit in matching phases resolve to the same computed styles.
|
|
17
|
+
* Anything mid-run, repeating forever, or reporting timing that cannot
|
|
18
|
+
* be read is answered `null`.
|
|
19
|
+
*
|
|
20
|
+
* A reading is reused for as long as it decides the question on its
|
|
21
|
+
* own, scoped to `classFingerprint`: two timestamps sharing one match
|
|
22
|
+
* the same rules, so their animations can differ only in where the
|
|
23
|
+
* clocks stand.
|
|
24
|
+
*
|
|
25
|
+
* Nothing is reused until a second reading has confirmed the first
|
|
26
|
+
* predicted it. A stylesheet doing arithmetic on a clock moves its
|
|
27
|
+
* phase boundaries at a different rate than the timestamp, and a single
|
|
28
|
+
* reading cannot tell that apart from a clock followed exactly.
|
|
29
|
+
*/
|
|
30
|
+
export declare class SubtreeMountAnimationStateFingerprint implements AnimationStateFingerprint {
|
|
31
|
+
private readonly wrapperRenderer;
|
|
32
|
+
private readonly support;
|
|
33
|
+
private readonly width;
|
|
34
|
+
private readonly height;
|
|
35
|
+
private readonly readingByKey;
|
|
36
|
+
private readonly confirmedKeys;
|
|
37
|
+
private readonly alwaysMount;
|
|
38
|
+
private nextElementUid;
|
|
39
|
+
constructor(wrapperRenderer: SegmentWrapperRenderer, support: SubtreeAnimationSupport, width: number, height: number);
|
|
40
|
+
at(style: PreparedStyle, seg: Segment, t: number, indexInSection: number, classFingerprint: string): Promise<string | null>;
|
|
41
|
+
private retire;
|
|
42
|
+
private read;
|
|
43
|
+
private readMounted;
|
|
44
|
+
private collectEffects;
|
|
45
|
+
/**
|
|
46
|
+
* When the effect's active phase opens relative to the playhead, and
|
|
47
|
+
* how long it lasts — `null` for either where the browser reports
|
|
48
|
+
* timing this cannot read as plain milliseconds.
|
|
49
|
+
*/
|
|
50
|
+
private timingOf;
|
|
51
|
+
/**
|
|
52
|
+
* Where the effect lands, as the child-index path down from `host`
|
|
53
|
+
* plus the pseudo-element it targets. Two subtrees agree on it only
|
|
54
|
+
* when the same node in the same position carries the same effect.
|
|
55
|
+
*/
|
|
56
|
+
private addressOf;
|
|
57
|
+
/** The `@keyframes` rule behind the effect where the browser names one. */
|
|
58
|
+
private ruleOf;
|
|
59
|
+
/** A timing figure as finite milliseconds, or `null` where it is absent, infinite, or not a plain number. */
|
|
60
|
+
private milliseconds;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=SubtreeMountAnimationStateFingerprint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubtreeMountAnimationStateFingerprint.d.ts","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/SubtreeMountAnimationStateFingerprint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AACjG,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AACnG,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAIvG;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,qCAAsC,YAAW,yBAAyB;IAOnF,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,MAAM;IATzB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA8C;IAC3E,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqB;IACnD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqB;IACjD,OAAO,CAAC,cAAc,CAAK;gBAGR,eAAe,EAAE,sBAAsB,EACvC,OAAO,EAAE,uBAAuB,EAChC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM;IAG3B,EAAE,CACN,KAAK,EAAE,aAAa,EACpB,GAAG,EAAE,OAAO,EACZ,CAAC,EAAE,MAAM,EACT,cAAc,EAAE,MAAM,EACtB,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAyBzB,OAAO,CAAC,MAAM;YAMA,IAAI;IAYlB,OAAO,CAAC,WAAW;IAcnB,OAAO,CAAC,cAAc;IAYtB;;;;OAIG;IACH,OAAO,CAAC,QAAQ;IAahB;;;;OAIG;IACH,OAAO,CAAC,SAAS;IAajB,2EAA2E;IAC3E,OAAO,CAAC,MAAM;IAMd,6GAA6G;IAC7G,OAAO,CAAC,YAAY;CAGrB"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { SubtreeAnimationReading } from '../../rendering/subtitle/SubtreeAnimationReading';
|
|
2
|
+
import { profiler } from '../../profiling/Profiler';
|
|
3
|
+
/**
|
|
4
|
+
* Mounts the segment's subtree and reads back what the browser reports
|
|
5
|
+
* running on it, which covers every rule reaching those elements —
|
|
6
|
+
* pseudo-elements and CSS the consumer supplied included.
|
|
7
|
+
*
|
|
8
|
+
* **Costly.** Every answer it cannot derive from an earlier one mounts
|
|
9
|
+
* a subtree and forces a style recalculation, measured at ~0.35 ms.
|
|
10
|
+
*
|
|
11
|
+
* An animation that has not started holds its first keyframe and one
|
|
12
|
+
* that has finished holds its last, so two timestamps whose animations
|
|
13
|
+
* all sit in matching phases resolve to the same computed styles.
|
|
14
|
+
* Anything mid-run, repeating forever, or reporting timing that cannot
|
|
15
|
+
* be read is answered `null`.
|
|
16
|
+
*
|
|
17
|
+
* A reading is reused for as long as it decides the question on its
|
|
18
|
+
* own, scoped to `classFingerprint`: two timestamps sharing one match
|
|
19
|
+
* the same rules, so their animations can differ only in where the
|
|
20
|
+
* clocks stand.
|
|
21
|
+
*
|
|
22
|
+
* Nothing is reused until a second reading has confirmed the first
|
|
23
|
+
* predicted it. A stylesheet doing arithmetic on a clock moves its
|
|
24
|
+
* phase boundaries at a different rate than the timestamp, and a single
|
|
25
|
+
* reading cannot tell that apart from a clock followed exactly.
|
|
26
|
+
*/
|
|
27
|
+
export class SubtreeMountAnimationStateFingerprint {
|
|
28
|
+
wrapperRenderer;
|
|
29
|
+
support;
|
|
30
|
+
width;
|
|
31
|
+
height;
|
|
32
|
+
readingByKey = new Map();
|
|
33
|
+
confirmedKeys = new Set();
|
|
34
|
+
alwaysMount = new Set();
|
|
35
|
+
nextElementUid = 0;
|
|
36
|
+
constructor(wrapperRenderer, support, width, height) {
|
|
37
|
+
this.wrapperRenderer = wrapperRenderer;
|
|
38
|
+
this.support = support;
|
|
39
|
+
this.width = width;
|
|
40
|
+
this.height = height;
|
|
41
|
+
}
|
|
42
|
+
async at(style, seg, t, indexInSection, classFingerprint) {
|
|
43
|
+
if (!this.support.isAvailable())
|
|
44
|
+
return null;
|
|
45
|
+
const key = `${style.kind}|${seg.id}|${classFingerprint}`;
|
|
46
|
+
const remembered = this.readingByKey.get(key);
|
|
47
|
+
if (remembered && this.confirmedKeys.has(key) && remembered.answersAt(t)) {
|
|
48
|
+
return remembered.phaseKeyAt(t);
|
|
49
|
+
}
|
|
50
|
+
const reading = await this.read(style, seg, t, indexInSection);
|
|
51
|
+
if (reading === null) {
|
|
52
|
+
this.retire(key);
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
if (remembered && !remembered.predicts(reading)) {
|
|
56
|
+
this.retire(key);
|
|
57
|
+
return reading.phaseKeyAt(t);
|
|
58
|
+
}
|
|
59
|
+
if (!this.alwaysMount.has(key)) {
|
|
60
|
+
if (remembered)
|
|
61
|
+
this.confirmedKeys.add(key);
|
|
62
|
+
this.readingByKey.set(key, reading);
|
|
63
|
+
}
|
|
64
|
+
return reading.phaseKeyAt(t);
|
|
65
|
+
}
|
|
66
|
+
retire(key) {
|
|
67
|
+
this.alwaysMount.add(key);
|
|
68
|
+
this.confirmedKeys.delete(key);
|
|
69
|
+
this.readingByKey.delete(key);
|
|
70
|
+
}
|
|
71
|
+
async read(style, seg, t, indexInSection) {
|
|
72
|
+
const { html } = await profiler.time('SubtreeMountAnimationStateFingerprint.build', () => this.wrapperRenderer.buildWrapperHtml(style, seg, t, indexInSection, () => this.nextElementUid++));
|
|
73
|
+
const effects = profiler.time('SubtreeMountAnimationStateFingerprint.read', () => this.readMounted(style, html));
|
|
74
|
+
return effects === null ? null : new SubtreeAnimationReading(effects, t);
|
|
75
|
+
}
|
|
76
|
+
readMounted(style, html) {
|
|
77
|
+
const host = document.createElement('div');
|
|
78
|
+
// Sized like the container a render paints into, so a rule reading
|
|
79
|
+
// a container-relative length resolves it to the same value here.
|
|
80
|
+
host.style.cssText = `position:relative;width:${this.width}px;height:${this.height}px;overflow:hidden;container-type:size;`;
|
|
81
|
+
host.innerHTML = html;
|
|
82
|
+
style.probeContainer.appendChild(host);
|
|
83
|
+
try {
|
|
84
|
+
return this.collectEffects(host);
|
|
85
|
+
}
|
|
86
|
+
finally {
|
|
87
|
+
style.probeContainer.removeChild(host);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
collectEffects(host) {
|
|
91
|
+
const effects = [];
|
|
92
|
+
for (const animation of host.getAnimations({ subtree: true })) {
|
|
93
|
+
const timing = this.timingOf(animation);
|
|
94
|
+
if (timing === null)
|
|
95
|
+
return null;
|
|
96
|
+
const address = this.addressOf(animation, host);
|
|
97
|
+
if (address === null)
|
|
98
|
+
return null;
|
|
99
|
+
effects.push({ address, rule: this.ruleOf(animation), ...timing });
|
|
100
|
+
}
|
|
101
|
+
return effects;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* When the effect's active phase opens relative to the playhead, and
|
|
105
|
+
* how long it lasts — `null` for either where the browser reports
|
|
106
|
+
* timing this cannot read as plain milliseconds.
|
|
107
|
+
*/
|
|
108
|
+
timingOf(animation) {
|
|
109
|
+
const effect = animation.effect;
|
|
110
|
+
if (!effect)
|
|
111
|
+
return null;
|
|
112
|
+
const timing = effect.getComputedTiming();
|
|
113
|
+
const delayMs = this.milliseconds(timing.delay);
|
|
114
|
+
const localTimeMs = this.milliseconds(timing.localTime);
|
|
115
|
+
if (delayMs === null || localTimeMs === null)
|
|
116
|
+
return null;
|
|
117
|
+
return {
|
|
118
|
+
startsInMs: delayMs - localTimeMs,
|
|
119
|
+
activeDurationMs: this.milliseconds(timing.activeDuration),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Where the effect lands, as the child-index path down from `host`
|
|
124
|
+
* plus the pseudo-element it targets. Two subtrees agree on it only
|
|
125
|
+
* when the same node in the same position carries the same effect.
|
|
126
|
+
*/
|
|
127
|
+
addressOf(animation, host) {
|
|
128
|
+
const effect = animation.effect;
|
|
129
|
+
if (!(effect instanceof KeyframeEffect) || effect.target === null)
|
|
130
|
+
return null;
|
|
131
|
+
const path = [];
|
|
132
|
+
for (let element = effect.target; element !== host;) {
|
|
133
|
+
const parent = element.parentElement;
|
|
134
|
+
if (parent === null)
|
|
135
|
+
return null;
|
|
136
|
+
path.push([...parent.children].indexOf(element));
|
|
137
|
+
element = parent;
|
|
138
|
+
}
|
|
139
|
+
return `${path.reverse().join('.')}${effect.pseudoElement ?? ''}`;
|
|
140
|
+
}
|
|
141
|
+
/** The `@keyframes` rule behind the effect where the browser names one. */
|
|
142
|
+
ruleOf(animation) {
|
|
143
|
+
if (!('animationName' in animation))
|
|
144
|
+
return animation.id;
|
|
145
|
+
const name = animation.animationName;
|
|
146
|
+
return typeof name === 'string' ? name : animation.id;
|
|
147
|
+
}
|
|
148
|
+
/** A timing figure as finite milliseconds, or `null` where it is absent, infinite, or not a plain number. */
|
|
149
|
+
milliseconds(value) {
|
|
150
|
+
return typeof value === 'number' && Number.isFinite(value) ? value : null;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=SubtreeMountAnimationStateFingerprint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubtreeMountAnimationStateFingerprint.js","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/SubtreeMountAnimationStateFingerprint.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,uBAAuB,EAAoB,MAAM,qDAAqD,CAAC;AAChH,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,OAAO,qCAAqC;IAO7B;IACA;IACA;IACA;IATF,YAAY,GAAG,IAAI,GAAG,EAAmC,CAAC;IAC1D,aAAa,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,WAAW,GAAG,IAAI,GAAG,EAAU,CAAC;IACzC,cAAc,GAAG,CAAC,CAAC;IAE3B,YACmB,eAAuC,EACvC,OAAgC,EAChC,KAAa,EACb,MAAc;QAHd,oBAAe,GAAf,eAAe,CAAwB;QACvC,YAAO,GAAP,OAAO,CAAyB;QAChC,UAAK,GAAL,KAAK,CAAQ;QACb,WAAM,GAAN,MAAM,CAAQ;IAC9B,CAAC;IAEJ,KAAK,CAAC,EAAE,CACN,KAAoB,EACpB,GAAY,EACZ,CAAS,EACT,cAAsB,EACtB,gBAAwB;QAExB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE;YAAE,OAAO,IAAI,CAAC;QAC7C,MAAM,GAAG,GAAG,GAAG,K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derer';
|
|
3
|
+
/**
|
|
4
|
+
* Describes the filter markup a style paints at one timestamp, so two
|
|
5
|
+
* timestamps can be told apart before either of them is rendered.
|
|
6
|
+
*
|
|
7
|
+
* The description is that markup itself, produced by the same renderer
|
|
8
|
+
* the tile uses under a fixed id scope. Everything reaching the browser
|
|
9
|
+
* is therefore in the comparison by construction, including whatever a
|
|
10
|
+
* later change adds to it — a description assembled out of the inputs
|
|
11
|
+
* separately would go stale the day the renderer grew one more.
|
|
12
|
+
*
|
|
13
|
+
* Two answers are not markup:
|
|
14
|
+
*
|
|
15
|
+
* - `''` — the style declares no filters, so none of its pixels come
|
|
16
|
+
* from one.
|
|
17
|
+
* - `null` — the markup cannot be compared. A `var()` the scope left
|
|
18
|
+
* unresolved survives into the body and the document's CSS decides
|
|
19
|
+
* what it becomes, which is not visible from here; engine-injected
|
|
20
|
+
* variables are not layered in either, so a filter reading one lands
|
|
21
|
+
* in this case too. The caller must treat it as varying every frame.
|
|
22
|
+
*
|
|
23
|
+
* Rendering the markup costs far more than asking for it, and
|
|
24
|
+
* consecutive timestamps almost always resolve to the same one, so the
|
|
25
|
+
* answer given to a style is kept until that style's inputs change. The
|
|
26
|
+
* inputs are the values the scope resolves for the names these bodies
|
|
27
|
+
* read plus the length factors, which is what the markup is a function
|
|
28
|
+
* of — a filter reading a per-frame tick therefore misses every time,
|
|
29
|
+
* and pays exactly what it would have without the cache.
|
|
30
|
+
*/
|
|
31
|
+
export declare class SvgFilterStateFingerprint {
|
|
32
|
+
private readonly defsRenderer;
|
|
33
|
+
private readonly renderHeightPx;
|
|
34
|
+
private readonly lastAnswerByStyle;
|
|
35
|
+
constructor(defsRenderer: SvgFilterDefsRenderer, renderHeightPx: number);
|
|
36
|
+
at(styleKind: string, filters: SvgFilterBundle, t: number): string | null;
|
|
37
|
+
private render;
|
|
38
|
+
/**
|
|
39
|
+
* The values the markup is built from, in a form where two different
|
|
40
|
+
* sets of them cannot read as the same text. Encoded rather than
|
|
41
|
+
* joined: a scope holds whatever a style control was given, so no
|
|
42
|
+
* separator can be assumed absent from it, and `null` says a name is
|
|
43
|
+
* unresolved without colliding with a name resolved to nothing.
|
|
44
|
+
*/
|
|
45
|
+
private describeInputs;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=SvgFilterStateFingerprint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SvgFilterStateFingerprint.d.ts","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/SvgFilterStateFingerprint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAE3E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AAavF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,yBAAyB;IAIlC,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAJjC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAiC;gBAGhD,YAAY,EAAE,qBAAqB,EACnC,cAAc,EAAE,MAAM;IAGzC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAezE,OAAO,CAAC,MAAM;IASd;;;;;;OAMG;IACH,OAAO,CAAC,cAAc;CAQvB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
const COMPARISON_SCOPE_KEY = 'fingerprint';
|
|
2
|
+
const UNRESOLVED_REFERENCE = 'var(';
|
|
3
|
+
/**
|
|
4
|
+
* Describes the filter markup a style paints at one timestamp, so two
|
|
5
|
+
* timestamps can be told apart before either of them is rendered.
|
|
6
|
+
*
|
|
7
|
+
* The description is that markup itself, produced by the same renderer
|
|
8
|
+
* the tile uses under a fixed id scope. Everything reaching the browser
|
|
9
|
+
* is therefore in the comparison by construction, including whatever a
|
|
10
|
+
* later change adds to it — a description assembled out of the inputs
|
|
11
|
+
* separately would go stale the day the renderer grew one more.
|
|
12
|
+
*
|
|
13
|
+
* Two answers are not markup:
|
|
14
|
+
*
|
|
15
|
+
* - `''` — the style declares no filters, so none of its pixels come
|
|
16
|
+
* from one.
|
|
17
|
+
* - `null` — the markup cannot be compared. A `var()` the scope left
|
|
18
|
+
* unresolved survives into the body and the document's CSS decides
|
|
19
|
+
* what it becomes, which is not visible from here; engine-injected
|
|
20
|
+
* variables are not layered in either, so a filter reading one lands
|
|
21
|
+
* in this case too. The caller must treat it as varying every frame.
|
|
22
|
+
*
|
|
23
|
+
* Rendering the markup costs far more than asking for it, and
|
|
24
|
+
* consecutive timestamps almost always resolve to the same one, so the
|
|
25
|
+
* answer given to a style is kept until that style's inputs change. The
|
|
26
|
+
* inputs are the values the scope resolves for the names these bodies
|
|
27
|
+
* read plus the length factors, which is what the markup is a function
|
|
28
|
+
* of — a filter reading a per-frame tick therefore misses every time,
|
|
29
|
+
* and pays exactly what it would have without the cache.
|
|
30
|
+
*/
|
|
31
|
+
export class SvgFilterStateFingerprint {
|
|
32
|
+
defsRenderer;
|
|
33
|
+
renderHeightPx;
|
|
34
|
+
lastAnswerByStyle = new Map();
|
|
35
|
+
constructor(defsRenderer, renderHeightPx) {
|
|
36
|
+
this.defsRenderer = defsRenderer;
|
|
37
|
+
this.renderHeightPx = renderHeightPx;
|
|
38
|
+
}
|
|
39
|
+
at(styleKind, filters, t) {
|
|
40
|
+
if (filters.definitions.isEmpty())
|
|
41
|
+
return '';
|
|
42
|
+
const context = { currentTime: t, renderHeightPx: this.renderHeightPx };
|
|
43
|
+
const scope = filters.scopeProvider.scopeAt(context);
|
|
44
|
+
const lengthFactors = filters.scopeProvider.lengthFactorsAt(context);
|
|
45
|
+
const inputs = this.describeInputs(filters.definitions, scope, lengthFactors);
|
|
46
|
+
const last = this.lastAnswerByStyle.get(styleKind);
|
|
47
|
+
if (last && last.inputs === inputs)
|
|
48
|
+
return last.markup;
|
|
49
|
+
const markup = this.render(filters.definitions, scope, lengthFactors);
|
|
50
|
+
this.lastAnswerByStyle.set(styleKind, { inputs, markup });
|
|
51
|
+
return markup;
|
|
52
|
+
}
|
|
53
|
+
render(definitions, scope, lengthFactors) {
|
|
54
|
+
const { defs } = this.defsRenderer.render(definitions, scope, lengthFactors, COMPARISON_SCOPE_KEY);
|
|
55
|
+
return defs.includes(UNRESOLVED_REFERENCE) ? null : defs;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The values the markup is built from, in a form where two different
|
|
59
|
+
* sets of them cannot read as the same text. Encoded rather than
|
|
60
|
+
* joined: a scope holds whatever a style control was given, so no
|
|
61
|
+
* separator can be assumed absent from it, and `null` says a name is
|
|
62
|
+
* unresolved without colliding with a name resolved to nothing.
|
|
63
|
+
*/
|
|
64
|
+
describeInputs(definitions, scope, lengthFactors) {
|
|
65
|
+
const values = definitions.variableNames().map((name) => scope.resolve(name) ?? null);
|
|
66
|
+
return JSON.stringify([lengthFactors.pxPerEm, lengthFactors.pxPerCqh, values]);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=SvgFilterStateFingerprint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SvgFilterStateFingerprint.js","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/SvgFilterStateFingerprint.ts"],"names":[],"mappings":"AAMA,MAAM,oBAAoB,GAAG,aAAa,CAAC;AAC3C,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAQpC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,OAAO,yBAAyB;IAIjB;IACA;IAJF,iBAAiB,GAAG,IAAI,GAAG,EAAsB,CAAC;IAEnE,YACmB,YAAmC,EACnC,cAAsB;QADtB,iBAAY,GAAZ,YAAY,CAAuB;QACnC,mBAAc,GAAd,cAAc,CAAQ;IACtC,CAAC;IAEJ,EAAE,CAAC,SAAiB,EAAE,OAAwB,EAAE,C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AG,WAAW,CAAC,aAAa,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC;QACtF,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,aAAa,CAAC,OAAO,EAAE,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;IACjF,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AnimationStateFingerprint } from '../../rendering/subtitle/AnimationStateFingerprint';
|
|
2
|
+
/**
|
|
3
|
+
* Describes nothing, at any timestamp: no two states are ever
|
|
4
|
+
* comparable. Reads no CSS and mounts nothing.
|
|
5
|
+
*/
|
|
6
|
+
export declare class UnknownAnimationStateFingerprint implements AnimationStateFingerprint {
|
|
7
|
+
at(): Promise<string | null>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=UnknownAnimationStateFingerprint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnknownAnimationStateFingerprint.d.ts","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/UnknownAnimationStateFingerprint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAEvG;;;GAGG;AACH,qBAAa,gCAAiC,YAAW,yBAAyB;IAChF,EAAE,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAG7B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Describes nothing, at any timestamp: no two states are ever
|
|
3
|
+
* comparable. Reads no CSS and mounts nothing.
|
|
4
|
+
*/
|
|
5
|
+
export class UnknownAnimationStateFingerprint {
|
|
6
|
+
at() {
|
|
7
|
+
return Promise.resolve(null);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=UnknownAnimationStateFingerprint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnknownAnimationStateFingerprint.js","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/UnknownAnimationStateFingerprint.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,OAAO,gCAAgC;IAC3C,EAAE;QACA,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoFrameVarsBuilder.d.ts","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/VideoFrameVarsBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAE9E,OAAO,KAAK,EAAE,gBAAgB,EAAoB,MAAM,2CAA2C,CAAC;AACpG,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AACvG,OAAO,KAAK,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,wDAAwD,CAAC;AACjI,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AACnG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"VideoFrameVarsBuilder.d.ts","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/VideoFrameVarsBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAE9E,OAAO,KAAK,EAAE,gBAAgB,EAAoB,MAAM,2CAA2C,CAAC;AACpG,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AACvG,OAAO,KAAK,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,wDAAwD,CAAC;AACjI,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AACnG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAW/E;;;;;;;;;;GAUG;AACH,qBAAa,qBAAqB;IAG9B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBALhB,cAAc,EAAE,yBAAyB,EACzC,mBAAmB,EAAE,0BAA0B,EAC/C,gBAAgB,EAAE,uBAAuB,EACzC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,gBAAgB,GAAG,IAAI;IAGtD,KAAK,CACT,KAAK,EAAE,aAAa,EACpB,GAAG,EAAE,OAAO,EACZ,SAAS,EAAE,sBAAsB,EACjC,CAAC,EAAE,MAAM,GACR,OAAO,CAAC,cAAc,CAAC;IAsB1B;;;;;;;;OAQG;IACH,OAAO,CAAC,kBAAkB;IAY1B,OAAO,CAAC,yBAAyB;IA6CjC,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,uBAAuB;CAShC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CssVariable } from '../../document/CssVariable';
|
|
2
|
+
import { ElementWidths } from '../../rendering/subtitle/ElementWidths';
|
|
2
3
|
import { profiler } from '../../profiling/Profiler';
|
|
3
4
|
const NO_EXCLUDED_WORDS = new Set();
|
|
4
5
|
// Safety bleed applied to the painted region for video-frame styles
|
|
@@ -83,6 +84,7 @@ export class VideoFrameVarsBuilder {
|
|
|
83
84
|
// stylesheet addresses: a rule targeting one element can change
|
|
84
85
|
// its box, and a region measured without it would be wrong.
|
|
85
86
|
addressableElementIds: style.addressableElementIds,
|
|
87
|
+
elementWidths: ElementWidths.empty(),
|
|
86
88
|
inlineStyleEmitter: style.inlineStyleEmitter,
|
|
87
89
|
}, seg, seg.time.start, NO_EXCLUDED_WORDS,
|
|
88
90
|
// Paint-region measurement renders the segment in isolation; the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoFrameVarsBuilder.js","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/VideoFrameVarsBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAQ5D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,MAAM,iBAAiB,GAAwB,IAAI,GAAG,EAAE,CAAC;AAEzD,oEAAoE;AACpE,qEAAqE;AACrE,iEAAiE;AACjE,MAAM,4BAA4B,GAAG,IAAI,CAAC;AAE1C;;;;;;;;;;GAUG;AACH,MAAM,OAAO,qBAAqB;IAGb;IACA;IACA;IACA;IACA;IACA;IANnB,YACmB,cAAyC,EACzC,mBAA+C,EAC/C,gBAAyC,EACzC,KAAa,EACb,MAAc,EACd,gBAAyC;QALzC,mBAAc,GAAd,cAAc,CAA2B;QACzC,wBAAmB,GAAnB,mBAAmB,CAA4B;QAC/C,qBAAgB,GAAhB,gBAAgB,CAAyB;QACzC,UAAK,GAAL,KAAK,CAAQ;QACb,WAAM,GAAN,MAAM,CAAQ;QACd,qBAAgB,GAAhB,gBAAgB,CAAyB;IACzD,CAAC;IAEJ,KAAK,CAAC,KAAK,CACT,KAAoB,EACpB,GAAY,EACZ,SAAiC,EACjC,CAAS;QAET,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,QAAQ;YAAE,OAAO,EAAE,CAAC;QACpD,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,mCAAmC,EAAE,GAAG,EAAE,CACrE,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS,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MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;gBAC9B,IAAI,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,SAAS;oBAAE,OAAO,IAAI,CAAC;YACzD,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAEO,uBAAuB,CAAC,GAAY,EAAE,KAAoB;QAChE,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;YAC7B,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;gBAC9B,IAAI,CAAC,IAAI,CAAC,UAAU;oBAAE,SAAS;gBAC/B,IAAI,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,SAAS;oBAAE,OAAO,IAAI,CAAC;YAC1E,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -11,6 +11,8 @@ export declare class ElementRenderOverrides {
|
|
|
11
11
|
private constructor();
|
|
12
12
|
isEmpty(): boolean;
|
|
13
13
|
get(elementId: string): ScopedRenderOverride | undefined;
|
|
14
|
+
/** Every override held, for a consumer that has to look at all of them rather than one. */
|
|
15
|
+
values(): Iterable<ScopedRenderOverride>;
|
|
14
16
|
/**
|
|
15
17
|
* A new instance layering `other` over this one: elements present in
|
|
16
18
|
* only one side keep their entry; for elements present in both,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElementRenderOverrides.d.ts","sourceRoot":"","sources":["../../../../src/modules/rendering/types/ElementRenderOverrides.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AAE1F;;;;GAIG;AACH,qBAAa,sBAAsB;IAY/B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAX1B,MAAM,CAAC,KAAK,IAAI,sBAAsB;IAItC,MAAM,CAAC,WAAW,CAChB,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,GAC9D,sBAAsB;IAIzB,OAAO;IAIP,OAAO,IAAI,OAAO;IAIlB,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS;IAIxD;;;;;OAKG;IACH,UAAU,CAAC,KAAK,EAAE,sBAAsB,GAAG,sBAAsB;IAWjE,OAAO,CAAC,aAAa;CAUtB"}
|
|
1
|
+
{"version":3,"file":"ElementRenderOverrides.d.ts","sourceRoot":"","sources":["../../../../src/modules/rendering/types/ElementRenderOverrides.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AAE1F;;;;GAIG;AACH,qBAAa,sBAAsB;IAY/B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAX1B,MAAM,CAAC,KAAK,IAAI,sBAAsB;IAItC,MAAM,CAAC,WAAW,CAChB,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,GAC9D,sBAAsB;IAIzB,OAAO;IAIP,OAAO,IAAI,OAAO;IAIlB,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS;IAIxD,2FAA2F;IAC3F,MAAM,IAAI,QAAQ,CAAC,oBAAoB,CAAC;IAIxC;;;;;OAKG;IACH,UAAU,CAAC,KAAK,EAAE,sBAAsB,GAAG,sBAAsB;IAWjE,OAAO,CAAC,aAAa;CAUtB"}
|
|
@@ -20,6 +20,10 @@ export class ElementRenderOverrides {
|
|
|
20
20
|
get(elementId) {
|
|
21
21
|
return this.entries.get(elementId);
|
|
22
22
|
}
|
|
23
|
+
/** Every override held, for a consumer that has to look at all of them rather than one. */
|
|
24
|
+
values() {
|
|
25
|
+
return this.entries.values();
|
|
26
|
+
}
|
|
23
27
|
/**
|
|
24
28
|
* A new instance layering `other` over this one: elements present in
|
|
25
29
|
* only one side keep their entry; for elements present in both,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ElementRenderOverrides.js","sourceRoot":"","sources":["../../../../src/modules/rendering/types/ElementRenderOverrides.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,OAAO,sBAAsB;IAYd;IAXnB,MAAM,CAAC,KAAK;QACV,OAAO,IAAI,sBAAsB,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED,MAAM,CAAC,WAAW,CAChB,OAA+D;QAE/D,OAAO,IAAI,sBAAsB,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IACtD,CAAC;IAED,YACmB,OAAkD;QAAlD,YAAO,GAAP,OAAO,CAA2C;IAClE,CAAC;IAEJ,OAAO;QACL,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,CAAC;IACjC,CAAC;IAED,GAAG,CAAC,SAAiB;QACnB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACrC,CAAC;IAED;;;;;OAKG;IACH,UAAU,CAAC,KAA6B;QACtC,IAAI,KAAK,CAAC,OAAO,EAAE;YAAE,OAAO,IAAI,CAAC;QACjC,IAAI,IAAI,CAAC,OAAO,EAAE;YAAE,OAAO,KAAK,CAAC;QACjC,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACrC,KAAK,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;YAClD,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YACnC,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QAC9E,CAAC;QACD,OAAO,IAAI,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;IAEO,aAAa,CAAC,IAA0B,EAAE,KAA2B;QAC3E,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,IAAI,KAAK,CAAC,YAAY;YAC1D,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,YAAY,EAAE,GAAG,KAAK,CAAC,YAAY,EAAE;YACjD,CAAC,CAAC,SAAS,CAAC;QACd,OAAO;YACL,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACzC,GAAG,CAAC,CAAC,KAAK,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAChG,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACvF,CAAC;IACJ,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"ElementRenderOverrides.js","sourceRoot":"","sources":["../../../../src/modules/rendering/types/ElementRenderOverrides.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,OAAO,sBAAsB;IAYd;IAXnB,MAAM,CAAC,KAAK;QACV,OAAO,IAAI,sBAAsB,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED,MAAM,CAAC,WAAW,CAChB,OAA+D;QAE/D,OAAO,IAAI,sBAAsB,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IACtD,CAAC;IAED,YACmB,OAAkD;QAAlD,YAAO,GAAP,OAAO,CAA2C;IAClE,CAAC;IAEJ,OAAO;QACL,OAA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S,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAChG,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACvF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -4,12 +4,20 @@ export interface BalancedLineSplitterConfig {
|
|
|
4
4
|
maxLines: number;
|
|
5
5
|
minLines: number;
|
|
6
6
|
maxCharsPerLine: number;
|
|
7
|
+
/** Shortest line a break may produce; `0` accepts every break. */
|
|
8
|
+
minCharsPerLine?: number;
|
|
7
9
|
}
|
|
8
10
|
/**
|
|
9
11
|
* BalancedLineSplitter implements a line-breaking strategy that aims to distribute
|
|
10
12
|
* words across lines in a way that minimizes the difference in character count
|
|
11
13
|
* between lines, while respecting specified constraints on maximum lines,
|
|
12
14
|
* minimum lines, and maximum characters per line.
|
|
15
|
+
*
|
|
16
|
+
* `maxCharsPerLine` sets how many lines to aim for and `minCharsPerLine`
|
|
17
|
+
* vetoes the result: a split leaving any line under the floor is dropped
|
|
18
|
+
* in favour of one line fewer, down to a single line. `minLines` outranks
|
|
19
|
+
* the floor, so a caller asking for two lines gets two even where no
|
|
20
|
+
* split reaches it.
|
|
13
21
|
*/
|
|
14
22
|
export declare class BalancedLineSplitter implements LineSplitter {
|
|
15
23
|
private readonly _config;
|
|
@@ -17,6 +25,7 @@ export declare class BalancedLineSplitter implements LineSplitter {
|
|
|
17
25
|
split(segments: ReadonlyArray<Segment>): Segment[];
|
|
18
26
|
private splitSegment;
|
|
19
27
|
private buildLines;
|
|
28
|
+
private everyLineReachesMinChars;
|
|
20
29
|
private splitRecursive;
|
|
21
30
|
private adjustToMinLines;
|
|
22
31
|
private charCount;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BalancedLineSplitter.d.ts","sourceRoot":"","sources":["../../../src/modules/splitting/BalancedLineSplitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAIpD,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"BalancedLineSplitter.d.ts","sourceRoot":"","sources":["../../../src/modules/splitting/BalancedLineSplitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAIpD,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,kEAAkE;IAClE,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,oBAAqB,YAAW,YAAY;IAC3C,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,0BAA0B;IAEhE,KAAK,CAAC,QAAQ,EAAE,aAAa,CAAC,OAAO,CAAC,GAAG,OAAO,EAAE;IAIlD,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,UAAU;IAclB,OAAO,CAAC,wBAAwB;IAKhC,OAAO,CAAC,cAAc;IA6BtB,OAAO,CAAC,gBAAgB;IAoBxB,OAAO,CAAC,SAAS;CAGlB"}
|
|
@@ -4,6 +4,12 @@ import { Line } from '../document/Line';
|
|
|
4
4
|
* words across lines in a way that minimizes the difference in character count
|
|
5
5
|
* between lines, while respecting specified constraints on maximum lines,
|
|
6
6
|
* minimum lines, and maximum characters per line.
|
|
7
|
+
*
|
|
8
|
+
* `maxCharsPerLine` sets how many lines to aim for and `minCharsPerLine`
|
|
9
|
+
* vetoes the result: a split leaving any line under the floor is dropped
|
|
10
|
+
* in favour of one line fewer, down to a single line. `minLines` outranks
|
|
11
|
+
* the floor, so a caller asking for two lines gets two even where no
|
|
12
|
+
* split reaches it.
|
|
7
13
|
*/
|
|
8
14
|
export class BalancedLineSplitter {
|
|
9
15
|
_config;
|
|
@@ -26,10 +32,16 @@ export class BalancedLineSplitter {
|
|
|
26
32
|
const totalChars = this.charCount(words);
|
|
27
33
|
const linesNeeded = Math.ceil(totalChars / maxCharsPerLine);
|
|
28
34
|
const targetLines = Math.min(linesNeeded, maxLines);
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
for (let lines = targetLines; lines > 1; lines--) {
|
|
36
|
+
const candidate = this.splitRecursive(words, lines);
|
|
37
|
+
if (this.everyLineReachesMinChars(candidate))
|
|
38
|
+
return candidate;
|
|
31
39
|
}
|
|
32
|
-
return
|
|
40
|
+
return [new Line({ words })];
|
|
41
|
+
}
|
|
42
|
+
everyLineReachesMinChars(lines) {
|
|
43
|
+
const minCharsPerLine = this._config.minCharsPerLine ?? 0;
|
|
44
|
+
return lines.every((line) => this.charCount([...line.words]) >= minCharsPerLine);
|
|
33
45
|
}
|
|
34
46
|
splitRecursive(words, linesLeft) {
|
|
35
47
|
if (linesLeft <= 1 || words.length === 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BalancedLineSplitter.js","sourceRoot":"","sources":["../../../src/modules/splitting/BalancedLineSplitter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"BalancedLineSplitter.js","sourceRoot":"","sources":["../../../src/modules/splitting/BalancedLineSplitter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI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