@uimaxbai/am-lyrics 1.2.5 → 1.2.7
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 +49 -62
- package/dist/src/am-lyrics.js.map +1 -1
- package/dist/src/react.js +49 -62
- package/dist/src/react.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/fix.cjs +7 -0
- package/package.json +1 -1
- package/patch.diff +210 -0
- package/patch2.diff +26 -0
- package/src/AmLyrics.ts +68 -92
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmLyrics.d.ts","sourceRoot":"","sources":["../../src/AmLyrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAO,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"AmLyrics.d.ts","sourceRoot":"","sources":["../../src/AmLyrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAO,MAAM,KAAK,CAAC;AAuHjD,qBAAa,QAAS,SAAQ,UAAU;IACtC,MAAM,CAAC,MAAM,0BA2qCX;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,SAAa;IAG3B,oBAAoB,SAA+B;IAGnD,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,UAAU,UAAQ;IAGlB,WAAW,UAAQ;IAGnB,OAAO,CAAC,gBAAgB,CAAS;IAGjC,OAAO,CAAC,eAAe,CAAS;YAElB,kBAAkB;YAKlB,iBAAiB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AAO,CAAC,yBAAyB;IAqBjC,OAAO,CAAC,SAAS;IA0BjB,OAAO,CAAC,gBAAgB;IA2BxB,OAAO,CAAC,qBAAqB;IA6B7B,OAAO,CAAC,qBAAqB;IAiC7B;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IAgC/B,OAAO,CAAC,sBAAsB;IAgE9B,OAAO,CAAC,wBAAwB;IA0ChC,OAAO,CAAC,eAAe;IA4CvB,OAAO,CAAC,eAAe;IA6EvB,OAAO,CAAC,MAAM,CAAC,0BAA0B;IAkBzC,OAAO,CAAC,kBAAkB;IA2C1B,OAAO,CAAC,oBAAoB;IAyB5B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAa3B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA4J1B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IA+C7B;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAmD/B;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAyKtC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,aAAa;IAwC5B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;IAS7B;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,sBAAsB;IAuErC,OAAO,CAAC,eAAe;IA0HvB,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;CAyoBP"}
|
package/dist/src/am-lyrics.js
CHANGED
|
@@ -319,16 +319,17 @@ class GoogleService {
|
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
321
|
|
|
322
|
-
const VERSION = '1.2.
|
|
322
|
+
const VERSION = '1.2.7';
|
|
323
323
|
const INSTRUMENTAL_THRESHOLD_MS = 7000; // Show dots for gaps >= 7s
|
|
324
324
|
const FETCH_TIMEOUT_MS = 8000; // Timeout for all lyrics fetch requests
|
|
325
325
|
const SEEK_THRESHOLD_MS = 500;
|
|
326
326
|
const PRE_SCROLL_LEAD_MS = 500;
|
|
327
|
+
const PRE_SCROLL_LEAD_SHORT_MS = 350;
|
|
327
328
|
const SCROLL_ANIMATION_DURATION_MS = 280;
|
|
328
329
|
const SCROLL_DELAY_INCREMENT_MS = 24;
|
|
329
330
|
const GAP_PULSE_DURATION_MS = 4000;
|
|
330
331
|
const GAP_PULSE_CYCLE_MS = GAP_PULSE_DURATION_MS * 2;
|
|
331
|
-
const GAP_EXIT_LEAD_MS =
|
|
332
|
+
const GAP_EXIT_LEAD_MS = 600;
|
|
332
333
|
const GAP_MIN_SCALE = 0.85;
|
|
333
334
|
/**
|
|
334
335
|
* Fetch with an automatic timeout via AbortSignal.
|
|
@@ -1899,15 +1900,24 @@ class AmLyrics extends i {
|
|
|
1899
1900
|
const line = this.lyrics[i];
|
|
1900
1901
|
const timeUntilStart = line.timestamp - newTime;
|
|
1901
1902
|
const nextLineEl = this.lyricsContainer.querySelector(`#lyrics-line-${i}`);
|
|
1902
|
-
|
|
1903
|
+
const isBackToBack = this.activeLineIndices.length > 0;
|
|
1904
|
+
const leadTime = isBackToBack
|
|
1905
|
+
? PRE_SCROLL_LEAD_SHORT_MS
|
|
1906
|
+
: PRE_SCROLL_LEAD_MS;
|
|
1907
|
+
if (timeUntilStart > leadTime) {
|
|
1908
|
+
break; // Lines are ordered by timestamp, no need to check further
|
|
1909
|
+
}
|
|
1910
|
+
if (timeUntilStart > 0 && timeUntilStart <= leadTime) {
|
|
1903
1911
|
// Time to pre-scroll and pre-activate!
|
|
1904
1912
|
if (nextLineEl) {
|
|
1905
|
-
// Apply unblur & zoom effect ahead of lyric start
|
|
1906
1913
|
preActiveLineIndex = i;
|
|
1907
|
-
|
|
1914
|
+
if (!isBackToBack) {
|
|
1915
|
+
// Apply unblur & zoom effect ahead of lyric start only if no line is currently active
|
|
1916
|
+
nextLineEl.classList.add('pre-active');
|
|
1917
|
+
}
|
|
1908
1918
|
this.clearPreActiveClasses(i);
|
|
1909
1919
|
const slowScrollDuration = Math.max(SCROLL_ANIMATION_DURATION_MS, timeUntilStart);
|
|
1910
|
-
this.focusLine(nextLineEl, false, slowScrollDuration
|
|
1920
|
+
this.focusLine(nextLineEl, false, isBackToBack ? 500 : slowScrollDuration);
|
|
1911
1921
|
}
|
|
1912
1922
|
break;
|
|
1913
1923
|
}
|
|
@@ -2713,42 +2723,19 @@ class AmLyrics extends i {
|
|
|
2713
2723
|
// Use a Map to collect animations like YouLyPlus
|
|
2714
2724
|
const charAnimationsMap = new Map();
|
|
2715
2725
|
const styleUpdates = [];
|
|
2716
|
-
// Step 1
|
|
2726
|
+
// Step 1: Grow Pass
|
|
2717
2727
|
if (isGrowable && isFirstSyllable && allWordCharSpans.length > 0) {
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
const
|
|
2721
|
-
allWordCharSpans.forEach(
|
|
2728
|
+
const finalDuration = wordDurationMs;
|
|
2729
|
+
const baseDelayPerChar = finalDuration * 0.09;
|
|
2730
|
+
const growDurationMs = finalDuration * 1.5;
|
|
2731
|
+
allWordCharSpans.forEach(span => {
|
|
2722
2732
|
const horizontalOffset = parseFloat(span.dataset.horizontalOffset || '0');
|
|
2723
2733
|
const maxScale = span.dataset.maxScale || '1.1';
|
|
2724
2734
|
const shadowIntensity = span.dataset.shadowIntensity || '0.6';
|
|
2725
2735
|
const translateYPeak = span.dataset.translateYPeak || '-2';
|
|
2726
|
-
const
|
|
2727
|
-
const
|
|
2728
|
-
|
|
2729
|
-
const parentDuration = parseFloat(parentSyllable.getAttribute('data-duration') || '0');
|
|
2730
|
-
const parentStartTime = parseFloat(parentSyllable.getAttribute('data-start-time') || '0');
|
|
2731
|
-
const startPct = parseFloat(span.dataset.wipeStart || '0');
|
|
2732
|
-
const durationPct = parseFloat(span.dataset.wipeDuration || '0');
|
|
2733
|
-
const relativeStartOffset = Math.max(0, parentStartTime - firstSyllableStartTime);
|
|
2734
|
-
const wipeDelay = relativeStartOffset + parentDuration * startPct;
|
|
2735
|
-
const wipeDuration = parentDuration * durationPct;
|
|
2736
|
-
const useStartAnimation = isFirstInContainer && charIndexInWord === 0;
|
|
2737
|
-
let charWipeAnimation = 'wipe';
|
|
2738
|
-
if (useStartAnimation)
|
|
2739
|
-
charWipeAnimation = isRTL ? 'start-wipe-rtl' : 'start-wipe';
|
|
2740
|
-
else
|
|
2741
|
-
charWipeAnimation = isRTL ? 'wipe-rtl' : 'wipe';
|
|
2742
|
-
// Blend word and syllable durations to let the gradient flow smoothly
|
|
2743
|
-
// while still responding to syllable pacing (no strict exactness, just natural flow)
|
|
2744
|
-
const growDelay = wipeDelay;
|
|
2745
|
-
const growDurationMs = Math.max(600, wordDurationMs * 0.8 + parentDuration * 1.5);
|
|
2746
|
-
animationParts.push(`grow-dynamic ${growDurationMs}ms ease-in-out ${growDelay}ms forwards`);
|
|
2747
|
-
if (wipeDuration > 0) {
|
|
2748
|
-
animationParts.push(`${charWipeAnimation} ${wipeDuration}ms linear ${wipeDelay}ms forwards`);
|
|
2749
|
-
}
|
|
2750
|
-
}
|
|
2751
|
-
charAnimationsMap.set(span, animationParts.join(', '));
|
|
2736
|
+
const syllableCharIndex = parseFloat(span.dataset.syllableCharIndex || '0');
|
|
2737
|
+
const growDelay = baseDelayPerChar * syllableCharIndex;
|
|
2738
|
+
charAnimationsMap.set(span, `grow-dynamic ${growDurationMs}ms ease-in-out ${growDelay}ms forwards`);
|
|
2752
2739
|
styleUpdates.push({
|
|
2753
2740
|
element: span,
|
|
2754
2741
|
property: '--char-offset-x',
|
|
@@ -2771,26 +2758,8 @@ class AmLyrics extends i {
|
|
|
2771
2758
|
});
|
|
2772
2759
|
});
|
|
2773
2760
|
}
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
// If they already have `grow-dynamic`, it means the first syllable correctly took care of BOTH grow and wipe!
|
|
2777
|
-
// Otherwise, they scrubbed directly into this syllable, so let's at least do the wipe.
|
|
2778
|
-
charSpans.forEach(span => {
|
|
2779
|
-
const existingAnimation = charAnimationsMap.get(span) || span.style.animation || '';
|
|
2780
|
-
if (existingAnimation.includes('grow-dynamic'))
|
|
2781
|
-
return;
|
|
2782
|
-
const startPct = parseFloat(span.dataset.wipeStart || '0');
|
|
2783
|
-
const durationPct = parseFloat(span.dataset.wipeDuration || '0');
|
|
2784
|
-
const wipeDelay = syllableDurationMs * startPct;
|
|
2785
|
-
const wipeDuration = syllableDurationMs * durationPct;
|
|
2786
|
-
const charWipeAnimation = isRTL ? 'wipe-rtl' : 'wipe';
|
|
2787
|
-
if (wipeDuration > 0) {
|
|
2788
|
-
charAnimationsMap.set(span, `${charWipeAnimation} ${wipeDuration}ms linear ${wipeDelay}ms forwards`);
|
|
2789
|
-
}
|
|
2790
|
-
});
|
|
2791
|
-
}
|
|
2792
|
-
else if (charSpans.length > 0) {
|
|
2793
|
-
// Per-character wipe for non-growable words (matching YouLyPlus)
|
|
2761
|
+
// Step 2: Wipe Pass
|
|
2762
|
+
if (charSpans.length > 0) {
|
|
2794
2763
|
charSpans.forEach((span, charIndex) => {
|
|
2795
2764
|
const startPct = parseFloat(span.dataset.wipeStart || '0');
|
|
2796
2765
|
const durationPct = parseFloat(span.dataset.wipeDuration || '0');
|
|
@@ -2804,8 +2773,26 @@ class AmLyrics extends i {
|
|
|
2804
2773
|
else {
|
|
2805
2774
|
charWipeAnimation = isRTL ? 'wipe-rtl' : 'wipe';
|
|
2806
2775
|
}
|
|
2776
|
+
const existingAnimation = charAnimationsMap.get(span) || span.style.animation || '';
|
|
2777
|
+
const animationParts = [];
|
|
2778
|
+
if (existingAnimation && existingAnimation.includes('grow-dynamic')) {
|
|
2779
|
+
animationParts.push(existingAnimation.split(',')[0].trim());
|
|
2780
|
+
}
|
|
2781
|
+
if (charIndex > 0) {
|
|
2782
|
+
const arrivalTime = span.dataset.preWipeArrival
|
|
2783
|
+
? parseFloat(span.dataset.preWipeArrival)
|
|
2784
|
+
: wipeDelay;
|
|
2785
|
+
const constantDuration = parseFloat(span.dataset.preWipeDuration || '100');
|
|
2786
|
+
const animDelay = arrivalTime - constantDuration;
|
|
2787
|
+
if (constantDuration > 0) {
|
|
2788
|
+
animationParts.push(`pre-wipe-char ${constantDuration}ms linear ${animDelay}ms forwards`);
|
|
2789
|
+
}
|
|
2790
|
+
}
|
|
2807
2791
|
if (wipeDuration > 0) {
|
|
2808
|
-
|
|
2792
|
+
animationParts.push(`${charWipeAnimation} ${wipeDuration}ms linear ${wipeDelay}ms forwards`);
|
|
2793
|
+
}
|
|
2794
|
+
if (animationParts.length > 0) {
|
|
2795
|
+
charAnimationsMap.set(span, animationParts.join(', '));
|
|
2809
2796
|
}
|
|
2810
2797
|
});
|
|
2811
2798
|
}
|
|
@@ -4641,8 +4628,8 @@ AmLyrics.styles = i$3 `
|
|
|
4641
4628
|
0.75em 100%,
|
|
4642
4629
|
0% 100%;
|
|
4643
4630
|
background-position:
|
|
4644
|
-
-0.
|
|
4645
|
-
|
|
4631
|
+
-0.75em 0%,
|
|
4632
|
+
-0.375em 0%;
|
|
4646
4633
|
}
|
|
4647
4634
|
100% {
|
|
4648
4635
|
background-size:
|
|
@@ -4736,7 +4723,7 @@ AmLyrics.styles = i$3 `
|
|
|
4736
4723
|
0.75em 100%,
|
|
4737
4724
|
0% 100%;
|
|
4738
4725
|
background-position:
|
|
4739
|
-
-0.
|
|
4726
|
+
-0.75em 0%,
|
|
4740
4727
|
left;
|
|
4741
4728
|
}
|
|
4742
4729
|
to {
|
|
@@ -4744,7 +4731,7 @@ AmLyrics.styles = i$3 `
|
|
|
4744
4731
|
0.75em 100%,
|
|
4745
4732
|
0% 100%;
|
|
4746
4733
|
background-position:
|
|
4747
|
-
-0.
|
|
4734
|
+
-0.375em 0%,
|
|
4748
4735
|
left;
|
|
4749
4736
|
}
|
|
4750
4737
|
}
|