@braccato/core 1.22.0 → 2.0.0-beta.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.
Files changed (102) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +211 -600
  3. package/js/element.js +234 -0
  4. package/js/renderer.d.ts +157 -0
  5. package/js/renderer.js +535 -0
  6. package/package.json +22 -17
  7. package/pkg/braccato_core_rs.d.ts +236 -0
  8. package/pkg/braccato_core_rs.js +1735 -0
  9. package/pkg/braccato_core_rs_bg.wasm +0 -0
  10. package/pkg/braccato_core_rs_bg.wasm.d.ts +55 -0
  11. package/dist/LICENSE +0 -21
  12. package/dist/README.md +0 -639
  13. package/dist/element.d.ts +0 -168
  14. package/dist/element.js +0 -730
  15. package/dist/engine/animationConfig.d.ts +0 -84
  16. package/dist/engine/animationConfig.js +0 -95
  17. package/dist/engine/animationDrift.d.ts +0 -11
  18. package/dist/engine/animationDrift.js +0 -43
  19. package/dist/engine/animationTiming.d.ts +0 -27
  20. package/dist/engine/animationTiming.js +0 -145
  21. package/dist/engine/autoScroll.d.ts +0 -24
  22. package/dist/engine/autoScroll.js +0 -103
  23. package/dist/engine/clock.d.ts +0 -29
  24. package/dist/engine/clock.js +0 -70
  25. package/dist/engine/contextSweep.d.ts +0 -10
  26. package/dist/engine/contextSweep.js +0 -102
  27. package/dist/engine/cssValues.d.ts +0 -13
  28. package/dist/engine/cssValues.js +0 -47
  29. package/dist/engine/culling.d.ts +0 -6
  30. package/dist/engine/culling.js +0 -76
  31. package/dist/engine/debugOverlay.d.ts +0 -14
  32. package/dist/engine/debugOverlay.js +0 -58
  33. package/dist/engine/decorationSlides.d.ts +0 -6
  34. package/dist/engine/decorationSlides.js +0 -53
  35. package/dist/engine/elementMotion.d.ts +0 -18
  36. package/dist/engine/elementMotion.js +0 -98
  37. package/dist/engine/glow.d.ts +0 -7
  38. package/dist/engine/glow.js +0 -59
  39. package/dist/engine/instance.d.ts +0 -105
  40. package/dist/engine/instance.js +0 -89
  41. package/dist/engine/instrumentalAnimations.d.ts +0 -7
  42. package/dist/engine/instrumentalAnimations.js +0 -59
  43. package/dist/engine/letterPlans.d.ts +0 -31
  44. package/dist/engine/letterPlans.js +0 -62
  45. package/dist/engine/lineAnimationState.d.ts +0 -10
  46. package/dist/engine/lineAnimationState.js +0 -82
  47. package/dist/engine/lineAnimations.d.ts +0 -5
  48. package/dist/engine/lineAnimations.js +0 -63
  49. package/dist/engine/lineLifecycle.d.ts +0 -12
  50. package/dist/engine/lineLifecycle.js +0 -92
  51. package/dist/engine/lineScroll.d.ts +0 -47
  52. package/dist/engine/lineScroll.js +0 -184
  53. package/dist/engine/lineScrollStyle.d.ts +0 -32
  54. package/dist/engine/lineScrollStyle.js +0 -133
  55. package/dist/engine/liveViews.d.ts +0 -3
  56. package/dist/engine/liveViews.js +0 -5
  57. package/dist/engine/motionCurves.d.ts +0 -19
  58. package/dist/engine/motionCurves.js +0 -85
  59. package/dist/engine/motionPreference.d.ts +0 -1
  60. package/dist/engine/motionPreference.js +0 -1
  61. package/dist/engine/passiveScroll.d.ts +0 -10
  62. package/dist/engine/passiveScroll.js +0 -93
  63. package/dist/engine/renderedLines.d.ts +0 -16
  64. package/dist/engine/renderedLines.js +0 -130
  65. package/dist/engine/scrollViewport.d.ts +0 -36
  66. package/dist/engine/scrollViewport.js +0 -104
  67. package/dist/engine/stageMotion.d.ts +0 -7
  68. package/dist/engine/stageMotion.js +0 -319
  69. package/dist/engine/sweepPlans.d.ts +0 -38
  70. package/dist/engine/sweepPlans.js +0 -66
  71. package/dist/engine/tick.d.ts +0 -16
  72. package/dist/engine/tick.js +0 -270
  73. package/dist/engine/timingLogs.d.ts +0 -7
  74. package/dist/engine/timingLogs.js +0 -81
  75. package/dist/engine/userScroll.d.ts +0 -12
  76. package/dist/engine/userScroll.js +0 -62
  77. package/dist/engine/wavePool.d.ts +0 -7
  78. package/dist/engine/wavePool.js +0 -22
  79. package/dist/engine/wordAnimations.d.ts +0 -5
  80. package/dist/engine/wordAnimations.js +0 -206
  81. package/dist/imageHighlights.d.ts +0 -4
  82. package/dist/imageHighlights.js +0 -34
  83. package/dist/index.d.ts +0 -17
  84. package/dist/index.js +0 -12
  85. package/dist/inject.d.ts +0 -98
  86. package/dist/inject.js +0 -591
  87. package/dist/instrumental.d.ts +0 -11
  88. package/dist/instrumental.js +0 -121
  89. package/dist/language.d.ts +0 -9
  90. package/dist/language.js +0 -47
  91. package/dist/letters.d.ts +0 -2
  92. package/dist/letters.js +0 -25
  93. package/dist/renderer.d.ts +0 -29
  94. package/dist/renderer.js +0 -412
  95. package/dist/seek.d.ts +0 -1
  96. package/dist/seek.js +0 -27
  97. package/dist/stage.d.ts +0 -58
  98. package/dist/stage.js +0 -121
  99. package/dist/types.d.ts +0 -236
  100. package/dist/types.js +0 -1
  101. package/dist/view.d.ts +0 -51
  102. package/dist/view.js +0 -398
@@ -1,206 +0,0 @@
1
- import { RTL_CLASS } from "../constants.js";
2
- import { registerThemeSetting } from "../themeSettings.js";
3
- import { correctedAnimationTimeMs, followSongClock, mirrorHighlightAnimations, seekAnimation } from "./animationTiming.js";
4
- import { GECKO_REDRAW, GECKO_REDRAW_KEYFRAMES, GECKO_REDRAW_PERIOD_MS, LETTER_WAVE_CREST_OFFSET, planLetterWave, swipeRamp, } from "./letterPlans.js";
5
- import { resetPartAnimations } from "./lineAnimationState.js";
6
- import { planCellSweep } from "./sweepPlans.js";
7
- import { acquireWaveAnimation } from "./wavePool.js";
8
- const SWIPE_LEAD_RATIO = registerThemeSetting("blyrics-swipe-lead-ratio", 0.1);
9
- const SWIPE_DURATION_RATIO = registerThemeSetting("blyrics-swipe-duration-ratio", 1.6);
10
- const LINE_SYNCED_WORD_CLASS = "blyrics-line-synced-word";
11
- const INSTANT_MS = 1;
12
- // The sweep holds a word's reveal in its own layers, so the word's own opacity is all that animates on it.
13
- const SHOWN = [{ opacity: 1 }, { opacity: 1 }];
14
- const FADE_IN = [{ opacity: 0 }, { opacity: 1 }];
15
- export function startWordAnimations(engine, part, config, lyricTimeS, appliedTimingOffsetMs) {
16
- resetPartAnimations(part);
17
- const word = wordTimeline(engine, part, config, lyricTimeS, appliedTimingOffsetMs);
18
- const highlight = part.lyricElement.classList.contains(LINE_SYNCED_WORD_CLASS)
19
- ? lineSyncedHighlight(word)
20
- : richSyncedHighlight(word);
21
- const motion = config.enabled.wordWobble ? [...wobble(word), ...letterWave(word)] : [];
22
- part.animations = [...highlight, ...mirrorHighlightAnimations(part, highlight), ...motion];
23
- }
24
- export function startWordExitAnimation(part, config) {
25
- resetPartAnimations(part);
26
- const fades = config.enabled.highlightFade;
27
- const durationMs = fades ? config.highlight.fadeOutDurationMs : INSTANT_MS;
28
- const glowRest = glowShows(part, config) ? { filter: config.highlight.glowTo } : {};
29
- const fadeOut = part.highlightElement.animate([
30
- { opacity: 1, ...glowRest },
31
- { opacity: 0, ...glowRest },
32
- ], {
33
- duration: durationMs,
34
- easing: fades ? config.highlight.fadeOutEasing : "linear",
35
- fill: "none",
36
- });
37
- part.animations = [fadeOut, ...mirrorHighlightAnimations(part, [fadeOut])];
38
- fadeOut.addEventListener("finish", () => resetPartAnimations(part), { once: true });
39
- }
40
- function wordTimeline(engine, part, config, lyricTimeS, appliedTimingOffsetMs) {
41
- const durationMs = Math.max(0, part.duration * 1000);
42
- return {
43
- engine,
44
- part,
45
- config,
46
- appliedTimingOffsetMs,
47
- elapsedMs: (lyricTimeS - part.time) * 1000,
48
- durationMs,
49
- swipeLeadMs: durationMs * SWIPE_LEAD_RATIO.getNumberValue(),
50
- swipeDurationMs: durationMs * SWIPE_DURATION_RATIO.getNumberValue(),
51
- glowDurationMs: Math.max(durationMs * config.highlight.glowDurationRatio, config.highlight.glowMinDurationMs),
52
- };
53
- }
54
- function scheduledTimeMs(word, elapsedMs, durationMs) {
55
- return correctedAnimationTimeMs(elapsedMs, word.appliedTimingOffsetMs, durationMs);
56
- }
57
- function followSong(word, animation, currentTimeMs, { offsetMs = 0, skipDriftSample = false } = {}) {
58
- const { appliedTimingOffsetMs } = word;
59
- followSongClock(word.engine, animation, { appliedTimingOffsetMs, offsetMs, skipDriftSample });
60
- seekAnimation(word.engine, animation, currentTimeMs);
61
- return animation;
62
- }
63
- function glowShows(part, config) {
64
- return config.enabled.highlightGlow && !part.glowSuppressed;
65
- }
66
- function richSyncedHighlight(word) {
67
- const { part, config } = word;
68
- const animations = config.enabled.highlightSwipe ? swipe(word) : [];
69
- const show = part.highlightElement.animate(SHOWN, { duration: INSTANT_MS, easing: "linear", fill: "forwards" });
70
- animations.push(followSong(word, show, scheduledTimeMs(word, word.elapsedMs, INSTANT_MS)));
71
- if (glowShows(part, config))
72
- animations.push(glow(word, word.glowDurationMs));
73
- return animations;
74
- }
75
- function lineSyncedHighlight(word) {
76
- const { part, config } = word;
77
- const fades = config.enabled.highlightFade;
78
- const durationMs = fades ? config.highlight.fadeInDurationMs : INSTANT_MS;
79
- const fadeIn = part.highlightElement.animate(FADE_IN, {
80
- duration: durationMs,
81
- easing: fades ? config.highlight.fadeInEasing : "linear",
82
- fill: "forwards",
83
- });
84
- const animations = [followSong(word, fadeIn, scheduledTimeMs(word, word.elapsedMs, durationMs))];
85
- if (glowShows(part, config))
86
- animations.push(glow(word, config.highlight.glowMinDurationMs));
87
- return animations;
88
- }
89
- function swipe(word) {
90
- const { part, swipeLeadMs, swipeDurationMs } = word;
91
- const currentTimeMs = scheduledTimeMs(word, word.elapsedMs + swipeLeadMs, swipeDurationMs);
92
- return part.sweep ? compositedSwipe(word, part.sweep, currentTimeMs) : [];
93
- }
94
- /**
95
- * Slides each cell's mask from where the swipe begins back to its resting place and its text the other
96
- * way. Filled backwards because the resting pose is the lit one. Only the first mask's animation feeds
97
- * the drift check; the others carry the same timing and would repeat it.
98
- */
99
- function compositedSwipe(word, cells, currentTimeMs) {
100
- const { part, config, swipeLeadMs, swipeDurationMs } = word;
101
- const rtl = part.highlightElement.classList.contains(RTL_CLASS);
102
- const timing = {
103
- duration: swipeDurationMs,
104
- easing: config.highlight.swipeEasing,
105
- fill: "both",
106
- };
107
- const animations = [];
108
- cells.forEach((cell, index) => {
109
- const span = cell.span ?? { start: index / cells.length, width: 1 / cells.length };
110
- const plan = planCellSweep(swipeRamp(config), span, rtl);
111
- if (!plan)
112
- return;
113
- for (const [element, keyframes] of [
114
- [cell.mask, plan.mask],
115
- [cell.text, plan.text],
116
- ]) {
117
- const slide = element.animate(keyframes, timing);
118
- animations.push(followSong(word, slide, currentTimeMs, { offsetMs: swipeLeadMs, skipDriftSample: animations.length > 0 }));
119
- }
120
- });
121
- return animations;
122
- }
123
- function glow(word, durationMs) {
124
- const { part, config } = word;
125
- const keyframes = [{ filter: config.highlight.glowFrom }, { filter: config.highlight.glowTo }];
126
- const shrink = part.highlightElement.animate(keyframes, {
127
- duration: durationMs,
128
- easing: config.highlight.glowEasing,
129
- fill: config.highlight.glowRestingInvisible ? "none" : "forwards",
130
- });
131
- return followSong(word, shrink, scheduledTimeMs(word, word.elapsedMs, durationMs), { skipDriftSample: true });
132
- }
133
- function wobble(word) {
134
- const { wobbleFrom, wobblePeak, wobblePeakOffset, wobblePeakEasing, wobbleSettle, wobbleSettleOffset } = word.config.word;
135
- const { wobbleTo, wobbleEndEasing, wobbleDurationMs, wobbleEasing } = word.config.word;
136
- const keyframes = [
137
- { transform: wobbleFrom },
138
- { transform: wobblePeak, offset: wobblePeakOffset, easing: wobblePeakEasing },
139
- { transform: wobbleSettle, offset: Math.max(wobblePeakOffset, wobbleSettleOffset) },
140
- { transform: wobbleTo, easing: wobbleEndEasing },
141
- ];
142
- const timing = { duration: wobbleDurationMs, easing: wobbleEasing, fill: "forwards" };
143
- const currentTimeMs = scheduledTimeMs(word, word.elapsedMs, wobbleDurationMs);
144
- return word.part.wobbleElements.map(element => followSong(word, element.animate(keyframes, timing), currentTimeMs));
145
- }
146
- function letterWave(word) {
147
- const { part } = word;
148
- const letterCount = part.letterElements?.length ?? 0;
149
- if (letterCount === 0)
150
- return [];
151
- const run = planLetterWaveRun(word, letterCount);
152
- const animations = [];
153
- floatLetters(word, run, part.letterElements, true, animations);
154
- floatLetters(word, run, part.highlightLetterElements, false, animations);
155
- return animations;
156
- }
157
- function planLetterWaveRun(word, letterCount) {
158
- const { config } = word;
159
- const emphasise = word.part.lyricElement.dataset.longWord === "true";
160
- const emphasisPeak = emphasise ? ` scale(${config.letterWave.emphasisScale})` : "";
161
- const emphasisRest = emphasise ? " scale(1)" : "";
162
- const keyframes = [
163
- { transform: `translateY(0)${emphasisRest}`, easing: config.letterWave.riseEasing },
164
- {
165
- transform: `${config.letterWave.transform}${emphasisPeak}`,
166
- offset: LETTER_WAVE_CREST_OFFSET,
167
- easing: config.letterWave.fallEasing,
168
- },
169
- { transform: `${config.letterWave.settle}${emphasisRest}` },
170
- ];
171
- const waves = planLetterWave(swipeRamp(config), letterCount, word.durationMs, word.swipeDurationMs, word.swipeLeadMs, config.letterWave.durationMs);
172
- // Carry early starts in the clock offset; negative delays make finished waves appear late to drift sampling.
173
- const headStartMs = Math.max(0, -Math.min(...waves.map(wave => wave.delayMs)));
174
- const waveEndsMs = waves.map(wave => wave.delayMs + wave.durationMs);
175
- const lastWaveEndMs = Math.max(...waveEndsMs);
176
- return {
177
- waves,
178
- keyframes,
179
- signature: JSON.stringify(keyframes),
180
- headStartMs,
181
- lastEndingWaveIndex: waveEndsMs.lastIndexOf(lastWaveEndMs),
182
- startAtMs: scheduledTimeMs(word, word.elapsedMs + headStartMs, headStartMs + lastWaveEndMs),
183
- };
184
- }
185
- function floatLetters(word, run, letters, isBaseText, animations) {
186
- letters?.forEach((letterElement, index) => {
187
- const wave = run.waves[index];
188
- const delayMs = wave.delayMs + run.headStartMs;
189
- const float = acquireWaveAnimation(word.engine, letterElement, run.keyframes, run.signature, {
190
- duration: wave.durationMs,
191
- delay: delayMs,
192
- fill: "forwards",
193
- });
194
- const skipDriftSample = !isBaseText || index !== run.lastEndingWaveIndex;
195
- animations.push(followSong(word, float, run.startAtMs, { offsetMs: run.headStartMs, skipDriftSample }));
196
- if (!GECKO_REDRAW || !isBaseText)
197
- return;
198
- const redraw = letterElement.animate(GECKO_REDRAW_KEYFRAMES, {
199
- duration: GECKO_REDRAW_PERIOD_MS,
200
- iterations: wave.durationMs / GECKO_REDRAW_PERIOD_MS,
201
- delay: delayMs,
202
- composite: "add",
203
- });
204
- animations.push(followSong(word, redraw, run.startAtMs, { offsetMs: run.headStartMs, skipDriftSample: true }));
205
- });
206
- }
@@ -1,4 +0,0 @@
1
- export declare const imageHighlights: import("./themeSettings.js").Setting;
2
- /** A single CSS url(), not gradients or an arbitrary list of background layers. */
3
- export declare function imageURL(value: string): string | null;
4
- export declare function refreshInstrumentalImages(container: HTMLElement | null, view: Window): void;
@@ -1,34 +0,0 @@
1
- // Optional image paint for the instrumental note, independent of HDR: a theme supplies the image and
2
- // its dynamic range.
3
- import { registerThemeSetting } from "./themeSettings.js";
4
- export const imageHighlights = registerThemeSetting("blyrics-image-highlights", false, true);
5
- /** A single CSS url(), not gradients or an arbitrary list of background layers. */
6
- export function imageURL(value) {
7
- const match = /^url\(\s*(?:"([^"]*)"|'([^']*)'|([^\s'"()]+))\s*\)$/i.exec(value.trim());
8
- return match ? (match[1] ?? match[2] ?? match[3]) : null;
9
- }
10
- // SVG <image> follows the browser's normal image drawing path, including gain maps. feImage
11
- // and SVG patterns can rasterize through an SDR intermediate. Keep the original color path
12
- // available until loading succeeds, and whenever a theme's media query supplies no image.
13
- export function refreshInstrumentalImages(container, view) {
14
- if (!container || !imageHighlights.getBooleanValue())
15
- return;
16
- for (const svg of container.querySelectorAll(".blyrics--instrumental-icon")) {
17
- const image = svg.querySelector(".blyrics-instrumental-image");
18
- if (!image)
19
- continue;
20
- const source = imageURL(view.getComputedStyle(svg).getPropertyValue("--blyrics-highlight-image"));
21
- if (source === image.getAttribute("href"))
22
- continue;
23
- svg.removeAttribute("data-image-ready");
24
- image.onload = () => {
25
- if (image.getAttribute("href") === source)
26
- svg.setAttribute("data-image-ready", "");
27
- };
28
- image.onerror = () => svg.removeAttribute("data-image-ready");
29
- if (source)
30
- image.setAttribute("href", source);
31
- else
32
- image.removeAttribute("href");
33
- }
34
- }
package/dist/index.d.ts DELETED
@@ -1,17 +0,0 @@
1
- export { resetPlaybackClock } from "./engine/clock.js";
2
- export { resumeAllAutoscroll } from "./engine/userScroll.js";
3
- export { injectRomanization, injectTranslation, type LineData, removeRomanization, removeTranslation, } from "./inject.js";
4
- export { createLyricsRenderer } from "./renderer.js";
5
- export type { Lyric, LyricsRenderer, LyricsRendererHost, TickOptions } from "./types.js";
6
- /** @public */
7
- export type { AnimationTickStatus } from "./engine/tick.js";
8
- /** @public */
9
- export type { PartData } from "./inject.js";
10
- /** @public */
11
- export type { LyricPart, LyricsRendererDebugSink, LyricsRendererOptions, LyricSyncType } from "./types.js";
12
- /** @public */
13
- export type { SetLyricsOptions } from "./view.js";
14
- /** @public */
15
- export type { LyricsLayout } from "./types.js";
16
- /** @public */
17
- export type { StageBox } from "./stage.js";
package/dist/index.js DELETED
@@ -1,12 +0,0 @@
1
- // The index publishes the renderer, the leaves publish the standalone pieces. `constants.ts`,
2
- // `text.ts`, `themeSettings.ts` and `util.ts` are the leaves: they import nothing, so a consumer
3
- // that needs only a class name or a pure helper can take one without pulling the engine into its
4
- // bundle.
5
- //
6
- // `createLyricsRenderer` is the way in. The four values beside it are what one instance cannot
7
- // answer for on its own: the song level operations address every live view at once, and the
8
- // injection helpers decorate lines that are already built.
9
- export { resetPlaybackClock } from "./engine/clock.js";
10
- export { resumeAllAutoscroll } from "./engine/userScroll.js";
11
- export { injectRomanization, injectTranslation, removeRomanization, removeTranslation, } from "./inject.js";
12
- export { createLyricsRenderer } from "./renderer.js";
package/dist/inject.d.ts DELETED
@@ -1,98 +0,0 @@
1
- import { type WordState } from "./constants.js";
2
- import type { Lyric, LyricPart, LyricSyncType } from "./types.js";
3
- export declare let disableRichsync: import("./themeSettings.js").Setting;
4
- export declare const hideCredits: import("./themeSettings.js").Setting;
5
- export declare function findNearestAgent(lyrics: Lyric[], fromIndex: number): string | undefined;
6
- export declare function isNearestLyricRtl(lyrics: Lyric[], fromIndex: number): boolean;
7
- export declare function deriveSyncType(lyrics: Lyric[]): LyricSyncType;
8
- export interface AnimationData {
9
- /**
10
- * Time of this part in seconds
11
- */
12
- time: number;
13
- /**
14
- * Duration of this part in seconds
15
- */
16
- duration: number;
17
- lyricElement: HTMLElement;
18
- animations: Animation[];
19
- }
20
- /**
21
- * One box of a word's sweep, run by the compositor: the whole word when it is its own inline-block
22
- * box, or one letter of a word that flows inline. Its mask holds a static soft edge and slides one way
23
- * while the text inside it slides the other, so the glyphs hold still and only the edge crosses them.
24
- * With nothing animating, the mask rests with the cell fully lit.
25
- */
26
- export interface SweepCell {
27
- mask: HTMLElement;
28
- text: HTMLElement;
29
- letters?: HTMLElement[];
30
- /** Where the cell sits along the word, as fractions of the word's width; equal shares if unset. */
31
- span?: {
32
- start: number;
33
- width: number;
34
- };
35
- }
36
- /**
37
- * The sweep of a word that flows inline without letters: a word in a bidi-sensitive row or a long
38
- * group whose script joins or whose letters are not split. Such a word can break across lines and
39
- * shape with its neighbours, so no box of its own can hold the sweep. The engine places a cell over
40
- * each box the word breaks into, drawing the word from a copy of its line, once the line is laid out.
41
- */
42
- export interface SweepContext {
43
- host?: HTMLElement;
44
- placedAt?: string;
45
- unplaced?: boolean;
46
- }
47
- export interface PartData extends AnimationData {
48
- highlightElement: HTMLElement;
49
- /** The sweep's cells in reading order. */
50
- sweep?: SweepCell[];
51
- sweepContext?: SweepContext;
52
- letterElements?: HTMLElement[];
53
- highlightLetterElements?: HTMLElement[];
54
- wobbleElements: HTMLElement[];
55
- glowSuppressed?: boolean;
56
- wordState: WordState;
57
- }
58
- export type LineData = {
59
- parts: PartData[];
60
- isScrolled: boolean;
61
- isAnimationPlayStatePlaying: boolean;
62
- accumulatedOffsetMs: number;
63
- isAnimating: boolean;
64
- lastAnimSetupAt: number;
65
- isSelected: boolean;
66
- height: number;
67
- position: number;
68
- decorations: Map<HTMLElement, number>;
69
- } & AnimationData;
70
- export declare function newLineData(lyricElement: HTMLElement, startTimeMs: number, durationMs: number): LineData;
71
- export declare function applyDirection(element: HTMLElement, text: string): void;
72
- /** Puts a copy of the cell's text into an element, returning its letters if the word is split. */
73
- export type FillSweepText = (into: HTMLElement) => HTMLElement[] | undefined;
74
- export declare function createSweepCell(doc: Document, host: HTMLElement, fill: FillSweepText): SweepCell;
75
- export declare function createLyricsLine(doc: Document, parts: LyricPart[], line: LineData, lyricElement: HTMLElement, options?: {
76
- splitBackgroundLine: boolean;
77
- }): HTMLElement;
78
- export declare function buildLineSyncedParts(item: Lyric): LyricPart[];
79
- export declare function addSeekHandler(seek: (timeS: number) => void, lyricElement: HTMLElement, allZero: boolean): void;
80
- /**
81
- * Takes the romanization off a line, along with any timed parts it brought. A line a swap kept goes on
82
- * carrying what was hung on it, so this is how a consumer drops one it no longer wants. Answers
83
- * whether there was one to take off.
84
- */
85
- export declare function removeRomanization(lyricElement: HTMLElement, lineData: LineData): boolean;
86
- /**
87
- * Takes the translation off a line. A line a swap kept goes on carrying what was hung on it, so this is
88
- * how a consumer drops one it no longer wants. Answers whether there was one to take off.
89
- */
90
- export declare function removeTranslation(lyricElement: HTMLElement): boolean;
91
- /**
92
- * Moves the translation and romanization hung on one line onto the line built in its place, with any
93
- * timed parts they brought, so a line rebuilt for its timing keeps what the consumer hung on it. The
94
- * parts are let go of whatever the old line was showing; the new line sets them up again with its own.
95
- */
96
- export declare function moveDecorations(from: LineData, to: LineData): void;
97
- export declare function injectRomanization(doc: Document, lyricElement: HTMLElement, lineData: LineData, text: string, timedRomanization?: LyricPart[] | null): void;
98
- export declare function injectTranslation(doc: Document, lyricElement: HTMLElement, text: string, language?: string | null): void;