@braccato/core 1.20.1 → 1.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -37
- package/dist/README.md +40 -37
- package/dist/constants.d.ts +10 -0
- package/dist/constants.js +10 -0
- package/dist/engine/animationConfig.d.ts +0 -5
- package/dist/engine/animationConfig.js +0 -5
- package/dist/engine/animationTiming.d.ts +2 -1
- package/dist/engine/animationTiming.js +3 -2
- package/dist/engine/contextSweep.d.ts +10 -0
- package/dist/engine/contextSweep.js +102 -0
- package/dist/engine/culling.d.ts +11 -1
- package/dist/engine/culling.js +97 -24
- package/dist/engine/decorationSlides.d.ts +1 -1
- package/dist/engine/decorationSlides.js +13 -4
- package/dist/engine/elementMotion.d.ts +17 -0
- package/dist/engine/elementMotion.js +98 -0
- package/dist/engine/glow.js +1 -1
- package/dist/engine/instance.d.ts +7 -3
- package/dist/engine/instance.js +6 -4
- package/dist/engine/letterPlans.d.ts +0 -11
- package/dist/engine/letterPlans.js +0 -41
- package/dist/engine/lineAnimationState.js +1 -4
- package/dist/engine/lineAnimations.d.ts +1 -1
- package/dist/engine/lineAnimations.js +5 -24
- package/dist/engine/lineLifecycle.js +1 -1
- package/dist/engine/lineScroll.d.ts +5 -6
- package/dist/engine/lineScroll.js +36 -26
- package/dist/engine/lineScrollStyle.d.ts +8 -3
- package/dist/engine/lineScrollStyle.js +18 -4
- package/dist/engine/motionCurves.d.ts +19 -0
- package/dist/engine/motionCurves.js +85 -0
- package/dist/engine/renderedLines.d.ts +1 -2
- package/dist/engine/renderedLines.js +10 -19
- package/dist/engine/sweepPlans.d.ts +36 -0
- package/dist/engine/sweepPlans.js +59 -0
- package/dist/engine/tick.d.ts +4 -1
- package/dist/engine/tick.js +40 -10
- package/dist/engine/wavePool.d.ts +0 -1
- package/dist/engine/wordAnimations.d.ts +1 -5
- package/dist/engine/wordAnimations.js +88 -66
- package/dist/imageHighlights.d.ts +0 -11
- package/dist/imageHighlights.js +2 -48
- package/dist/inject.d.ts +41 -2
- package/dist/inject.js +72 -27
- package/dist/renderer.js +3 -2
- package/dist/styles/image-highlights.css +1 -59
- package/dist/styles/lyrics.css +128 -57
- package/dist/view.d.ts +1 -1
- package/dist/view.js +6 -5
- package/package.json +1 -1
- package/dist/engine/highlightKeyframes.d.ts +0 -8
- package/dist/engine/highlightKeyframes.js +0 -37
package/dist/view.js
CHANGED
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
// size they were measured at, and the scrolls to swallow before the view has settled.
|
|
15
15
|
import { CREDITS_CLASS, CREDITS_NAMES_CLASS, CREDITS_TEXT_CLASS, LINE_CLASS, LYRICS_CLASS, RTL_CLASS, } from "./constants.js";
|
|
16
16
|
import {} from "./engine/instance.js";
|
|
17
|
-
import {
|
|
17
|
+
import { elementMotionOffsetPx } from "./engine/elementMotion.js";
|
|
18
|
+
import { replaceRenderedLines } from "./engine/renderedLines.js";
|
|
18
19
|
import { playerTimeForLyricTime } from "./engine/clock.js";
|
|
19
|
-
import {
|
|
20
|
+
import { setupLineCulling } from "./engine/culling.js";
|
|
20
21
|
import { addSeekHandler, applyDirection, buildLineSyncedParts, createLyricsLine, deriveSyncType, disableRichsync, findNearestAgent, hideCredits, isNearestLyricRtl, moveDecorations, newLineData, } from "./inject.js";
|
|
21
22
|
import { refreshInstrumentalImages } from "./imageHighlights.js";
|
|
22
23
|
import { createInstrumentalElement } from "./instrumental.js";
|
|
@@ -230,7 +231,7 @@ export function setLyrics(engine, mount, lyrics, options) {
|
|
|
230
231
|
// sizes it by.
|
|
231
232
|
engine.lyricWidth = container.clientWidth;
|
|
232
233
|
engine.lyricHeight = container.clientHeight;
|
|
233
|
-
|
|
234
|
+
setupLineCulling(engine);
|
|
234
235
|
}
|
|
235
236
|
/**
|
|
236
237
|
* Pairs each new line with an old one that builds the same, keeping their order, so a kept element is
|
|
@@ -354,7 +355,7 @@ export function swapLyrics(engine, mount, lyrics, options) {
|
|
|
354
355
|
line.lyricElement.dataset.lineNumber = String(lineIndex);
|
|
355
356
|
applyLyricLanguage(line.lyricElement, context.languages[lineIndex]);
|
|
356
357
|
lines.push(line);
|
|
357
|
-
positions.set(line, { position: line.position, height: line.height,
|
|
358
|
+
positions.set(line, { position: line.position, height: line.height, motionOffset: 0 });
|
|
358
359
|
continue;
|
|
359
360
|
}
|
|
360
361
|
if (unmatchedOld.length === 0) {
|
|
@@ -369,7 +370,7 @@ export function swapLyrics(engine, mount, lyrics, options) {
|
|
|
369
370
|
position: standsFor.position,
|
|
370
371
|
height: standsFor.height,
|
|
371
372
|
// A kept line finishes its own line scroll; this one starts where the line it replaced was.
|
|
372
|
-
|
|
373
|
+
motionOffset: elementMotionOffsetPx(engine, standsFor.lyricElement),
|
|
373
374
|
});
|
|
374
375
|
if (decorationKeys.get(standsFor) === decorationKeys.get(line))
|
|
375
376
|
moveDecorations(standsFor, line);
|
package/package.json
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { PartData } from "../inject.js";
|
|
2
|
-
import type { AnimationConfig } from "./animationConfig.js";
|
|
3
|
-
export declare function swipeKeyframes(config: AnimationConfig): Keyframe[];
|
|
4
|
-
export declare function glowKeyframes({ highlight }: AnimationConfig, part: PartData): Keyframe[];
|
|
5
|
-
export declare function shownKeyframes(): Keyframe[];
|
|
6
|
-
export declare function shownFullySweptKeyframes(config: AnimationConfig): Keyframe[];
|
|
7
|
-
export declare function fadeInFullySweptKeyframes(config: AnimationConfig): Keyframe[];
|
|
8
|
-
export declare function fadeOutKeyframes(config: AnimationConfig, part: PartData): Keyframe[];
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
function swipeAmounts({ highlight }, end) {
|
|
2
|
-
return {
|
|
3
|
-
"--lyric-transition-amount-start": end === "from" ? highlight.swipeStartFrom : highlight.swipeStartTo,
|
|
4
|
-
"--lyric-transition-amount-end": end === "from" ? highlight.swipeEndFrom : highlight.swipeEndTo,
|
|
5
|
-
};
|
|
6
|
-
}
|
|
7
|
-
export function swipeKeyframes(config) {
|
|
8
|
-
return [swipeAmounts(config, "from"), swipeAmounts(config, "to")];
|
|
9
|
-
}
|
|
10
|
-
export function glowKeyframes({ highlight }, part) {
|
|
11
|
-
if (!part.imageLayers)
|
|
12
|
-
return [{ filter: highlight.glowFrom }, { filter: highlight.glowTo }];
|
|
13
|
-
return [
|
|
14
|
-
{ filter: `blur(${highlight.imageGlowFrom})`, opacity: highlight.imageGlowOpacityFrom },
|
|
15
|
-
{ filter: `blur(${highlight.imageGlowTo})`, opacity: highlight.imageGlowOpacityTo },
|
|
16
|
-
];
|
|
17
|
-
}
|
|
18
|
-
export function shownKeyframes() {
|
|
19
|
-
return [{ opacity: 1 }, { opacity: 1 }];
|
|
20
|
-
}
|
|
21
|
-
export function shownFullySweptKeyframes(config) {
|
|
22
|
-
const shown = { opacity: 1, ...swipeAmounts(config, "to") };
|
|
23
|
-
return [shown, shown];
|
|
24
|
-
}
|
|
25
|
-
export function fadeInFullySweptKeyframes(config) {
|
|
26
|
-
return [
|
|
27
|
-
{ opacity: 0, ...swipeAmounts(config, "to") },
|
|
28
|
-
{ opacity: 1, ...swipeAmounts(config, "to") },
|
|
29
|
-
];
|
|
30
|
-
}
|
|
31
|
-
export function fadeOutKeyframes(config, part) {
|
|
32
|
-
const filter = part.imageLayers ? "none" : config.highlight.glowTo;
|
|
33
|
-
return [
|
|
34
|
-
{ opacity: 1, filter, ...swipeAmounts(config, "to") },
|
|
35
|
-
{ opacity: 0, filter, ...swipeAmounts(config, "to") },
|
|
36
|
-
];
|
|
37
|
-
}
|