@music-lyric-player/base 0.13.0 → 0.15.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.
@@ -10,14 +10,18 @@ export declare class BaseLyricPlayer {
10
10
  private state;
11
11
  private active;
12
12
  private time;
13
- private offset;
14
13
  private info;
14
+ private merger;
15
+ private offset;
16
+ private driver;
15
17
  constructor();
16
18
  private onConfigUpdate;
17
19
  private handleGetCurrentTime;
18
20
  private handleGetEffectiveTime;
19
- private handleRefreshOffset;
20
- private handleGetLineTime;
21
+ /**
22
+ * Rebuild the merged line-end table from the current lyric and merge config.
23
+ */
24
+ private handleBuildMergedLineEnd;
21
25
  private handleGetActiveIndex;
22
26
  private handleBridgeActive;
23
27
  private handleEmitLinesUpdate;
@@ -27,6 +31,7 @@ export declare class BaseLyricPlayer {
27
31
  updateLyric(info: Lyric.Info): void;
28
32
  /**
29
33
  * Start playback
34
+ *
30
35
  * @param time Optional time in ms to seek to before starting playback. If not provided, playback will start from the current position.
31
36
  */
32
37
  play(time?: number): void;
@@ -40,13 +45,17 @@ export declare class BaseLyricPlayer {
40
45
  dispose(): void;
41
46
  /**
42
47
  * Update the temp offset in ms (the user's temporary adjustment).
48
+ *
43
49
  * Stacked on top of the global config offset and the lyric's meta offset, then resyncs immediately.
50
+ *
44
51
  * @param value temp offset in ms; non-finite values are treated as 0.
45
52
  */
46
53
  updateTempOffset(value: number): void;
47
54
  /**
48
55
  * Find all active lines at the given time (ms). Does not mutate internal state.
56
+ *
49
57
  * Assumes `info.lines` is sorted by `time.start` ascending.
58
+ *
50
59
  * @param time time in ms to find active lines for.
51
60
  */
52
61
  matchLinesWithTime(time: number): {
@@ -55,7 +64,9 @@ export declare class BaseLyricPlayer {
55
64
  };
56
65
  /**
57
66
  * Convert a content (lyric) time to the playback clock by removing the active offset.
67
+ *
58
68
  * Seeking playback to the returned time makes a line at `contentTime` become active.
69
+ *
59
70
  * @param contentTime content time in ms (e.g. a line's start).
60
71
  */
61
72
  convertContentTime(contentTime: number): number;
@@ -169,6 +180,26 @@ declare interface Root {
169
180
  * @default true
170
181
  */
171
182
  bridgeActive?: boolean;
183
+ /**
184
+ * Merge the deactivation of consecutive lines whose raw end times fall within this many ms,
185
+ * so close‑ending lines leave the active state together instead of one‑by‑one, avoiding a double scroll jump.
186
+ *
187
+ * Earlier‑ending lines are only ever extended to the cluster's later end, never cut short.
188
+ * `0` disables merging.
189
+ *
190
+ * @default 300
191
+ */
192
+ mergeWindow?: number;
193
+ /**
194
+ * Maximum number of consecutive lines that {@link mergeWindow} may fold into a single deactivation batch.
195
+ *
196
+ * When a run of close‑ending lines is longer than this, the batch is force‑flushed every `mergeLimit` lines so no batch ever holds more than this many lines.
197
+ *
198
+ * A value of `0` or less removes the cap; `1` effectively disables merging.
199
+ *
200
+ * @default 3
201
+ */
202
+ mergeLimit?: number;
172
203
  /**
173
204
  * Lyric time offset settings.
174
205
  */