@gondola-lyrics/kit 0.4.0 → 0.6.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.
@@ -3,15 +3,18 @@ import { runtime } from '@gondola-lyrics/model';
3
3
  /**
4
4
  * Generates text in the requested format, which need not match `lyric.format`.
5
5
  *
6
- * The writer map pairs each format's options with its result and requires a writer for every supported format.
6
+ * The writer map pairs options with results only for formats that have an implemented writer.
7
7
  * An unknown target returns `null`.
8
8
  */
9
- export declare const generate: <Target extends LyricFormat>(lyric: runtime.Lyric, target: Target, options?: GenerateOptions[Target]) => GenerateResults[Target] | null;
9
+ export declare const generate: <Target extends GenerateFormat>(lyric: runtime.Lyric, target: Target, options?: GenerateOptions[Target]) => GenerateResults[Target] | null;
10
+
11
+ export declare type GenerateFormat = keyof GenerateOptions;
10
12
 
11
13
  /**
12
14
  * Generates the LRC text plus the annotations a single file cannot hold.
13
15
  *
14
16
  * Word tags appear only for a word-timed lyric when `wordTiming` is not `none`; otherwise every line stays whole.
17
+ * Word romanizations retain token boundaries; explicit line romanizations take precedence for the same language.
15
18
  */
16
19
  export declare const generateLrc: (lyric: runtime.Lyric, options?: LrcGenerateOptions) => LrcGenerateResult;
17
20
 
@@ -30,6 +33,7 @@ declare interface GenerateResults {
30
33
  *
31
34
  * Offsets are baked into timestamps; a negative result or a missing required time throws.
32
35
  * Profile mappings retain the lead agent and first AMLL ruby, omitting unsupported fields and instrumental nodes.
36
+ * Word romanizations are emitted as line text without their token timing.
33
37
  */
34
38
  export declare const generateTtml: (lyric: runtime.Lyric, options?: TtmlGenerateOptions) => TtmlGenerateResult;
35
39
 
@@ -63,7 +67,7 @@ export declare type LrcGenerateResult = LrcContent;
63
67
  /**
64
68
  * Values match the lowercase format names stored in `Lyric.format`.
65
69
  */
66
- export declare type LyricFormat = 'lrc' | 'ttml';
70
+ export declare type LyricFormat = 'lrc' | 'qrc' | 'krc' | 'kwrc' | 'yrc' | 'ttml';
67
71
 
68
72
  export declare interface TtmlGenerateOptions {
69
73
  /**
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { Diagnostic } from '@gondola-lyrics/model/runtime';
2
2
  import { runtime } from '@gondola-lyrics/model';
3
3
 
4
+ export declare const DEFAULT_CREDIT_NAME_SEPARATORS: readonly ["+", ":", "/"];
5
+
4
6
  /**
5
7
  * Derives emphasis for normal words in lead and background vocals using complete, valid word ranges.
6
8
  * The stored word duration must strictly exceed durationThreshold; metadata offset and duration have no effect.
@@ -29,6 +31,32 @@ export declare interface DeriveWordEmphasisOptions {
29
31
  */
30
32
  export declare const detectFormat: (input: unknown) => LyricFormat | undefined;
31
33
 
34
+ /**
35
+ * Extracts colon-prefixed performers and carries them across nonempty normal lines, replacing their existing agent lists.
36
+ * Missing bindings enables legacy name inference; supplied bindings accept exact prefixes and reset propagation on unmatched prefixes.
37
+ * Removing prefixes preserves retained line and word times, but drops prefix-only lines with their attached content.
38
+ *
39
+ * @returns The input when unchanged, or a new lyric sharing all unchanged nodes.
40
+ *
41
+ * @throws {TypeError} If bindings reference an agent id absent from lyric.agents.
42
+ */
43
+ export declare const extractAgents: (lyric: runtime.Lyric, options?: ExtractAgentsOptions) => runtime.Lyric;
44
+
45
+ export declare interface ExtractAgentsOptions {
46
+ /**
47
+ * Maps complete, trimmed prefixes to existing agent ids, preserving array order for joint performers.
48
+ * Matching is case-sensitive and preserves internal whitespace; an empty object disables automatic inference.
49
+ * Omitting this option enables legacy name inference; explicit bindings override its clock exclusion.
50
+ */
51
+ bindings?: Readonly<Record<string, string | readonly string[]>>;
52
+ /**
53
+ * Removes matched prefixes and drops lines left with no sung text, including their attached content.
54
+ *
55
+ * @default true
56
+ */
57
+ removePrefixes?: boolean;
58
+ }
59
+
32
60
  /**
33
61
  * Pulls bracketed background vocals out of the sung lines and attaches them to the line they accompany.
34
62
  *
@@ -61,18 +89,56 @@ export declare interface ExtractBackgroundLinesOptions {
61
89
  crossLine?: boolean;
62
90
  }
63
91
 
92
+ /**
93
+ * Preserves source labels and name spelling while matching normalized credit labels in normal lead lines.
94
+ * Merges names by role and original label without inferring their language.
95
+ * Unknown metadata is processed only when matchUnknowns is enabled; consumed entries leave the unknown list.
96
+ *
97
+ * @returns The input when unchanged, or a new lyric sharing all unchanged nodes.
98
+ */
99
+ export declare const extractCredits: (lyric: runtime.Lyric, options?: ExtractCreditsOptions) => runtime.Lyric;
100
+
101
+ export declare interface ExtractCreditsOptions {
102
+ /**
103
+ * Matches existing unknown metadata keys as credit labels and consumes fully readable matches.
104
+ * Values use nameSeparators; unrecognized keys and values with no readable names remain unchanged.
105
+ *
106
+ * @default false
107
+ */
108
+ matchUnknowns?: boolean;
109
+ /**
110
+ * Removes successfully extracted source lines together with their backgrounds and annotations.
111
+ * Extracted roles and names remain in metadata; attached content is not moved to other lines.
112
+ *
113
+ * Refreshes language usages and falls back to line timing when no word-level content remains.
114
+ *
115
+ * @default false
116
+ */
117
+ removeSourceLines?: boolean;
118
+ /**
119
+ * Splits names at literal separators and ignores empty strings; an empty list preserves the complete source name.
120
+ * Longer separators take precedence so overlapping delimiters remain predictable.
121
+ *
122
+ * @default DEFAULT_CREDIT_NAME_SEPARATORS
123
+ */
124
+ nameSeparators?: readonly string[];
125
+ }
126
+
64
127
  /**
65
128
  * Generates text in the requested format, which need not match `lyric.format`.
66
129
  *
67
- * The writer map pairs each format's options with its result and requires a writer for every supported format.
130
+ * The writer map pairs options with results only for formats that have an implemented writer.
68
131
  * An unknown target returns `null`.
69
132
  */
70
- export declare const generate: <Target extends LyricFormat>(lyric: runtime.Lyric, target: Target, options?: GenerateOptions[Target]) => GenerateResults[Target] | null;
133
+ export declare const generate: <Target extends GenerateFormat>(lyric: runtime.Lyric, target: Target, options?: GenerateOptions[Target]) => GenerateResults[Target] | null;
134
+
135
+ export declare type GenerateFormat = keyof GenerateOptions;
71
136
 
72
137
  /**
73
138
  * Generates the LRC text plus the annotations a single file cannot hold.
74
139
  *
75
140
  * Word tags appear only for a word-timed lyric when `wordTiming` is not `none`; otherwise every line stays whole.
141
+ * Word romanizations retain token boundaries; explicit line romanizations take precedence for the same language.
76
142
  */
77
143
  export declare const generateLrc: (lyric: runtime.Lyric, options?: LrcGenerateOptions) => LrcGenerateResult;
78
144
 
@@ -91,6 +157,7 @@ declare interface GenerateResults {
91
157
  *
92
158
  * Offsets are baked into timestamps; a negative result or a missing required time throws.
93
159
  * Profile mappings retain the lead agent and first AMLL ruby, omitting unsupported fields and instrumental nodes.
160
+ * Word romanizations are emitted as line text without their token timing.
94
161
  */
95
162
  export declare const generateTtml: (lyric: runtime.Lyric, options?: TtmlGenerateOptions) => TtmlGenerateResult;
96
163
 
@@ -196,6 +263,16 @@ export declare const InsertSpacesRules: {
196
263
  readonly TRIM_INSIDE_SYMBOLS: "trimInsideSymbols";
197
264
  };
198
265
 
266
+ declare interface KrcContent {
267
+ original: string;
268
+ }
269
+
270
+ export declare type KrcParseInput = KrcContent;
271
+
272
+ export declare interface KwrcParseInput {
273
+ original: string;
274
+ }
275
+
199
276
  declare interface LrcContent {
200
277
  original: string;
201
278
  translations?: string;
@@ -231,28 +308,86 @@ export declare interface LrcParseOptions {
231
308
  * Defaults to `0`, which requires an exact match.
232
309
  */
233
310
  annotationTolerance?: number;
311
+ /**
312
+ * Maximum roman token drift outside a matched word, in milliseconds; matched boundaries are adjusted to that word.
313
+ * Original word timing is preserved, and incomplete word matches retain the source line romanization.
314
+ *
315
+ * @default 0
316
+ */
317
+ wordAnnotationTolerance?: number;
318
+ /**
319
+ * Recovers unmatched roman fragments from unique two-kana combination starts or equal-sized gaps between timing anchors.
320
+ * Only a base kana followed by its small kana combines; doubled consonants and long vowels retain the whole line romanization.
321
+ * Recovered token times are clipped to their original word; untimed fragments inherit its range.
322
+ *
323
+ * @default false
324
+ */
325
+ wordAnnotationFallback?: boolean;
234
326
  }
235
327
 
236
328
  /**
237
329
  * Values match the lowercase format names stored in `Lyric.format`.
238
330
  */
239
- export declare type LyricFormat = 'lrc' | 'ttml';
331
+ export declare type LyricFormat = 'lrc' | 'qrc' | 'krc' | 'kwrc' | 'yrc' | 'ttml';
332
+
333
+ /**
334
+ * Categories the bundled filter rules identify, in rule order.
335
+ */
336
+ export declare const NON_LYRIC_CATEGORIES: readonly string[];
240
337
 
241
338
  /**
242
339
  * Unrecognized text returns `null`; a recognized format returns its canonical lyric and diagnostics.
243
340
  * Annotation tracks travel with the source and are attached by the format's parser.
244
341
  */
245
- export declare const parse: (input: unknown, options?: LrcParseOptions & TtmlParseOptions) => ParseResult | null;
342
+ export declare const parse: (input: unknown, options?: LrcParseOptions & QrcParseOptions & TtmlParseOptions & YrcParseOptions) => ParseResult | null;
343
+
344
+ /**
345
+ * Parses decrypted Kugou lyrics, retaining explicit durations and attaching embedded annotations by source slot.
346
+ *
347
+ * A source carrying no KRC row is read as LRC, so a platform fallback keeps its container annotations.
348
+ * Placeholder slots carry no annotation, so they never keep a credit line in the stream.
349
+ * Kana supplies whole-word ruby; type 0 language tracks retain complete line romanization.
350
+ * Incomplete metadata remains available in unknowns, and source timing violations remain visible in diagnostics.
351
+ *
352
+ * @param input Decrypted plaintext or an object containing its original text.
353
+ *
354
+ * @returns Canonical lyrics and model diagnostics; no readable timed rows yields INVALID status.
355
+ */
356
+ export declare const parseKrc: (input: string | KrcParseInput) => ParseResult;
357
+
358
+ /**
359
+ * Parses decoded KWRC with explicit word durations and structurally verified embedded translations.
360
+ *
361
+ * Missing or conflicting parameters and unsafe word calculations retain the complete row as line-level text.
362
+ * Plain LRC remains readable; offset is stored as metadata without changing source timestamps.
363
+ *
364
+ * @param input Decoded plaintext or an object containing its original text.
365
+ *
366
+ * @returns Canonical lyrics and model diagnostics; no readable timed rows yields INVALID status.
367
+ */
368
+ export declare const parseKwrc: (input: string | KwrcParseInput) => ParseResult;
246
369
 
247
370
  /**
248
371
  * Empty timed rows become instrumental lines; source order and missing word times remain for model validation.
249
372
  *
250
373
  * Annotation tracks are read as lines too and attached by timestamp, and rows that match no line are dropped.
374
+ * Complete roman tracks attach to words by timing and optional local recovery; other tracks retain their source line text.
251
375
  *
252
376
  * `INVALID` means no readable timed lines; the returned diagnostics carry whatever the canonical tree breaks.
253
377
  */
254
378
  export declare const parseLrc: (input: string | LrcParseInput, options?: LrcParseOptions) => ParseResult;
255
379
 
380
+ /**
381
+ * Parses plaintext or XML QRC, retaining explicit timing, word romanization, and ruby from kana metadata.
382
+ * Original-track kana supplies ruby and is removed from the returned metadata.
383
+ *
384
+ * @param input Original lyrics with optional translation and romanization tracks.
385
+ * @param options Independent line and word tolerances, with optional local roman recovery.
386
+ *
387
+ * @returns Canonical lyrics and source diagnostics; an empty result has INVALID status.
388
+ */
389
+ export declare const parseQrc: (input: string | QrcParseInput, options?: QrcParseOptions) => ParseResult;
390
+
256
391
  /**
257
392
  * A parsed lyric in canonical form, with every rule it breaks.
258
393
  */
@@ -269,6 +404,77 @@ export declare interface ParseResult {
269
404
  */
270
405
  export declare const parseTtml: (input: TtmlParseInput, options?: TtmlParseOptions) => ParseResult;
271
406
 
407
+ /**
408
+ * Parses native YRC or LRC fallback, keeping JSON display rows separate from annotation matching.
409
+ * Explicit line and word durations remain unchanged, including zero durations and source timing violations.
410
+ * JSON credit content becomes separate plain-text unknown entries sharing the source label and is omitted from lyric lines.
411
+ *
412
+ * @param input Plaintext tracks on the same timeline: yrc with ytlrc/yromalrc, or lrc with tlyric/romalrc.
413
+ * @param options Independent line and word tolerances, with optional local roman recovery.
414
+ *
415
+ * @returns Canonical lyrics and model diagnostics; no readable timed rows yields INVALID status.
416
+ */
417
+ export declare const parseYrc: (input: string | YrcParseInput, options?: YrcParseOptions) => ParseResult;
418
+
419
+ declare interface QrcContent {
420
+ original: string;
421
+ translations?: string;
422
+ romans?: string;
423
+ }
424
+
425
+ export declare type QrcParseInput = QrcContent;
426
+
427
+ export declare interface QrcParseOptions {
428
+ /**
429
+ * Extra tolerance in milliseconds for line annotations left after exact time and row order matching.
430
+ *
431
+ * @default 0
432
+ */
433
+ annotationTolerance?: number;
434
+ /**
435
+ * Extra word-boundary tolerance in milliseconds; native QRC tracks allow at least 1ms for rounding.
436
+ * LRC auxiliary tracks use exact word boundaries by default, and incomplete matches retain the whole line romanization.
437
+ *
438
+ * @default 0
439
+ */
440
+ wordAnnotationTolerance?: number;
441
+ /**
442
+ * Recovers unmatched roman fragments from unique two-kana combination starts or equal-sized gaps between timing anchors.
443
+ * Only a base kana followed by its small kana combines; doubled consonants and long vowels retain the whole line romanization.
444
+ * Recovered token times are clipped to their original word; untimed fragments inherit its range.
445
+ *
446
+ * @default false
447
+ */
448
+ wordAnnotationFallback?: boolean;
449
+ }
450
+
451
+ /**
452
+ * Removes normal lead lines matched by the shared notice rules and, when musicInfo is provided, first-line song information.
453
+ * The first non-empty normal line must have one literal " - " separator and a known title and artist on opposite sides; either order and extra text such as bracketed aliases are accepted.
454
+ * Drops attached annotations and backgrounds, refreshes language usages, and falls back to line timing when no word-level content remains.
455
+ *
456
+ * @returns The input when unchanged, or a new lyric sharing all unchanged nodes.
457
+ */
458
+ export declare const removeNonLyricLines: (lyric: runtime.Lyric, options?: RemoveNonLyricLinesOptions) => runtime.Lyric;
459
+
460
+ export declare interface RemoveNonLyricLinesOptions {
461
+ /**
462
+ * Removes lines identified under these categories; an empty list skips the shared rules.
463
+ * First-line music information is selected independently.
464
+ *
465
+ * @default NON_LYRIC_CATEGORIES
466
+ */
467
+ categories?: readonly string[];
468
+ /**
469
+ * Enables first-line music-information matching using these known titles and artists.
470
+ * Omitting this option, or leaving either list empty, skips the check; lyric metadata is not inferred.
471
+ */
472
+ musicInfo?: {
473
+ titles?: readonly string[];
474
+ artists?: readonly string[];
475
+ };
476
+ }
477
+
272
478
  /**
273
479
  * Removes the brackets some sources wrap around background vocals.
274
480
  *
@@ -307,4 +513,36 @@ export declare interface TtmlParseOptions {
307
513
 
308
514
  export declare type TtmlProfile = 'amll' | 'itunes';
309
515
 
516
+ declare interface YrcContent {
517
+ original: string;
518
+ translations?: string;
519
+ romans?: string;
520
+ }
521
+
522
+ export declare type YrcParseInput = YrcContent;
523
+
524
+ export declare interface YrcParseOptions {
525
+ /**
526
+ * Extra timestamp drift allowed after exact and source-precision matching, in milliseconds.
527
+ * Tracks must share the original timeline; equal row counts never enable order matching.
528
+ *
529
+ * @default 0
530
+ */
531
+ annotationTolerance?: number;
532
+ /**
533
+ * Maximum roman token drift outside a matched word, in milliseconds; matched boundaries are adjusted to that word.
534
+ * Original word timing is preserved, and incomplete matches retain the whole line romanization.
535
+ *
536
+ * @default 0
537
+ */
538
+ wordAnnotationTolerance?: number;
539
+ /**
540
+ * Recovers roman fragments from unique two-kana combination starts or equal-sized gaps between timing anchors.
541
+ * Recovered token times are clipped to their original word; untimed fragments inherit its range.
542
+ *
543
+ * @default false
544
+ */
545
+ wordAnnotationFallback?: boolean;
546
+ }
547
+
310
548
  export { }
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { detectFormat, generate, generateLrc, generateTtml, parse, parseLrc, parseTtml } from "./formats.js";
2
- import { InsertSpacesRules, deriveWordEmphasis, extractBackgroundLines, insertInstrumentalLines, insertSpacesInLines, stripBackgroundBrackets } from "./transforms.js";
1
+ import { detectFormat, generate, generateLrc, generateTtml, parse, parseKrc, parseKwrc, parseLrc, parseQrc, parseTtml, parseYrc } from "./formats.js";
2
+ import { DEFAULT_CREDIT_NAME_SEPARATORS, InsertSpacesRules, NON_LYRIC_CATEGORIES, deriveWordEmphasis, extractAgents, extractBackgroundLines, extractCredits, insertInstrumentalLines, insertSpacesInLines, removeNonLyricLines, stripBackgroundBrackets } from "./transforms.js";
3
3
  import "./parser.js";
4
4
  import "./generator.js";
5
- export { InsertSpacesRules, deriveWordEmphasis, detectFormat, extractBackgroundLines, generate, generateLrc, generateTtml, insertInstrumentalLines, insertSpacesInLines, parse, parseLrc, parseTtml, stripBackgroundBrackets };
5
+ export { DEFAULT_CREDIT_NAME_SEPARATORS, InsertSpacesRules, NON_LYRIC_CATEGORIES, deriveWordEmphasis, detectFormat, extractAgents, extractBackgroundLines, extractCredits, generate, generateLrc, generateTtml, insertInstrumentalLines, insertSpacesInLines, parse, parseKrc, parseKwrc, parseLrc, parseQrc, parseTtml, parseYrc, removeNonLyricLines, stripBackgroundBrackets };
package/dist/parser.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { Diagnostic } from '@gondola-lyrics/model/runtime';
2
2
  import { runtime } from '@gondola-lyrics/model';
3
3
 
4
+ export declare const DEFAULT_CREDIT_NAME_SEPARATORS: readonly ["+", ":", "/"];
5
+
4
6
  /**
5
7
  * Derives emphasis for normal words in lead and background vocals using complete, valid word ranges.
6
8
  * The stored word duration must strictly exceed durationThreshold; metadata offset and duration have no effect.
@@ -29,6 +31,32 @@ export declare interface DeriveWordEmphasisOptions {
29
31
  */
30
32
  export declare const detectFormat: (input: unknown) => LyricFormat | undefined;
31
33
 
34
+ /**
35
+ * Extracts colon-prefixed performers and carries them across nonempty normal lines, replacing their existing agent lists.
36
+ * Missing bindings enables legacy name inference; supplied bindings accept exact prefixes and reset propagation on unmatched prefixes.
37
+ * Removing prefixes preserves retained line and word times, but drops prefix-only lines with their attached content.
38
+ *
39
+ * @returns The input when unchanged, or a new lyric sharing all unchanged nodes.
40
+ *
41
+ * @throws {TypeError} If bindings reference an agent id absent from lyric.agents.
42
+ */
43
+ export declare const extractAgents: (lyric: runtime.Lyric, options?: ExtractAgentsOptions) => runtime.Lyric;
44
+
45
+ export declare interface ExtractAgentsOptions {
46
+ /**
47
+ * Maps complete, trimmed prefixes to existing agent ids, preserving array order for joint performers.
48
+ * Matching is case-sensitive and preserves internal whitespace; an empty object disables automatic inference.
49
+ * Omitting this option enables legacy name inference; explicit bindings override its clock exclusion.
50
+ */
51
+ bindings?: Readonly<Record<string, string | readonly string[]>>;
52
+ /**
53
+ * Removes matched prefixes and drops lines left with no sung text, including their attached content.
54
+ *
55
+ * @default true
56
+ */
57
+ removePrefixes?: boolean;
58
+ }
59
+
32
60
  /**
33
61
  * Pulls bracketed background vocals out of the sung lines and attaches them to the line they accompany.
34
62
  *
@@ -61,6 +89,41 @@ export declare interface ExtractBackgroundLinesOptions {
61
89
  crossLine?: boolean;
62
90
  }
63
91
 
92
+ /**
93
+ * Preserves source labels and name spelling while matching normalized credit labels in normal lead lines.
94
+ * Merges names by role and original label without inferring their language.
95
+ * Unknown metadata is processed only when matchUnknowns is enabled; consumed entries leave the unknown list.
96
+ *
97
+ * @returns The input when unchanged, or a new lyric sharing all unchanged nodes.
98
+ */
99
+ export declare const extractCredits: (lyric: runtime.Lyric, options?: ExtractCreditsOptions) => runtime.Lyric;
100
+
101
+ export declare interface ExtractCreditsOptions {
102
+ /**
103
+ * Matches existing unknown metadata keys as credit labels and consumes fully readable matches.
104
+ * Values use nameSeparators; unrecognized keys and values with no readable names remain unchanged.
105
+ *
106
+ * @default false
107
+ */
108
+ matchUnknowns?: boolean;
109
+ /**
110
+ * Removes successfully extracted source lines together with their backgrounds and annotations.
111
+ * Extracted roles and names remain in metadata; attached content is not moved to other lines.
112
+ *
113
+ * Refreshes language usages and falls back to line timing when no word-level content remains.
114
+ *
115
+ * @default false
116
+ */
117
+ removeSourceLines?: boolean;
118
+ /**
119
+ * Splits names at literal separators and ignores empty strings; an empty list preserves the complete source name.
120
+ * Longer separators take precedence so overlapping delimiters remain predictable.
121
+ *
122
+ * @default DEFAULT_CREDIT_NAME_SEPARATORS
123
+ */
124
+ nameSeparators?: readonly string[];
125
+ }
126
+
64
127
  /**
65
128
  * Inserts derived instrumental lines into uncovered gaps on the stored timeline, starting at zero.
66
129
  * Existing lines and background vocals occupy their full ranges; an unknown end blocks later gaps.
@@ -163,6 +226,16 @@ export declare const InsertSpacesRules: {
163
226
  readonly TRIM_INSIDE_SYMBOLS: "trimInsideSymbols";
164
227
  };
165
228
 
229
+ declare interface KrcContent {
230
+ original: string;
231
+ }
232
+
233
+ export declare type KrcParseInput = KrcContent;
234
+
235
+ export declare interface KwrcParseInput {
236
+ original: string;
237
+ }
238
+
166
239
  declare interface LrcContent {
167
240
  original: string;
168
241
  translations?: string;
@@ -177,28 +250,86 @@ export declare interface LrcParseOptions {
177
250
  * Defaults to `0`, which requires an exact match.
178
251
  */
179
252
  annotationTolerance?: number;
253
+ /**
254
+ * Maximum roman token drift outside a matched word, in milliseconds; matched boundaries are adjusted to that word.
255
+ * Original word timing is preserved, and incomplete word matches retain the source line romanization.
256
+ *
257
+ * @default 0
258
+ */
259
+ wordAnnotationTolerance?: number;
260
+ /**
261
+ * Recovers unmatched roman fragments from unique two-kana combination starts or equal-sized gaps between timing anchors.
262
+ * Only a base kana followed by its small kana combines; doubled consonants and long vowels retain the whole line romanization.
263
+ * Recovered token times are clipped to their original word; untimed fragments inherit its range.
264
+ *
265
+ * @default false
266
+ */
267
+ wordAnnotationFallback?: boolean;
180
268
  }
181
269
 
182
270
  /**
183
271
  * Values match the lowercase format names stored in `Lyric.format`.
184
272
  */
185
- export declare type LyricFormat = 'lrc' | 'ttml';
273
+ export declare type LyricFormat = 'lrc' | 'qrc' | 'krc' | 'kwrc' | 'yrc' | 'ttml';
274
+
275
+ /**
276
+ * Categories the bundled filter rules identify, in rule order.
277
+ */
278
+ export declare const NON_LYRIC_CATEGORIES: readonly string[];
186
279
 
187
280
  /**
188
281
  * Unrecognized text returns `null`; a recognized format returns its canonical lyric and diagnostics.
189
282
  * Annotation tracks travel with the source and are attached by the format's parser.
190
283
  */
191
- export declare const parse: (input: unknown, options?: LrcParseOptions & TtmlParseOptions) => ParseResult | null;
284
+ export declare const parse: (input: unknown, options?: LrcParseOptions & QrcParseOptions & TtmlParseOptions & YrcParseOptions) => ParseResult | null;
285
+
286
+ /**
287
+ * Parses decrypted Kugou lyrics, retaining explicit durations and attaching embedded annotations by source slot.
288
+ *
289
+ * A source carrying no KRC row is read as LRC, so a platform fallback keeps its container annotations.
290
+ * Placeholder slots carry no annotation, so they never keep a credit line in the stream.
291
+ * Kana supplies whole-word ruby; type 0 language tracks retain complete line romanization.
292
+ * Incomplete metadata remains available in unknowns, and source timing violations remain visible in diagnostics.
293
+ *
294
+ * @param input Decrypted plaintext or an object containing its original text.
295
+ *
296
+ * @returns Canonical lyrics and model diagnostics; no readable timed rows yields INVALID status.
297
+ */
298
+ export declare const parseKrc: (input: string | KrcParseInput) => ParseResult;
299
+
300
+ /**
301
+ * Parses decoded KWRC with explicit word durations and structurally verified embedded translations.
302
+ *
303
+ * Missing or conflicting parameters and unsafe word calculations retain the complete row as line-level text.
304
+ * Plain LRC remains readable; offset is stored as metadata without changing source timestamps.
305
+ *
306
+ * @param input Decoded plaintext or an object containing its original text.
307
+ *
308
+ * @returns Canonical lyrics and model diagnostics; no readable timed rows yields INVALID status.
309
+ */
310
+ export declare const parseKwrc: (input: string | KwrcParseInput) => ParseResult;
192
311
 
193
312
  /**
194
313
  * Empty timed rows become instrumental lines; source order and missing word times remain for model validation.
195
314
  *
196
315
  * Annotation tracks are read as lines too and attached by timestamp, and rows that match no line are dropped.
316
+ * Complete roman tracks attach to words by timing and optional local recovery; other tracks retain their source line text.
197
317
  *
198
318
  * `INVALID` means no readable timed lines; the returned diagnostics carry whatever the canonical tree breaks.
199
319
  */
200
320
  export declare const parseLrc: (input: string | LrcParseInput, options?: LrcParseOptions) => ParseResult;
201
321
 
322
+ /**
323
+ * Parses plaintext or XML QRC, retaining explicit timing, word romanization, and ruby from kana metadata.
324
+ * Original-track kana supplies ruby and is removed from the returned metadata.
325
+ *
326
+ * @param input Original lyrics with optional translation and romanization tracks.
327
+ * @param options Independent line and word tolerances, with optional local roman recovery.
328
+ *
329
+ * @returns Canonical lyrics and source diagnostics; an empty result has INVALID status.
330
+ */
331
+ export declare const parseQrc: (input: string | QrcParseInput, options?: QrcParseOptions) => ParseResult;
332
+
202
333
  /**
203
334
  * A parsed lyric in canonical form, with every rule it breaks.
204
335
  */
@@ -215,6 +346,77 @@ export declare interface ParseResult {
215
346
  */
216
347
  export declare const parseTtml: (input: TtmlParseInput, options?: TtmlParseOptions) => ParseResult;
217
348
 
349
+ /**
350
+ * Parses native YRC or LRC fallback, keeping JSON display rows separate from annotation matching.
351
+ * Explicit line and word durations remain unchanged, including zero durations and source timing violations.
352
+ * JSON credit content becomes separate plain-text unknown entries sharing the source label and is omitted from lyric lines.
353
+ *
354
+ * @param input Plaintext tracks on the same timeline: yrc with ytlrc/yromalrc, or lrc with tlyric/romalrc.
355
+ * @param options Independent line and word tolerances, with optional local roman recovery.
356
+ *
357
+ * @returns Canonical lyrics and model diagnostics; no readable timed rows yields INVALID status.
358
+ */
359
+ export declare const parseYrc: (input: string | YrcParseInput, options?: YrcParseOptions) => ParseResult;
360
+
361
+ declare interface QrcContent {
362
+ original: string;
363
+ translations?: string;
364
+ romans?: string;
365
+ }
366
+
367
+ export declare type QrcParseInput = QrcContent;
368
+
369
+ export declare interface QrcParseOptions {
370
+ /**
371
+ * Extra tolerance in milliseconds for line annotations left after exact time and row order matching.
372
+ *
373
+ * @default 0
374
+ */
375
+ annotationTolerance?: number;
376
+ /**
377
+ * Extra word-boundary tolerance in milliseconds; native QRC tracks allow at least 1ms for rounding.
378
+ * LRC auxiliary tracks use exact word boundaries by default, and incomplete matches retain the whole line romanization.
379
+ *
380
+ * @default 0
381
+ */
382
+ wordAnnotationTolerance?: number;
383
+ /**
384
+ * Recovers unmatched roman fragments from unique two-kana combination starts or equal-sized gaps between timing anchors.
385
+ * Only a base kana followed by its small kana combines; doubled consonants and long vowels retain the whole line romanization.
386
+ * Recovered token times are clipped to their original word; untimed fragments inherit its range.
387
+ *
388
+ * @default false
389
+ */
390
+ wordAnnotationFallback?: boolean;
391
+ }
392
+
393
+ /**
394
+ * Removes normal lead lines matched by the shared notice rules and, when musicInfo is provided, first-line song information.
395
+ * The first non-empty normal line must have one literal " - " separator and a known title and artist on opposite sides; either order and extra text such as bracketed aliases are accepted.
396
+ * Drops attached annotations and backgrounds, refreshes language usages, and falls back to line timing when no word-level content remains.
397
+ *
398
+ * @returns The input when unchanged, or a new lyric sharing all unchanged nodes.
399
+ */
400
+ export declare const removeNonLyricLines: (lyric: runtime.Lyric, options?: RemoveNonLyricLinesOptions) => runtime.Lyric;
401
+
402
+ export declare interface RemoveNonLyricLinesOptions {
403
+ /**
404
+ * Removes lines identified under these categories; an empty list skips the shared rules.
405
+ * First-line music information is selected independently.
406
+ *
407
+ * @default NON_LYRIC_CATEGORIES
408
+ */
409
+ categories?: readonly string[];
410
+ /**
411
+ * Enables first-line music-information matching using these known titles and artists.
412
+ * Omitting this option, or leaving either list empty, skips the check; lyric metadata is not inferred.
413
+ */
414
+ musicInfo?: {
415
+ titles?: readonly string[];
416
+ artists?: readonly string[];
417
+ };
418
+ }
419
+
218
420
  /**
219
421
  * Removes the brackets some sources wrap around background vocals.
220
422
  *
@@ -234,4 +436,36 @@ export declare interface TtmlParseOptions {
234
436
 
235
437
  export declare type TtmlProfile = 'amll' | 'itunes';
236
438
 
439
+ declare interface YrcContent {
440
+ original: string;
441
+ translations?: string;
442
+ romans?: string;
443
+ }
444
+
445
+ export declare type YrcParseInput = YrcContent;
446
+
447
+ export declare interface YrcParseOptions {
448
+ /**
449
+ * Extra timestamp drift allowed after exact and source-precision matching, in milliseconds.
450
+ * Tracks must share the original timeline; equal row counts never enable order matching.
451
+ *
452
+ * @default 0
453
+ */
454
+ annotationTolerance?: number;
455
+ /**
456
+ * Maximum roman token drift outside a matched word, in milliseconds; matched boundaries are adjusted to that word.
457
+ * Original word timing is preserved, and incomplete matches retain the whole line romanization.
458
+ *
459
+ * @default 0
460
+ */
461
+ wordAnnotationTolerance?: number;
462
+ /**
463
+ * Recovers roman fragments from unique two-kana combination starts or equal-sized gaps between timing anchors.
464
+ * Recovered token times are clipped to their original word; untimed fragments inherit its range.
465
+ *
466
+ * @default false
467
+ */
468
+ wordAnnotationFallback?: boolean;
469
+ }
470
+
237
471
  export { }