@uimaxbai/am-lyrics 0.6.0 → 0.6.2
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/src/AmLyrics.d.ts.map +1 -1
- package/dist/src/am-lyrics.js +70 -60
- package/dist/src/am-lyrics.js.map +1 -1
- package/dist/src/react.js +70 -60
- package/dist/src/react.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/AmLyrics.ts +70 -61
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmLyrics.d.ts","sourceRoot":"","sources":["../../src/AmLyrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,KAAK,CAAC;AA6E5C,qBAAa,QAAS,SAAQ,UAAU;IACtC,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"AmLyrics.d.ts","sourceRoot":"","sources":["../../src/AmLyrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,KAAK,CAAC;AA6E5C,qBAAa,QAAS,SAAQ,UAAU;IACtC,MAAM,CAAC,MAAM,0BA6QX;IAGF,KAAK,CAAC,EAAE,MAAM,CAAC;IAGf,OAAO,CAAC,EAAE,MAAM,CAAC;IAGjB,IAAI,CAAC,EAAE,MAAM,CAAC;IAGd,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,OAAO,CAAC,cAAc,CAAmC;IAGzD,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,cAAc,CAAC,EAAE,MAAM,CAAC;IAGxB,cAAc,SAAU;IAGxB,oBAAoB,SAAa;IAGjC,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,UAAU,UAAQ;IAGlB,WAAW,UAAQ;IAGnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,WAAW,SAAK;IAGhB,OAAO,CAAC,SAAS,CAAS;I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4HvB,OAAO,CAAC,WAAW;IAyBnB,OAAO,CAAC,YAAY;IA2DpB,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAUjC,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAYlC,OAAO,CAAC,cAAc;IAuCtB,MAAM;CAmOP"}
|
package/dist/src/am-lyrics.js
CHANGED
|
@@ -78,7 +78,7 @@ const e$1=(e,t,c)=>(c.configurable=true,c.enumerable=true,Reflect.decorate&&"obj
|
|
|
78
78
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
79
79
|
*/function e(e,r){return (n,s,i)=>{const o=t=>t.renderRoot?.querySelector(e)??null;return e$1(n,s,{get(){return o(this)}})}}
|
|
80
80
|
|
|
81
|
-
const VERSION = '0.6.
|
|
81
|
+
const VERSION = '0.6.2';
|
|
82
82
|
const INSTRUMENTAL_THRESHOLD_MS = 3000; // Show ellipsis for gaps >= 3s
|
|
83
83
|
const KPOE_SERVERS = [
|
|
84
84
|
'https://lyricsplus.prjktla.workers.dev',
|
|
@@ -177,7 +177,7 @@ class AmLyrics extends i {
|
|
|
177
177
|
else if (typeof this.duration === 'number' && this.duration > 0) {
|
|
178
178
|
metadata.durationMs = this.duration;
|
|
179
179
|
}
|
|
180
|
-
|
|
180
|
+
const appleSong = null;
|
|
181
181
|
let appleId = this.musicId;
|
|
182
182
|
let catalogIsrc;
|
|
183
183
|
if (this.query &&
|
|
@@ -932,15 +932,15 @@ class AmLyrics extends i {
|
|
|
932
932
|
if (this.lyricsSource)
|
|
933
933
|
lrc += `[re:${this.lyricsSource}]\n`;
|
|
934
934
|
for (const line of this.lyrics) {
|
|
935
|
-
if (
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
935
|
+
if (line.text && line.text.length > 0) {
|
|
936
|
+
const timestamp = AmLyrics.formatTimestampLRC(line.timestamp);
|
|
937
|
+
// Construct line text from syllables
|
|
938
|
+
const lineText = line.text
|
|
939
|
+
.map(s => s.text)
|
|
940
|
+
.join('')
|
|
941
|
+
.trim();
|
|
942
|
+
lrc += `[${timestamp}]${lineText}\n`;
|
|
943
|
+
}
|
|
944
944
|
}
|
|
945
945
|
return lrc;
|
|
946
946
|
}
|
|
@@ -1016,11 +1016,10 @@ class AmLyrics extends i {
|
|
|
1016
1016
|
// Determine format: TTML if ANY line is word-synced, else LRC
|
|
1017
1017
|
const isWordSynced = this.lyrics.some(l => l.isWordSynced !== false);
|
|
1018
1018
|
let content = '';
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
: this.downloadFormat;
|
|
1019
|
+
let extension = this.downloadFormat;
|
|
1020
|
+
if (extension === 'auto') {
|
|
1021
|
+
extension = isWordSynced ? 'ttml' : 'lrc';
|
|
1022
|
+
}
|
|
1024
1023
|
let mimeType = '';
|
|
1025
1024
|
if (extension === 'ttml') {
|
|
1026
1025
|
content = this.generateTTML();
|
|
@@ -1182,14 +1181,56 @@ class AmLyrics extends i {
|
|
|
1182
1181
|
};
|
|
1183
1182
|
return b `
|
|
1184
1183
|
<div class="lyrics-container">
|
|
1184
|
+
${!this.isLoading && this.lyrics && this.lyrics.length > 0
|
|
1185
|
+
? b `
|
|
1186
|
+
<div class="lyrics-header">
|
|
1187
|
+
<select
|
|
1188
|
+
class="format-select"
|
|
1189
|
+
@change=${(e) => {
|
|
1190
|
+
this.downloadFormat = e.target
|
|
1191
|
+
.value;
|
|
1192
|
+
}}
|
|
1193
|
+
.value=${this.downloadFormat}
|
|
1194
|
+
@click=${(e) => e.stopPropagation()}
|
|
1195
|
+
>
|
|
1196
|
+
<option value="auto">Auto</option>
|
|
1197
|
+
<option value="lrc">LRC</option>
|
|
1198
|
+
<option value="ttml">TTML</option>
|
|
1199
|
+
</select>
|
|
1200
|
+
<button
|
|
1201
|
+
class="download-button"
|
|
1202
|
+
@click=${this.downloadLyrics}
|
|
1203
|
+
title="Download Lyrics"
|
|
1204
|
+
>
|
|
1205
|
+
<svg
|
|
1206
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1207
|
+
width="16"
|
|
1208
|
+
height="16"
|
|
1209
|
+
viewBox="0 0 24 24"
|
|
1210
|
+
fill="none"
|
|
1211
|
+
stroke="currentColor"
|
|
1212
|
+
stroke-width="2"
|
|
1213
|
+
stroke-linecap="round"
|
|
1214
|
+
stroke-linejoin="round"
|
|
1215
|
+
class="lucide lucide-download-icon lucide-download"
|
|
1216
|
+
>
|
|
1217
|
+
<path d="M12 15V3" />
|
|
1218
|
+
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
|
|
1219
|
+
<path d="m7 10 5 5 5-5" />
|
|
1220
|
+
</svg>
|
|
1221
|
+
</button>
|
|
1222
|
+
</div>
|
|
1223
|
+
`
|
|
1224
|
+
: ''}
|
|
1185
1225
|
${renderContent()}
|
|
1186
1226
|
${!this.isLoading
|
|
1187
|
-
? b `
|
|
1227
|
+
? b `
|
|
1228
|
+
<footer class="lyrics-footer">
|
|
1188
1229
|
<div class="footer-content">
|
|
1189
1230
|
<span class="source-info">Source: ${sourceLabel}</span>
|
|
1190
1231
|
<span class="version-info">
|
|
1191
1232
|
v${VERSION} •
|
|
1192
|
-
|
|
1233
|
+
|
|
1193
1234
|
href="https://github.com/uimaxbai/apple-music-web-components"
|
|
1194
1235
|
target="_blank"
|
|
1195
1236
|
rel="noopener noreferrer"
|
|
@@ -1197,46 +1238,8 @@ class AmLyrics extends i {
|
|
|
1197
1238
|
>
|
|
1198
1239
|
</span>
|
|
1199
1240
|
</div>
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
? b `<select
|
|
1203
|
-
class="format-select"
|
|
1204
|
-
@change=${(e) => {
|
|
1205
|
-
this.downloadFormat = e.target
|
|
1206
|
-
.value;
|
|
1207
|
-
}}
|
|
1208
|
-
.value=${this.downloadFormat}
|
|
1209
|
-
@click=${(e) => e.stopPropagation()}
|
|
1210
|
-
>
|
|
1211
|
-
<option value="auto">Auto</option>
|
|
1212
|
-
<option value="lrc">LRC</option>
|
|
1213
|
-
<option value="ttml">TTML</option>
|
|
1214
|
-
</select>
|
|
1215
|
-
<button
|
|
1216
|
-
class="download-button"
|
|
1217
|
-
@click=${this.downloadLyrics}
|
|
1218
|
-
title="Download Lyrics"
|
|
1219
|
-
>
|
|
1220
|
-
<svg
|
|
1221
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
1222
|
-
width="16"
|
|
1223
|
-
height="16"
|
|
1224
|
-
viewBox="0 0 24 24"
|
|
1225
|
-
fill="none"
|
|
1226
|
-
stroke="currentColor"
|
|
1227
|
-
stroke-width="2"
|
|
1228
|
-
stroke-linecap="round"
|
|
1229
|
-
stroke-linejoin="round"
|
|
1230
|
-
class="lucide lucide-download-icon lucide-download"
|
|
1231
|
-
>
|
|
1232
|
-
<path d="M12 15V3" />
|
|
1233
|
-
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
|
|
1234
|
-
<path d="m7 10 5 5 5-5" />
|
|
1235
|
-
</svg>
|
|
1236
|
-
</button>`
|
|
1237
|
-
: ''}
|
|
1238
|
-
</div>
|
|
1239
|
-
</footer>`
|
|
1241
|
+
</footer>
|
|
1242
|
+
`
|
|
1240
1243
|
: ''}
|
|
1241
1244
|
</div>
|
|
1242
1245
|
`;
|
|
@@ -1389,7 +1392,7 @@ AmLyrics.styles = i$3 `
|
|
|
1389
1392
|
text-decoration: underline;
|
|
1390
1393
|
}
|
|
1391
1394
|
|
|
1392
|
-
.lyrics-
|
|
1395
|
+
.lyrics-header .download-button {
|
|
1393
1396
|
background: none;
|
|
1394
1397
|
border: none;
|
|
1395
1398
|
cursor: pointer;
|
|
@@ -1401,7 +1404,7 @@ AmLyrics.styles = i$3 `
|
|
|
1401
1404
|
align-items: center;
|
|
1402
1405
|
}
|
|
1403
1406
|
|
|
1404
|
-
.lyrics-
|
|
1407
|
+
.lyrics-header .download-button:hover {
|
|
1405
1408
|
color: #555;
|
|
1406
1409
|
}
|
|
1407
1410
|
|
|
@@ -1504,6 +1507,13 @@ AmLyrics.styles = i$3 `
|
|
|
1504
1507
|
color: #555;
|
|
1505
1508
|
border-color: #aaa;
|
|
1506
1509
|
}
|
|
1510
|
+
|
|
1511
|
+
.lyrics-header {
|
|
1512
|
+
display: flex;
|
|
1513
|
+
padding: 10px 0;
|
|
1514
|
+
margin-bottom: 10px;
|
|
1515
|
+
gap: 4px;
|
|
1516
|
+
}
|
|
1507
1517
|
`;
|
|
1508
1518
|
__decorate([
|
|
1509
1519
|
n({ type: String })
|