@braccato/core 1.19.1 → 1.20.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/dist/engine/animationConfig.d.ts +88 -0
- package/dist/engine/animationConfig.js +98 -0
- package/dist/engine/animationDrift.d.ts +11 -0
- package/dist/engine/animationDrift.js +43 -0
- package/dist/engine/animationTiming.d.ts +25 -0
- package/dist/engine/animationTiming.js +119 -0
- package/dist/engine/autoScroll.d.ts +24 -0
- package/dist/engine/autoScroll.js +103 -0
- package/dist/engine/clock.d.ts +29 -0
- package/dist/engine/clock.js +70 -0
- package/dist/engine/cssValues.d.ts +13 -0
- package/dist/engine/cssValues.js +47 -0
- package/dist/engine/culling.d.ts +6 -0
- package/dist/engine/culling.js +67 -0
- package/dist/engine/debugOverlay.d.ts +14 -0
- package/dist/engine/debugOverlay.js +58 -0
- package/dist/engine/decorationSlides.d.ts +6 -0
- package/dist/engine/decorationSlides.js +44 -0
- package/dist/engine/glow.d.ts +7 -0
- package/dist/engine/glow.js +59 -0
- package/dist/engine/highlightKeyframes.d.ts +8 -0
- package/dist/engine/highlightKeyframes.js +37 -0
- package/dist/engine/instance.d.ts +102 -0
- package/dist/engine/instance.js +87 -0
- package/dist/engine/instrumentalAnimations.d.ts +7 -0
- package/dist/engine/instrumentalAnimations.js +59 -0
- package/dist/engine/letterPlans.d.ts +42 -0
- package/dist/engine/letterPlans.js +103 -0
- package/dist/engine/lineAnimationState.d.ts +10 -0
- package/dist/engine/lineAnimationState.js +85 -0
- package/dist/engine/lineAnimations.d.ts +5 -0
- package/dist/engine/lineAnimations.js +82 -0
- package/dist/engine/lineLifecycle.d.ts +12 -0
- package/dist/engine/lineLifecycle.js +92 -0
- package/dist/engine/lineScroll.d.ts +48 -0
- package/dist/engine/lineScroll.js +174 -0
- package/dist/engine/lineScrollStyle.d.ts +27 -0
- package/dist/engine/lineScrollStyle.js +119 -0
- package/dist/engine/liveViews.d.ts +3 -0
- package/dist/engine/liveViews.js +5 -0
- package/dist/engine/motionPreference.d.ts +1 -0
- package/dist/engine/motionPreference.js +1 -0
- package/dist/engine/passiveScroll.d.ts +10 -0
- package/dist/engine/passiveScroll.js +93 -0
- package/dist/engine/renderedLines.d.ts +17 -0
- package/dist/engine/renderedLines.js +137 -0
- package/dist/engine/scrollViewport.d.ts +36 -0
- package/dist/engine/scrollViewport.js +104 -0
- package/dist/engine/stageMotion.d.ts +7 -0
- package/dist/engine/stageMotion.js +319 -0
- package/dist/engine/tick.d.ts +13 -0
- package/dist/engine/tick.js +246 -0
- package/dist/engine/timingLogs.d.ts +7 -0
- package/dist/engine/timingLogs.js +81 -0
- package/dist/engine/userScroll.d.ts +12 -0
- package/dist/engine/userScroll.js +62 -0
- package/dist/engine/wavePool.d.ts +8 -0
- package/dist/engine/wavePool.js +22 -0
- package/dist/engine/wordAnimations.d.ts +9 -0
- package/dist/engine/wordAnimations.js +216 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -1
- package/dist/inject.js +40 -22
- package/dist/renderer.js +8 -2
- package/dist/types.d.ts +1 -1
- package/dist/view.d.ts +2 -2
- package/dist/view.js +7 -3
- package/package.json +2 -2
- package/dist/engine.d.ts +0 -471
- package/dist/engine.js +0 -3133
package/dist/engine.d.ts
DELETED
|
@@ -1,471 +0,0 @@
|
|
|
1
|
-
import type { LineData, PartData } from "./inject.js";
|
|
2
|
-
import { type StageBox, type StageMetrics } from "./stage.js";
|
|
3
|
-
import type { LyricsLayout, LyricsRendererHost, LyricSyncType, ResolvedTickOptions, TickOptions } from "./types.js";
|
|
4
|
-
/**
|
|
5
|
-
* Everything that belongs to a single rendered lyrics view: one scroll container, one selection,
|
|
6
|
-
* one set of pending scroll work.
|
|
7
|
-
*/
|
|
8
|
-
interface AnimEngineViewState {
|
|
9
|
-
/**
|
|
10
|
-
* The render records this view built, one per lyric line. They hold this view's elements and
|
|
11
|
-
* this view's `Animation` objects, so a second view never shares them.
|
|
12
|
-
*/
|
|
13
|
-
lines: LineData[];
|
|
14
|
-
lyricsContainer: HTMLElement | null;
|
|
15
|
-
syncType: LyricSyncType;
|
|
16
|
-
lyricWidth: number;
|
|
17
|
-
lyricHeight: number;
|
|
18
|
-
skipScrolls: number;
|
|
19
|
-
skipScrollsDecayTimes: number[];
|
|
20
|
-
scrollResumeTime: number;
|
|
21
|
-
scrollPos: number;
|
|
22
|
-
selectedElementIndex: number;
|
|
23
|
-
wasUserScrolling: boolean;
|
|
24
|
-
lastScrollElements: LineData[];
|
|
25
|
-
/** The line a committed scroll kept in view because the active lines overflowed the band. */
|
|
26
|
-
pinnedScrollLine: LineData | null;
|
|
27
|
-
lastScrollDebugContext: {
|
|
28
|
-
activeElms: LineData[];
|
|
29
|
-
centers: number[];
|
|
30
|
-
lyricScrollTime: number;
|
|
31
|
-
};
|
|
32
|
-
passiveScrollAccumulatedTime: number;
|
|
33
|
-
passiveLastWallTime: number;
|
|
34
|
-
/** Where the passive drift last put the scroll, so a scroll that lands anywhere else is the reader's. */
|
|
35
|
-
passiveScrollTop: number | null;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* `Window` alone types neither `ResizeObserver` nor `DOMMatrix`: both are ambient `var`
|
|
39
|
-
* declarations, so they only appear through `typeof globalThis`.
|
|
40
|
-
*/
|
|
41
|
-
type EngineWindow = Window & typeof globalThis;
|
|
42
|
-
export interface AnimationEngineInstance extends AnimEngineViewState {
|
|
43
|
-
document: Document;
|
|
44
|
-
window: EngineWindow;
|
|
45
|
-
host: LyricsRendererHost;
|
|
46
|
-
cachedTabRendererHeight: number | null;
|
|
47
|
-
cachedScrollInsets: ScrollInsets;
|
|
48
|
-
cachedFooterItem: LineScrollItem | null;
|
|
49
|
-
cachedCreditsItem: LineScrollItem | null;
|
|
50
|
-
creditsFocused: boolean;
|
|
51
|
-
cachedLineScrollTiming: Map<string, LineScrollTiming>;
|
|
52
|
-
tabRendererResizeObserver: ResizeObserver | null;
|
|
53
|
-
observedTabRenderer: HTMLElement | null;
|
|
54
|
-
lineScrollAnimations: LineScrollAnimationRecord[];
|
|
55
|
-
lineScrollAnimationToken: number;
|
|
56
|
-
pendingLineScroll: PendingLineScroll | null;
|
|
57
|
-
lineScrollElementTokens: WeakMap<HTMLElement, number>;
|
|
58
|
-
visibleWillChangeElements: Set<HTMLElement>;
|
|
59
|
-
culledLineElements: Set<HTMLElement>;
|
|
60
|
-
waveAnimationPool: Animation[];
|
|
61
|
-
lineCullObserver: IntersectionObserver | null;
|
|
62
|
-
cachedDurations: Map<string, number>;
|
|
63
|
-
cachedCSSValues: Map<string, string>;
|
|
64
|
-
cachedAnimationSettings: AnimationSettings | null;
|
|
65
|
-
/**
|
|
66
|
-
* Last value the tick was given. The passive scroll loop runs from an animation frame rather than
|
|
67
|
-
* from a tick, so it has no options object to read.
|
|
68
|
-
*/
|
|
69
|
-
passiveScrollEnabled: boolean;
|
|
70
|
-
/**
|
|
71
|
-
* Last options the tick was given, kept before any early return. A click reads its offsets to seek
|
|
72
|
-
* to where a line plays rather than to its unshifted time.
|
|
73
|
-
*/
|
|
74
|
-
lastTickOptions: ResolvedTickOptions | null;
|
|
75
|
-
playbackRate: number;
|
|
76
|
-
passiveRAFId: number | null;
|
|
77
|
-
pendingLyricsUpdateFrame: number | null;
|
|
78
|
-
learnedAnimationTimingOffsetMs: number;
|
|
79
|
-
animationTimingVisibilityLogUntil: number;
|
|
80
|
-
layout: LyricsLayout;
|
|
81
|
-
stageKey: string;
|
|
82
|
-
stageRemeasured: boolean;
|
|
83
|
-
stageHeight: number;
|
|
84
|
-
stageBox: StageBox | null;
|
|
85
|
-
stageMetrics: Map<HTMLElement, StageMetrics>;
|
|
86
|
-
stageY: Map<HTMLElement, number>;
|
|
87
|
-
stageMoves: Map<HTMLElement, Animation>;
|
|
88
|
-
stageFades: Map<HTMLElement, Animation>;
|
|
89
|
-
stageBlurs: Map<HTMLElement, Animation>;
|
|
90
|
-
stageFontSize: number;
|
|
91
|
-
/**
|
|
92
|
-
* Releases everything the instance holds on its window: the reduced motion listener, the tab
|
|
93
|
-
* renderer observer and any frame it still has queued.
|
|
94
|
-
*/
|
|
95
|
-
destroy(): void;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Runs an operation against every live instance. Cheap enough for a scroll or a song change, and
|
|
99
|
-
* deliberately not used inside the tick, which runs per frame and per line.
|
|
100
|
-
*/
|
|
101
|
-
export declare function forEveryLiveView(runOperation: (engine: AnimationEngineInstance) => void): void;
|
|
102
|
-
export declare function createAnimationEngineInstance(engineDocument: Document, engineWindow: EngineWindow, host: LyricsRendererHost, layout?: LyricsLayout): AnimationEngineInstance;
|
|
103
|
-
/**
|
|
104
|
-
* Forgets the last player snapshot, so the next tick is treated as the first one of a new song
|
|
105
|
-
* rather than as a jump away from the previous one.
|
|
106
|
-
*/
|
|
107
|
-
export declare function resetPlaybackClock(): void;
|
|
108
|
-
export declare function smoothedPlaybackTime(previousTime: number, previousAt: number, rawTime: number, now: number, playbackRate: number): number;
|
|
109
|
-
/**
|
|
110
|
-
* The user asked for autoscroll back, now.
|
|
111
|
-
*/
|
|
112
|
-
export declare function resetScrollResume(engine: AnimationEngineInstance): void;
|
|
113
|
-
/**
|
|
114
|
-
* The user asked for autoscroll back, now. Resuming is a property of playback rather than of one
|
|
115
|
-
* view, so every live instance resumes. Published in this shape rather than as the registry walk
|
|
116
|
-
* and the per view operation it is built from, so that nothing outside the module gets to name a
|
|
117
|
-
* particular view.
|
|
118
|
-
*/
|
|
119
|
-
export declare function resumeAllAutoscroll(): void;
|
|
120
|
-
/**
|
|
121
|
-
* The user scrolled this view. Scrolls the engine itself performed are swallowed;
|
|
122
|
-
* a real one pauses autoscroll long enough to read where it landed, and offers the way back.
|
|
123
|
-
*
|
|
124
|
-
* @param isPassive - Whether the lyrics on screen are unsynced, and so are drifting on their own
|
|
125
|
-
* rather than following the song. Those resume sooner.
|
|
126
|
-
*/
|
|
127
|
-
export declare function noteUserScroll(engine: AnimationEngineInstance, isPassive: boolean): void;
|
|
128
|
-
/**
|
|
129
|
-
* Reports whether the container is a different size than the lines were last measured against, and
|
|
130
|
-
* clears the scroll cooldown when it is so the caller's re-measurement can scroll immediately. The
|
|
131
|
-
* new size is recorded by that re-measurement, not here.
|
|
132
|
-
*/
|
|
133
|
-
export declare function noteContainerResize(engine: AnimationEngineInstance, width: number, height: number): boolean;
|
|
134
|
-
/**
|
|
135
|
-
* Takes the lines this view is showing off the screen, keeping the container they were in, and
|
|
136
|
-
* reports whether there was anything there to take.
|
|
137
|
-
*/
|
|
138
|
-
export declare function clearOnScreenLyrics(engine: AnimationEngineInstance): boolean;
|
|
139
|
-
export declare function hasRenderedLines(engine: AnimationEngineInstance): boolean;
|
|
140
|
-
/**
|
|
141
|
-
* The render records this view built. Handing them out is a leak: they carry this view's elements
|
|
142
|
-
* and its `Animation` objects, so a caller that rewrites line times or hangs translations off them
|
|
143
|
-
* can only ever reach one view. Phase 5 revisits it, when both of those have to reach two.
|
|
144
|
-
*/
|
|
145
|
-
export declare function getRenderedLines(engine: AnimationEngineInstance): LineData[];
|
|
146
|
-
export declare function getRenderedSyncType(engine: AnimationEngineInstance): LyricSyncType;
|
|
147
|
-
/**
|
|
148
|
-
* Drops the song this view was rendering: its selection, its pending scroll work, its animations
|
|
149
|
-
* and its render records. The records go before the caller clears the DOM, so the elements they
|
|
150
|
-
* hold are released along with it.
|
|
151
|
-
*/
|
|
152
|
-
export declare function clearLyrics(engine: AnimationEngineInstance): void;
|
|
153
|
-
/**
|
|
154
|
-
* How far a scroll still running has carried a line from its place, or zero with none running on it.
|
|
155
|
-
*/
|
|
156
|
-
export declare function lineScrollOffset(engine: AnimationEngineInstance, element: HTMLElement): number;
|
|
157
|
-
/**
|
|
158
|
-
* Hands the engine the lines of a song swapped into the view it already holds. A kept line is the
|
|
159
|
-
* same record and keeps everything; a dropped line's animations stop and nothing goes on holding it;
|
|
160
|
-
* a line built in place of one is handed what the engine held for that one, so the scroll does not
|
|
161
|
-
* see a line it has not met and the stage does not fade in a line that was already up.
|
|
162
|
-
*
|
|
163
|
-
* @param lines - The new song's records, kept ones included, in order
|
|
164
|
-
* @param dropped - Records of the song before that the new one no longer has
|
|
165
|
-
* @param replaced - Each new record built in place of a dropped one, to the one it replaced
|
|
166
|
-
*/
|
|
167
|
-
export declare function replaceRenderedLines(engine: AnimationEngineInstance, lines: LineData[], dropped: readonly LineData[], replaced: ReadonlyMap<LineData, LineData>): void;
|
|
168
|
-
/**
|
|
169
|
-
* Carries a swapped view across the layout change it caused. The line the reader is following holds
|
|
170
|
-
* still on screen: the scroll moves by however far that line moved in the container. Every other
|
|
171
|
-
* line that moved, relative to it, slides from where it was rather than jumping.
|
|
172
|
-
*
|
|
173
|
-
* Which line is followed depends on who owns the scroll. While the engine does, it is the line the
|
|
174
|
-
* last scroll aimed at; while the reader does, it is the first line they could see.
|
|
175
|
-
*
|
|
176
|
-
* @param before - Where each line was in the container before the swap and how tall, from `swapLyrics`
|
|
177
|
-
* @param scrollTopBefore - The scroll position the swap began at
|
|
178
|
-
*/
|
|
179
|
-
export declare function settleSwappedLines(engine: AnimationEngineInstance, before: ReadonlyMap<LineData, {
|
|
180
|
-
position: number;
|
|
181
|
-
height: number;
|
|
182
|
-
offset: number;
|
|
183
|
-
}>, scrollTopBefore: number): void;
|
|
184
|
-
/**
|
|
185
|
-
* Lets go of a part moving to another line or leaving the view: its animations stop, back to the pool
|
|
186
|
-
* they came from, and it shows no sung state until a line that is being sung sets it up again.
|
|
187
|
-
*/
|
|
188
|
-
export declare function releasePart(part: PartData): void;
|
|
189
|
-
export declare function updateWordStates(lineData: LineData, currentTime: number): void;
|
|
190
|
-
type LineScrollSide = "above" | "active" | "below";
|
|
191
|
-
interface LineScrollItem {
|
|
192
|
-
lyricElement: HTMLElement;
|
|
193
|
-
height: number;
|
|
194
|
-
position: number;
|
|
195
|
-
}
|
|
196
|
-
interface LineScrollAnimationRecord {
|
|
197
|
-
animation: Animation;
|
|
198
|
-
lineElement: HTMLElement;
|
|
199
|
-
token: number;
|
|
200
|
-
}
|
|
201
|
-
interface AnimationConfig {
|
|
202
|
-
enabled: {
|
|
203
|
-
lineScale: boolean;
|
|
204
|
-
wordWobble: boolean;
|
|
205
|
-
highlightSwipe: boolean;
|
|
206
|
-
highlightGlow: boolean;
|
|
207
|
-
highlightFade: boolean;
|
|
208
|
-
scroll: boolean;
|
|
209
|
-
instrumental: boolean;
|
|
210
|
-
};
|
|
211
|
-
line: {
|
|
212
|
-
durationMs: number;
|
|
213
|
-
enterEasing: string;
|
|
214
|
-
exitEasing: string;
|
|
215
|
-
enterFrom: string;
|
|
216
|
-
enterTo: string;
|
|
217
|
-
exitFrom: string;
|
|
218
|
-
exitTo: string;
|
|
219
|
-
};
|
|
220
|
-
highlight: {
|
|
221
|
-
fadeInDurationMs: number;
|
|
222
|
-
fadeOutDurationMs: number;
|
|
223
|
-
fadeInEasing: string;
|
|
224
|
-
fadeOutEasing: string;
|
|
225
|
-
swipeEasing: string;
|
|
226
|
-
swipeStartFrom: string;
|
|
227
|
-
swipeEndFrom: string;
|
|
228
|
-
swipeStartTo: string;
|
|
229
|
-
swipeEndTo: string;
|
|
230
|
-
imageGlowFrom: string;
|
|
231
|
-
imageGlowTo: string;
|
|
232
|
-
imageGlowOpacityFrom: string;
|
|
233
|
-
imageGlowOpacityTo: string;
|
|
234
|
-
glowFrom: string;
|
|
235
|
-
glowTo: string;
|
|
236
|
-
glowDurationRatio: number;
|
|
237
|
-
glowMinDurationMs: number;
|
|
238
|
-
glowEasing: string;
|
|
239
|
-
glowContainerAlpha: number;
|
|
240
|
-
glowRestingInvisible: boolean;
|
|
241
|
-
};
|
|
242
|
-
word: {
|
|
243
|
-
wobbleDurationMs: number;
|
|
244
|
-
wobbleEasing: string;
|
|
245
|
-
wobblePeakEasing: string;
|
|
246
|
-
wobbleEndEasing: string;
|
|
247
|
-
wobbleFrom: string;
|
|
248
|
-
wobblePeak: string;
|
|
249
|
-
wobbleSettle: string;
|
|
250
|
-
wobbleTo: string;
|
|
251
|
-
wobblePeakOffset: number;
|
|
252
|
-
wobbleSettleOffset: number;
|
|
253
|
-
};
|
|
254
|
-
letterWave: {
|
|
255
|
-
transform: string;
|
|
256
|
-
settle: string;
|
|
257
|
-
emphasisScale: string;
|
|
258
|
-
durationMs: number;
|
|
259
|
-
riseEasing: string;
|
|
260
|
-
fallEasing: string;
|
|
261
|
-
};
|
|
262
|
-
instrumental: {
|
|
263
|
-
fillFadeDurationMs: number;
|
|
264
|
-
fillFadeEasing: string;
|
|
265
|
-
fillFrom: string;
|
|
266
|
-
fillTo: string;
|
|
267
|
-
fillEasing: string;
|
|
268
|
-
waveFrom: string;
|
|
269
|
-
waveTo: string;
|
|
270
|
-
waveEasing: string;
|
|
271
|
-
wavePathHigh: string;
|
|
272
|
-
wavePathLow: string;
|
|
273
|
-
waveOscillationDurationMs: number;
|
|
274
|
-
waveOscillationEasing: string;
|
|
275
|
-
};
|
|
276
|
-
lineScroll: {
|
|
277
|
-
easing: string;
|
|
278
|
-
differentialEffects: boolean;
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
interface AnimationSettings {
|
|
282
|
-
config: AnimationConfig;
|
|
283
|
-
scrollTiming: {
|
|
284
|
-
earlyScrollConsiderS: number;
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
export declare function noteVisibilityChange(engine: AnimationEngineInstance): void;
|
|
288
|
-
export interface LetterSwipeWindow {
|
|
289
|
-
delayMs: number;
|
|
290
|
-
durationMs: number;
|
|
291
|
-
from: {
|
|
292
|
-
start: number;
|
|
293
|
-
end: number;
|
|
294
|
-
};
|
|
295
|
-
to: {
|
|
296
|
-
start: number;
|
|
297
|
-
end: number;
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
export interface SwipeRamp {
|
|
301
|
-
easing: string;
|
|
302
|
-
startFrom: string;
|
|
303
|
-
startTo: string;
|
|
304
|
-
endFrom: string;
|
|
305
|
-
endTo: string;
|
|
306
|
-
}
|
|
307
|
-
export declare function computeLetterSwipeWindows(swipe: SwipeRamp, letterCount: number, swipeDurationMs: number): LetterSwipeWindow[] | null;
|
|
308
|
-
export interface LetterMaskKeyframe {
|
|
309
|
-
offset: number;
|
|
310
|
-
maskPosition: string;
|
|
311
|
-
}
|
|
312
|
-
export interface LetterMaskSweep {
|
|
313
|
-
keyframes: LetterMaskKeyframe[];
|
|
314
|
-
delayMs: number;
|
|
315
|
-
durationMs: number;
|
|
316
|
-
easing: string;
|
|
317
|
-
}
|
|
318
|
-
export declare function planLetterMaskSweep(swipe: SwipeRamp, letterCount: number, swipeDurationMs: number, rtl: boolean): LetterMaskSweep[];
|
|
319
|
-
export interface LetterWaveTiming {
|
|
320
|
-
delayMs: number;
|
|
321
|
-
durationMs: number;
|
|
322
|
-
}
|
|
323
|
-
export declare function planLetterWave(swipe: SwipeRamp, letterCount: number, wordDurationMs: number, swipeDurationMs: number, swipeLeadMs: number, floatDurationMs: number): LetterWaveTiming[];
|
|
324
|
-
export declare function clearStyleCaches(engine: AnimationEngineInstance): void;
|
|
325
|
-
export declare function parseColorAlpha(value: string): number | null;
|
|
326
|
-
interface PreparedLineScroll {
|
|
327
|
-
lineElement: HTMLElement;
|
|
328
|
-
side: LineScrollSide;
|
|
329
|
-
token: number;
|
|
330
|
-
}
|
|
331
|
-
interface ResolvedLineScroll extends PreparedLineScroll {
|
|
332
|
-
durationMs: number;
|
|
333
|
-
startEasing: string;
|
|
334
|
-
endEasing: string;
|
|
335
|
-
startTranslate: string;
|
|
336
|
-
endTranslate: string;
|
|
337
|
-
}
|
|
338
|
-
interface LineScrollTiming {
|
|
339
|
-
durationMs: number;
|
|
340
|
-
startEasing: string;
|
|
341
|
-
endEasing: string;
|
|
342
|
-
}
|
|
343
|
-
interface LineScrollPlan {
|
|
344
|
-
items: ResolvedLineScroll[];
|
|
345
|
-
}
|
|
346
|
-
interface PendingLineScroll {
|
|
347
|
-
plan: LineScrollPlan;
|
|
348
|
-
activeLineElement: HTMLElement;
|
|
349
|
-
fromScrollTop: number;
|
|
350
|
-
toScrollTop: number;
|
|
351
|
-
}
|
|
352
|
-
export declare function setupLineCullObserver(engine: AnimationEngineInstance): void;
|
|
353
|
-
/**
|
|
354
|
-
* Unsynced lyrics that this view still has on screen. `syncType` outlives the lyrics it was derived
|
|
355
|
-
* from, so the container is the term that says they are still there.
|
|
356
|
-
*/
|
|
357
|
-
export declare function hasUnsyncedLyrics(engine: AnimationEngineInstance): boolean;
|
|
358
|
-
export interface ScrollInsets {
|
|
359
|
-
readonly top: number;
|
|
360
|
-
readonly bottom: number;
|
|
361
|
-
}
|
|
362
|
-
/**
|
|
363
|
-
* The scroll element's `scroll-padding` is the part of its viewport a host has declared unreadable,
|
|
364
|
-
* such as an edge faded out by a mask. Insets that leave no band at all are ignored rather than
|
|
365
|
-
* obeyed, since there would be nowhere left to put a line.
|
|
366
|
-
*/
|
|
367
|
-
export declare function resolveScrollInsets(scrollPaddingTop: string, scrollPaddingBottom: string, viewportHeight: number): ScrollInsets;
|
|
368
|
-
interface ScrollTargetLine {
|
|
369
|
-
readonly time: number;
|
|
370
|
-
readonly duration: number;
|
|
371
|
-
readonly position: number;
|
|
372
|
-
readonly height: number;
|
|
373
|
-
}
|
|
374
|
-
/**
|
|
375
|
-
* The line the singer is on: the latest one still being sung. An earlier line still running is a
|
|
376
|
-
* tail, such as a background echo or a held note, and a later one is still in its lookahead. A line
|
|
377
|
-
* stays active past its own end until the next one starts, so a started line only wins while it runs.
|
|
378
|
-
*/
|
|
379
|
-
export declare function findScrollAnchor<Line extends ScrollTargetLine>(sungLines: readonly Line[], scrollTime: number): Line;
|
|
380
|
-
/**
|
|
381
|
-
* Where to scroll so the lines being sung sit around the target, inside the visible band. When they
|
|
382
|
-
* do not all fit, the anchor keeps its top in view and the rest give way. `overflowsBand` tells the
|
|
383
|
-
* caller the view is pinned to the anchor, and has to move on once that line ends.
|
|
384
|
-
*
|
|
385
|
-
* @param sungLines - In order, never empty. The last is the last active line.
|
|
386
|
-
*/
|
|
387
|
-
export declare function computeActiveLinesScrollTop(sungLines: readonly ScrollTargetLine[], anchor: ScrollTargetLine, viewportHeight: number, insets: ScrollInsets, targetOffset: number): {
|
|
388
|
-
scrollTop: number;
|
|
389
|
-
overflowsBand: boolean;
|
|
390
|
-
};
|
|
391
|
-
/**
|
|
392
|
-
* "lyrics-missing" means this instance has nothing left to render. Whether that ends ticking is the
|
|
393
|
-
* driver's call, not the instance's: one instance running dry must not silence another.
|
|
394
|
-
*/
|
|
395
|
-
export type AnimationTickStatus = "ok" | "lyrics-missing";
|
|
396
|
-
/**
|
|
397
|
-
* Fills in everything a caller left out of a tick. The tick reads each of these arithmetically, so
|
|
398
|
-
* a missing one would not fail: it would quietly turn the playback time into NaN and leave the view
|
|
399
|
-
* matching no line at all.
|
|
400
|
-
*/
|
|
401
|
-
export declare function resolveTickOptions(options: TickOptions): ResolvedTickOptions;
|
|
402
|
-
export declare function measureStage(engine: AnimationEngineInstance): void;
|
|
403
|
-
/**
|
|
404
|
-
* The player time at which a lyric time plays, under the offsets of the last tick.
|
|
405
|
-
*/
|
|
406
|
-
export declare function playerTimeForLyricTime(engine: AnimationEngineInstance, lyricTimeS: number): number;
|
|
407
|
-
/**
|
|
408
|
-
* Renders one view against a tick with nothing left out.
|
|
409
|
-
*/
|
|
410
|
-
export declare function tickView(engine: AnimationEngineInstance, currentTime: number, options: ResolvedTickOptions): AnimationTickStatus;
|
|
411
|
-
/**
|
|
412
|
-
* What a view has to know to size its scroll padding. Split out from the element reads so the
|
|
413
|
-
* arithmetic can be checked against the degenerate cases, which is where it went wrong: an
|
|
414
|
-
* unrendered container answers zero to every measurement.
|
|
415
|
-
*/
|
|
416
|
-
interface ScrollPaddingMeasurements {
|
|
417
|
-
viewportHeight: number;
|
|
418
|
-
targetScrollRatio: number;
|
|
419
|
-
/** The container's own height with whatever bottom padding it currently carries taken back off. */
|
|
420
|
-
contentHeight: number;
|
|
421
|
-
firstLineHeight: number;
|
|
422
|
-
/** Distance from the top of the container to the middle of the last line, or null with no lines. */
|
|
423
|
-
lastLineCentre: number | null;
|
|
424
|
-
lastLineHeight: number;
|
|
425
|
-
footerHeight: number;
|
|
426
|
-
}
|
|
427
|
-
/**
|
|
428
|
-
* Sizes the padding above the first line and below the last one so either can sit at the view's
|
|
429
|
-
* target scroll position.
|
|
430
|
-
*
|
|
431
|
-
* The first two candidates are exact, and both are measured from the container. They are worth
|
|
432
|
-
* nothing while it is not rendering: every line reports zero, which reads as content that already
|
|
433
|
-
* runs past the last line and asks for no padding at all, and the last lines of the song then have
|
|
434
|
-
* nowhere to scroll to. The viewport keeps its height whether the lyrics render or not, so the
|
|
435
|
-
* space it alone demands below the last line is always knowable, and it is the floor. Over-padding
|
|
436
|
-
* costs nothing visible; under-padding strands the end of every song.
|
|
437
|
-
*/
|
|
438
|
-
export declare function computeScrollPadding(measurements: ScrollPaddingMeasurements): {
|
|
439
|
-
top: number;
|
|
440
|
-
bottom: number;
|
|
441
|
-
};
|
|
442
|
-
/**
|
|
443
|
-
* Re-reads the view's layout: the scroll padding first, then the line positions the padding moved.
|
|
444
|
-
*
|
|
445
|
-
* @param measureLines - Pass false while the lines are not being rendered. An unrendered container
|
|
446
|
-
* measures every line as zero height at zero offset, which would leave the scroll maths with
|
|
447
|
-
* nothing to work from once rendering resumes.
|
|
448
|
-
*/
|
|
449
|
-
export declare function relayout(engine: AnimationEngineInstance, measureLines: boolean): void;
|
|
450
|
-
/**
|
|
451
|
-
* Renders this view again against the last player snapshot, without moving the clock on. The
|
|
452
|
-
* options are built now rather than handed in, so a caller that reads settings at tick time still
|
|
453
|
-
* reads them at tick time.
|
|
454
|
-
*
|
|
455
|
-
* @param buildTickOptions - Given the snapshot the tick will run against, returns what to render it
|
|
456
|
-
* with.
|
|
457
|
-
*/
|
|
458
|
-
export declare function retickFromPlaybackClock(engine: AnimationEngineInstance, buildTickOptions: (eventCreationTime: number, isPlaying: boolean) => TickOptions): AnimationTickStatus;
|
|
459
|
-
/**
|
|
460
|
-
* Called when a new lyrics element is added to trigger re-sync.
|
|
461
|
-
* Debounced via requestAnimationFrame to avoid O(n²) layout thrashing
|
|
462
|
-
* when translations/romanizations load (each addition would otherwise
|
|
463
|
-
* re-measure ALL lines).
|
|
464
|
-
*
|
|
465
|
-
* @param isViewRendering - Asked on the frame rather than now. A driver that has stopped ticking is
|
|
466
|
-
* one whose lines may no longer be rendered, and an unrendered line measures as nothing, so a
|
|
467
|
-
* false answer declines both the re-measurement and the re-tick.
|
|
468
|
-
* @param retick - Runs after the re-measurement, on the frame.
|
|
469
|
-
*/
|
|
470
|
-
export declare function scheduleLyricPositionUpdate(engine: AnimationEngineInstance, isViewRendering: () => boolean, retick: () => void): void;
|
|
471
|
-
export {};
|