@gondola-lyrics/kit 0.2.0 → 0.4.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.
@@ -1 +1,170 @@
1
- export {}
1
+ import { runtime } from '@gondola-lyrics/model';
2
+
3
+ /**
4
+ * Derives emphasis for normal words in lead and background vocals using complete, valid word ranges.
5
+ * The stored word duration must strictly exceed durationThreshold; metadata offset and duration have no effect.
6
+ *
7
+ * Source emphasis, including an explicit false, is preserved; derived emphasis is cleared when a word no longer qualifies.
8
+ *
9
+ * @returns The input when unchanged, or a new lyric sharing all unchanged nodes.
10
+ *
11
+ * @throws {RangeError} If durationThreshold is not a non-negative safe integer in milliseconds.
12
+ */
13
+ export declare const deriveWordEmphasis: (lyric: runtime.Lyric, options?: DeriveWordEmphasisOptions) => runtime.Lyric;
14
+
15
+ export declare interface DeriveWordEmphasisOptions {
16
+ /**
17
+ * Word duration must strictly exceed this threshold, expressed as a non-negative safe integer in milliseconds.
18
+ *
19
+ * @default 3000
20
+ */
21
+ durationThreshold?: number;
22
+ }
23
+
24
+ /**
25
+ * Pulls bracketed background vocals out of the sung lines and attaches them to the line they accompany.
26
+ *
27
+ * A line holding nothing but brackets becomes a background of the line before it and is removed.
28
+ * A bracket opened on one line and closed on a later one joins the line before the opening, and both source lines go.
29
+ * Text outside brackets stays on its line, and a line left with none keeps its place.
30
+ *
31
+ * @returns The input when unchanged, or a new lyric sharing all unchanged nodes.
32
+ */
33
+ export declare const extractBackgroundLines: (lyric: runtime.Lyric, options?: ExtractBackgroundLinesOptions) => runtime.Lyric;
34
+
35
+ export declare interface ExtractBackgroundLinesOptions {
36
+ /**
37
+ * Turn a line holding nothing but brackets into a background line of the line before it.
38
+ *
39
+ * @default true
40
+ */
41
+ fullLine?: boolean;
42
+ /**
43
+ * Pull the bracketed runs inside a line out into background lines of that same line.
44
+ *
45
+ * @default true
46
+ */
47
+ inLine?: boolean;
48
+ /**
49
+ * Join a bracket opened on one line and closed on a later one, attaching it to the line before them.
50
+ *
51
+ * @default true
52
+ */
53
+ crossLine?: boolean;
54
+ }
55
+
56
+ export declare const INSERT_SPACES_RULES: InsertSpacesRule[];
57
+
58
+ /**
59
+ * Inserts derived instrumental lines into uncovered gaps on the stored timeline, starting at zero.
60
+ * Existing lines and background vocals occupy their full ranges; an unknown end blocks later gaps.
61
+ *
62
+ * An outro requires an explicit endTime; metadata duration and offset do not affect insertion.
63
+ *
64
+ * @returns The input when unchanged, or a new lyric and lines array sharing existing nodes.
65
+ */
66
+ export declare const insertInstrumentalLines: (lyric: runtime.Lyric, options?: InsertInstrumentalLinesOptions) => runtime.Lyric;
67
+
68
+ export declare interface InsertInstrumentalLinesOptions {
69
+ /**
70
+ * Minimum gap duration in milliseconds, including an outro.
71
+ *
72
+ * @default 10000
73
+ */
74
+ minDuration?: number;
75
+ /**
76
+ * Minimum gap duration before the first vocal in milliseconds.
77
+ *
78
+ * @default 5000
79
+ */
80
+ minIntroDuration?: number;
81
+ /**
82
+ * Outro boundary in milliseconds, measured on the same timeline as line ranges.
83
+ * An omitted boundary leaves the outro unknown.
84
+ */
85
+ endTime?: number;
86
+ }
87
+
88
+ /**
89
+ * Inserts the spaces a source left out, so CJK text set against Latin letters, digits or punctuation reads evenly.
90
+ *
91
+ * A word-level line keeps every word's time and annotation: an inserted space becomes its own space word,
92
+ * and a word the rules split yields one word per character, all sharing the original range.
93
+ * A plain-text line and the annotation tracks are rewritten as whole strings.
94
+ *
95
+ * @returns The input when unchanged, or a new lyric sharing all unchanged nodes.
96
+ */
97
+ export declare const insertSpacesInLines: (lyric: runtime.Lyric, options?: InsertSpacesOptions) => runtime.Lyric;
98
+
99
+ export declare interface InsertSpacesOptions {
100
+ /**
101
+ * Rules to apply; omitting the list applies all of them.
102
+ */
103
+ rules?: InsertSpacesRule[];
104
+ /**
105
+ * Rewrite the translation and romanization tracks too.
106
+ *
107
+ * @default true
108
+ */
109
+ annotations?: boolean;
110
+ }
111
+
112
+ export declare type InsertSpacesRule = (typeof InsertSpacesRules)[keyof typeof InsertSpacesRules];
113
+
114
+ /**
115
+ * Groups of characters a source may write without a space where one belongs.
116
+ */
117
+ export declare const InsertSpacesRules: {
118
+ /**
119
+ * A CJK character touching a Latin letter, as in `ABC中文`.
120
+ */
121
+ readonly CJK_ENGLISH: "cjkEnglish";
122
+ /**
123
+ * A CJK character touching a digit, as in `2026年`.
124
+ */
125
+ readonly CJK_NUMBER: "cjkNumber";
126
+ /**
127
+ * A comma, semicolon, exclamation mark, question mark or colon touching a character, as in `a,b`; a clock time or thousands separator such as `10:30` stays as written.
128
+ */
129
+ readonly PUNCTUATION: "punctuation";
130
+ /**
131
+ * A quotation mark touching a neighbouring character.
132
+ */
133
+ readonly QUOTE: "quote";
134
+ /**
135
+ * A bracket touching the character outside it.
136
+ */
137
+ readonly BRACKET_OUTSIDE: "bracketOutside";
138
+ /**
139
+ * A plus, equals or ampersand touching a character, as in `a+b`; a compound operator such as `a+=b` stays as written.
140
+ */
141
+ readonly MATH_OPERATOR: "mathOperator";
142
+ /**
143
+ * A hyphen touching a CJK character, as in `中-文`; a compound word such as `well-known` stays as written.
144
+ */
145
+ readonly HYPHEN: "hyphen";
146
+ /**
147
+ * A slash touching a character, as in `and/or`; a fraction such as `1/2` stays as written.
148
+ */
149
+ readonly SLASH: "slash";
150
+ /**
151
+ * Runs of two or more spaces, collapsed to one.
152
+ */
153
+ readonly COMPRESS_SPACES: "compressSpaces";
154
+ /**
155
+ * Spaces just inside a bracket or quotation mark, removed.
156
+ */
157
+ readonly TRIM_INSIDE_SYMBOLS: "trimInsideSymbols";
158
+ };
159
+
160
+ /**
161
+ * Removes the brackets some sources wrap around background vocals.
162
+ *
163
+ * One layer is removed from each edge of every background line, leaving a nested pair as `(x)`.
164
+ * A line left with no content is dropped, since a background line must carry something.
165
+ *
166
+ * @returns The input when unchanged, or a new lyric sharing all unchanged nodes.
167
+ */
168
+ export declare const stripBackgroundBrackets: (lyric: runtime.Lyric) => runtime.Lyric;
169
+
170
+ export { }