@gondola-lyrics/kit 0.2.0 → 0.3.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.
- package/dist/formats.d.ts +40 -14
- package/dist/formats.js +915 -333
- package/dist/formats.js.map +1 -1
- package/dist/generator.d.ts +42 -2
- package/dist/generator.js +1 -1
- package/dist/index.d.ts +42 -6
- package/dist/index.js +1 -1
- package/dist/parser.d.ts +3 -5
- package/package.json +1 -1
package/dist/formats.d.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { Diagnostic } from '@gondola-lyrics/model/runtime';
|
|
2
2
|
import { runtime } from '@gondola-lyrics/model';
|
|
3
3
|
|
|
4
|
-
export declare const AMLL_HINT_PATTERN: RegExp;
|
|
5
|
-
|
|
6
4
|
/**
|
|
7
5
|
* Recognition reads only the original text; the annotation tracks never decide the format.
|
|
8
6
|
*
|
|
9
7
|
* Unrecognized text returns `undefined`.
|
|
10
8
|
*/
|
|
11
|
-
export declare const detectFormat: (input: unknown) =>
|
|
9
|
+
export declare const detectFormat: (input: unknown) => LyricFormat | undefined;
|
|
12
10
|
|
|
13
11
|
/**
|
|
14
12
|
* A single readable time tag is enough for recognition; metadata alone is not.
|
|
@@ -24,14 +22,13 @@ export declare const detectLrc: (input: unknown) => boolean;
|
|
|
24
22
|
*/
|
|
25
23
|
export declare const detectTtml: (input: unknown) => boolean;
|
|
26
24
|
|
|
27
|
-
export declare const FORMAT = "ttml";
|
|
28
|
-
|
|
29
25
|
/**
|
|
30
26
|
* Generates text in the requested format, which need not match `lyric.format`.
|
|
31
27
|
*
|
|
32
|
-
*
|
|
28
|
+
* The writer map pairs each format's options with its result and requires a writer for every supported format.
|
|
29
|
+
* An unknown target returns `null`.
|
|
33
30
|
*/
|
|
34
|
-
export declare const generate: (lyric: runtime.Lyric, target:
|
|
31
|
+
export declare const generate: <Target extends LyricFormat>(lyric: runtime.Lyric, target: Target, options?: GenerateOptions[Target]) => GenerateResults[Target] | null;
|
|
35
32
|
|
|
36
33
|
/**
|
|
37
34
|
* Generates the LRC text plus the annotations a single file cannot hold.
|
|
@@ -40,7 +37,23 @@ export declare const generate: (lyric: runtime.Lyric, target: LyricFormat, optio
|
|
|
40
37
|
*/
|
|
41
38
|
export declare const generateLrc: (lyric: runtime.Lyric, options?: LrcGenerateOptions) => LrcGenerateResult;
|
|
42
39
|
|
|
43
|
-
|
|
40
|
+
declare interface GenerateOptions {
|
|
41
|
+
lrc: LrcGenerateOptions;
|
|
42
|
+
ttml: TtmlGenerateOptions;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
declare interface GenerateResults {
|
|
46
|
+
lrc: LrcGenerateResult;
|
|
47
|
+
ttml: TtmlGenerateResult;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Generates one TTML document, retaining the source profile unless explicitly overridden.
|
|
52
|
+
*
|
|
53
|
+
* Offsets are baked into timestamps; a negative result or a missing required time throws.
|
|
54
|
+
* Profile mappings retain the lead agent and first AMLL ruby, omitting unsupported fields and instrumental nodes.
|
|
55
|
+
*/
|
|
56
|
+
export declare const generateTtml: (lyric: runtime.Lyric, options?: TtmlGenerateOptions) => TtmlGenerateResult;
|
|
44
57
|
|
|
45
58
|
declare interface LrcContent {
|
|
46
59
|
original: string;
|
|
@@ -113,15 +126,28 @@ export declare interface ParseResult {
|
|
|
113
126
|
* The profile only changes where metadata comes from, so one reader serves both.
|
|
114
127
|
* A document that parses but holds no timed paragraph is `INVALID` rather than an error.
|
|
115
128
|
*/
|
|
116
|
-
export declare const parseTtml: (input:
|
|
129
|
+
export declare const parseTtml: (input: TtmlParseInput, options?: TtmlParseOptions) => ParseResult;
|
|
117
130
|
|
|
118
|
-
export declare
|
|
131
|
+
export declare interface TtmlGenerateOptions {
|
|
132
|
+
/**
|
|
133
|
+
* Defaults to the source TTML profile, or `amll` when the lyric came from another format.
|
|
134
|
+
*/
|
|
135
|
+
profile?: TtmlProfile;
|
|
136
|
+
/**
|
|
137
|
+
* Indent document structure; defaults to `false`.
|
|
138
|
+
* Lyric content stays flush to keep formatting whitespace out of the words.
|
|
139
|
+
*/
|
|
140
|
+
indent?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Emit song metadata; defaults to `true`.
|
|
143
|
+
* Agents and annotation tracks are retained because the body references them.
|
|
144
|
+
*/
|
|
145
|
+
includeMeta?: boolean;
|
|
146
|
+
}
|
|
119
147
|
|
|
120
|
-
export declare
|
|
148
|
+
export declare type TtmlGenerateResult = string;
|
|
121
149
|
|
|
122
|
-
export declare
|
|
123
|
-
original: string;
|
|
124
|
-
}
|
|
150
|
+
export declare type TtmlParseInput = string;
|
|
125
151
|
|
|
126
152
|
export declare interface TtmlParseOptions {
|
|
127
153
|
/** Language tag the lyric declares; the document's own `xml:lang` wins when it states one. */
|