@uimaxbai/am-lyrics 0.4.3 → 0.4.5
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 +29 -9
- package/dist/src/am-lyrics.js.map +1 -1
- package/dist/src/react.js +29 -9
- package/dist/src/react.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/AmLyrics.ts +32 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmLyrics.d.ts","sourceRoot":"","sources":["../../src/AmLyrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,KAAK,CAAC;AA4B5C,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;AA4B5C,qBAAa,QAAS,SAAQ,UAAU;IACtC,MAAM,CAAC,MAAM,0BAmJX;IAGF,KAAK,CAAC,EAAE,MAAM,CAAC;IAGf,OAAO,CAAC,EAAE,MAAM,CAAC;IAGjB,IAAI,CAAC,EAAE,MAAM,CAAC;IAGd,cAAc,SAAU;IAGxB,oBAAoB,SAAa;IAGjC,gBAAgB,UAAS;IAGzB,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;IAG1B,OAAO,CAAC,MAAM,CAAC,CAAe;IAG9B,OAAO,CAAC,iBAAiB,CAAgB;IAGzC,OAAO,CAAC,qBAAqB,CAAkC;IAG/D,OAAO,CAAC,2BAA2B,CAAkC;IAGrE,OAAO,CAAC,gBAAgB,CAAkC;IAG1D,OAAO,CAAC,sBAAsB,CAAkC;IAEhE,OAAO,CAAC,gBAAgB,CAAC,CAAS;IAElC,OAAO,CAAC,kBAAkB,CAGZ;IAEd,OAAO,CAAC,wBAAwB,CAGlB;IAGd,OAAO,CAAC,eAAe,CAAC,CAAc;IAEtC,OAAO,CAAC,qBAAqB,CAAuB;IAEpD,iBAAiB;IAKjB,oBAAoB;YAON,WAAW;IAqDzB,YAAY;IAIZ,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC;IAmDjE,OAAO,CAAC,MAAM,CAAC,WAAW;IAI1B,OAAO,CAAC,qBAAqB;IAW7B,OAAO,CAAC,qBAAqB;IAiC7B,OAAO,CAAC,sBAAsB;IA8D9B,OAAO,CAAC,wBAAwB;IAwChC,OAAO,CAAC,eAAe;IA4CvB,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,kBAAkB;IAyB1B,OAAO,CAAC,oBAAoB;IAmB5B,OAAO,CAAC,eAAe;IA4HvB,MAAM;CA+JP"}
|
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.4.
|
|
81
|
+
const VERSION = '0.4.5';
|
|
82
82
|
const INSTRUMENTAL_THRESHOLD_MS = 3000; // Show ellipsis for gaps >= 3s
|
|
83
83
|
class AmLyrics extends i {
|
|
84
84
|
constructor() {
|
|
@@ -388,7 +388,10 @@ class AmLyrics extends i {
|
|
|
388
388
|
const lineTop = activeLineElement.offsetTop;
|
|
389
389
|
const lineHeight = activeLineElement.clientHeight;
|
|
390
390
|
const top = lineTop - containerHeight / 2 + lineHeight / 2;
|
|
391
|
-
|
|
391
|
+
// Use requestAnimationFrame for smoother iOS performance
|
|
392
|
+
requestAnimationFrame(() => {
|
|
393
|
+
this.lyricsContainer?.scrollTo({ top, behavior: 'smooth' });
|
|
394
|
+
});
|
|
392
395
|
}
|
|
393
396
|
}
|
|
394
397
|
scrollToInstrumental(insertBeforeIndex) {
|
|
@@ -400,7 +403,10 @@ class AmLyrics extends i {
|
|
|
400
403
|
const lineTop = target.offsetTop;
|
|
401
404
|
const lineHeight = target.clientHeight;
|
|
402
405
|
const top = lineTop - containerHeight / 2 + lineHeight / 2;
|
|
403
|
-
|
|
406
|
+
// Use requestAnimationFrame for smoother iOS performance
|
|
407
|
+
requestAnimationFrame(() => {
|
|
408
|
+
this.lyricsContainer?.scrollTo({ top, behavior: 'smooth' });
|
|
409
|
+
});
|
|
404
410
|
}
|
|
405
411
|
}
|
|
406
412
|
animateProgress() {
|
|
@@ -513,7 +519,10 @@ class AmLyrics extends i {
|
|
|
513
519
|
if (this.fontFamily) {
|
|
514
520
|
this.style.fontFamily = this.fontFamily;
|
|
515
521
|
}
|
|
522
|
+
// Set both old internal CSS variables (for backward compatibility)
|
|
523
|
+
// and new public CSS variables (which take precedence)
|
|
516
524
|
this.style.setProperty('--hover-background-color', this.hoverBackgroundColor);
|
|
525
|
+
this.style.setProperty('--highlight-color', this.highlightColor);
|
|
517
526
|
const renderContent = () => {
|
|
518
527
|
if (this.isLoading) {
|
|
519
528
|
return x `<div class="loading-indicator">Loading...</div>`;
|
|
@@ -578,7 +587,7 @@ class AmLyrics extends i {
|
|
|
578
587
|
? '0'
|
|
579
588
|
: '.5ch'}; --transition-style: ${isLineActive
|
|
580
589
|
? 'all'
|
|
581
|
-
: 'color'}
|
|
590
|
+
: 'color'}"
|
|
582
591
|
data-text="${syllable.text}${syllable.part ? ' ' : ''}"
|
|
583
592
|
>${syllable.text}</span
|
|
584
593
|
>`;
|
|
@@ -611,7 +620,7 @@ class AmLyrics extends i {
|
|
|
611
620
|
? '0'
|
|
612
621
|
: '.5ch'}; --transition-style: ${isLineActive
|
|
613
622
|
? 'all'
|
|
614
|
-
: 'color'}
|
|
623
|
+
: 'color'}"
|
|
615
624
|
data-text="${syllable.text}"
|
|
616
625
|
>${syllable.text}</span
|
|
617
626
|
>`;
|
|
@@ -656,9 +665,11 @@ AmLyrics.styles = i$3 `
|
|
|
656
665
|
padding: 20px;
|
|
657
666
|
border-radius: 8px;
|
|
658
667
|
background-color: transparent;
|
|
659
|
-
|
|
668
|
+
width: 100%;
|
|
669
|
+
height: 100%;
|
|
660
670
|
overflow-y: auto;
|
|
661
671
|
scroll-behavior: smooth;
|
|
672
|
+
-webkit-overflow-scrolling: touch; /* iOS smooth scrolling */
|
|
662
673
|
}
|
|
663
674
|
|
|
664
675
|
.lyrics-line {
|
|
@@ -671,10 +682,15 @@ AmLyrics.styles = i$3 `
|
|
|
671
682
|
position: relative;
|
|
672
683
|
font-size: 2em; /* Increased font size */
|
|
673
684
|
color: #888; /* Default text color to gray */
|
|
685
|
+
word-wrap: break-word;
|
|
686
|
+
overflow-wrap: break-word;
|
|
674
687
|
}
|
|
675
688
|
|
|
676
689
|
.lyrics-line:hover {
|
|
677
|
-
background-color: var(
|
|
690
|
+
background-color: var(
|
|
691
|
+
--am-lyrics-hover-background,
|
|
692
|
+
var(--hover-background-color, #f0f0f0)
|
|
693
|
+
);
|
|
678
694
|
}
|
|
679
695
|
|
|
680
696
|
.opposite-turn {
|
|
@@ -697,11 +713,15 @@ AmLyrics.styles = i$3 `
|
|
|
697
713
|
top: 0;
|
|
698
714
|
left: 0;
|
|
699
715
|
width: var(--line-progress, 0%);
|
|
700
|
-
color: var(
|
|
716
|
+
color: var(
|
|
717
|
+
--am-lyrics-highlight-color,
|
|
718
|
+
var(--highlight-color, #000)
|
|
719
|
+
); /* CSS variable takes precedence */
|
|
701
720
|
overflow: hidden;
|
|
702
721
|
/* Spring animation */
|
|
703
722
|
/* transition: width 0.05s ; */
|
|
704
|
-
|
|
723
|
+
word-wrap: break-word;
|
|
724
|
+
overflow-wrap: break-word;
|
|
705
725
|
transition: var(--transition-style, all) 0.05s
|
|
706
726
|
cubic-bezier(0.25, 0.1, 0.25, 1.5);
|
|
707
727
|
}
|