@uimaxbai/am-lyrics 1.2.9 → 1.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.
- package/README.md +0 -5
- package/dist/src/AmLyrics.d.ts +5 -7
- package/dist/src/AmLyrics.d.ts.map +1 -1
- package/dist/src/am-lyrics.js +470 -350
- package/dist/src/am-lyrics.js.map +1 -1
- package/dist/src/react.js +470 -350
- package/dist/src/react.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/AmLyrics.ts +549 -401
- package/fix.cjs +0 -7
- package/patch.diff +0 -210
- package/patch2.diff +0 -26
package/fix.cjs
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
let code = fs.readFileSync('src/AmLyrics.ts', 'utf8');
|
|
3
|
-
code = code.replace(
|
|
4
|
-
"const arrivalTime = parseFloat(span.dataset.preWipeArrival || '0');",
|
|
5
|
-
"const arrivalTime = span.dataset.preWipeArrival ? parseFloat(span.dataset.preWipeArrival) : wipeDelay;"
|
|
6
|
-
);
|
|
7
|
-
fs.writeFileSync('src/AmLyrics.ts', code);
|
package/patch.diff
DELETED
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
diff --git a/src/AmLyrics.ts b/src/AmLyrics.ts
|
|
2
|
-
index a51d575..94ef709 100644
|
|
3
|
-
--- a/src/AmLyrics.ts
|
|
4
|
-
+++ b/src/AmLyrics.ts
|
|
5
|
-
@@ -2,17 +2,17 @@ import { css, html, LitElement, svg } from 'lit';
|
|
6
|
-
import { property, query, state } from 'lit/decorators.js';
|
|
7
|
-
import { GoogleService } from './GoogleService.js';
|
|
8
|
-
|
|
9
|
-
-const VERSION = '1.2.6';
|
|
10
|
-
+const VERSION = '1.2.7';
|
|
11
|
-
const INSTRUMENTAL_THRESHOLD_MS = 7000; // Show dots for gaps >= 7s
|
|
12
|
-
const FETCH_TIMEOUT_MS = 8000; // Timeout for all lyrics fetch requests
|
|
13
|
-
const SEEK_THRESHOLD_MS = 500;
|
|
14
|
-
const PRE_SCROLL_LEAD_MS = 500;
|
|
15
|
-
-const PRE_SCROLL_LEAD_SHORT_MS = 150;
|
|
16
|
-
+const PRE_SCROLL_LEAD_SHORT_MS = 350;
|
|
17
|
-
const SCROLL_ANIMATION_DURATION_MS = 280;
|
|
18
|
-
const SCROLL_DELAY_INCREMENT_MS = 24;
|
|
19
|
-
const GAP_PULSE_DURATION_MS = 4000;
|
|
20
|
-
const GAP_PULSE_CYCLE_MS = GAP_PULSE_DURATION_MS * 2;
|
|
21
|
-
-const GAP_EXIT_LEAD_MS = 360;
|
|
22
|
-
+const GAP_EXIT_LEAD_MS = 600;
|
|
23
|
-
const GAP_MIN_SCALE = 0.85;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
@@ -1010,8 +1010,8 @@ export class AmLyrics extends LitElement {
|
|
27
|
-
0.75em 100%,
|
|
28
|
-
0% 100%;
|
|
29
|
-
background-position:
|
|
30
|
-
- -0.375em 0%,
|
|
31
|
-
- left;
|
|
32
|
-
+ -0.75em 0%,
|
|
33
|
-
+ -0.375em 0%;
|
|
34
|
-
}
|
|
35
|
-
100% {
|
|
36
|
-
background-size:
|
|
37
|
-
@@ -1105,7 +1105,7 @@ export class AmLyrics extends LitElement {
|
|
38
|
-
0.75em 100%,
|
|
39
|
-
0% 100%;
|
|
40
|
-
background-position:
|
|
41
|
-
- -0.85em 0%,
|
|
42
|
-
+ -0.75em 0%,
|
|
43
|
-
left;
|
|
44
|
-
}
|
|
45
|
-
to {
|
|
46
|
-
@@ -1113,7 +1113,7 @@ export class AmLyrics extends LitElement {
|
|
47
|
-
0.75em 100%,
|
|
48
|
-
0% 100%;
|
|
49
|
-
background-position:
|
|
50
|
-
- -0.85em 0%,
|
|
51
|
-
+ -0.375em 0%,
|
|
52
|
-
left;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
@@ -3302,8 +3302,7 @@ export class AmLyrics extends LitElement {
|
|
56
|
-
this.focusLine(
|
|
57
|
-
nextLineEl,
|
|
58
|
-
false,
|
|
59
|
-
- slowScrollDuration,
|
|
60
|
-
- !!currentGap,
|
|
61
|
-
+ isBackToBack ? 500 : slowScrollDuration,
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
break;
|
|
65
|
-
@@ -4344,71 +4343,29 @@ export class AmLyrics extends LitElement {
|
|
66
|
-
value: string;
|
|
67
|
-
}> = [];
|
|
68
|
-
|
|
69
|
-
- // Step 1 & 2: Apply animations
|
|
70
|
-
+ // Step 1: Grow Pass
|
|
71
|
-
if (isGrowable && isFirstSyllable && allWordCharSpans.length > 0) {
|
|
72
|
-
- // Glow AND wipe applied to ALL characters simultaneously from the first syllable
|
|
73
|
-
- // This prevents CSS animation restarts because the `animation` property is set once.
|
|
74
|
-
-
|
|
75
|
-
- const firstSyllableStartTime = parseFloat(
|
|
76
|
-
- syllable.getAttribute('data-start-time') || '0',
|
|
77
|
-
- );
|
|
78
|
-
+ const finalDuration = wordDurationMs;
|
|
79
|
-
+ const baseDelayPerChar = finalDuration * 0.09;
|
|
80
|
-
+ const growDurationMs = finalDuration * 1.5;
|
|
81
|
-
|
|
82
|
-
- allWordCharSpans.forEach((span, charIndexInWord) => {
|
|
83
|
-
+ allWordCharSpans.forEach(span => {
|
|
84
|
-
const horizontalOffset = parseFloat(
|
|
85
|
-
span.dataset.horizontalOffset || '0',
|
|
86
|
-
);
|
|
87
|
-
-
|
|
88
|
-
const maxScale = span.dataset.maxScale || '1.1';
|
|
89
|
-
const shadowIntensity = span.dataset.shadowIntensity || '0.6';
|
|
90
|
-
const translateYPeak = span.dataset.translateYPeak || '-2';
|
|
91
|
-
|
|
92
|
-
- const animationParts: string[] = [];
|
|
93
|
-
-
|
|
94
|
-
- const parentSyllable = span.closest('.lyrics-syllable');
|
|
95
|
-
- if (parentSyllable) {
|
|
96
|
-
- const parentDuration = parseFloat(
|
|
97
|
-
- parentSyllable.getAttribute('data-duration') || '0',
|
|
98
|
-
- );
|
|
99
|
-
- const parentStartTime = parseFloat(
|
|
100
|
-
- parentSyllable.getAttribute('data-start-time') || '0',
|
|
101
|
-
- );
|
|
102
|
-
-
|
|
103
|
-
- const startPct = parseFloat(span.dataset.wipeStart || '0');
|
|
104
|
-
- const durationPct = parseFloat(span.dataset.wipeDuration || '0');
|
|
105
|
-
-
|
|
106
|
-
- const relativeStartOffset = Math.max(
|
|
107
|
-
- 0,
|
|
108
|
-
- parentStartTime - firstSyllableStartTime,
|
|
109
|
-
- );
|
|
110
|
-
- const wipeDelay = relativeStartOffset + parentDuration * startPct;
|
|
111
|
-
- const wipeDuration = parentDuration * durationPct;
|
|
112
|
-
-
|
|
113
|
-
- const useStartAnimation = isFirstInContainer && charIndexInWord === 0;
|
|
114
|
-
- let charWipeAnimation = 'wipe';
|
|
115
|
-
- if (useStartAnimation)
|
|
116
|
-
- charWipeAnimation = isRTL ? 'start-wipe-rtl' : 'start-wipe';
|
|
117
|
-
- else charWipeAnimation = isRTL ? 'wipe-rtl' : 'wipe';
|
|
118
|
-
-
|
|
119
|
-
- // Blend word and syllable durations to let the gradient flow smoothly
|
|
120
|
-
- // while still responding to syllable pacing (no strict exactness, just natural flow)
|
|
121
|
-
- const growDelay = wipeDelay;
|
|
122
|
-
- const growDurationMs = Math.max(
|
|
123
|
-
- 600,
|
|
124
|
-
- wordDurationMs * 0.8 + parentDuration * 1.5,
|
|
125
|
-
- );
|
|
126
|
-
-
|
|
127
|
-
- animationParts.push(
|
|
128
|
-
- `grow-dynamic ${growDurationMs}ms ease-in-out ${growDelay}ms forwards`,
|
|
129
|
-
- );
|
|
130
|
-
-
|
|
131
|
-
- if (wipeDuration > 0) {
|
|
132
|
-
- animationParts.push(
|
|
133
|
-
- `${charWipeAnimation} ${wipeDuration}ms linear ${wipeDelay}ms forwards`,
|
|
134
|
-
- );
|
|
135
|
-
- }
|
|
136
|
-
- }
|
|
137
|
-
+ const syllableCharIndex = parseFloat(
|
|
138
|
-
+ span.dataset.syllableCharIndex || '0',
|
|
139
|
-
+ );
|
|
140
|
-
+ const growDelay = baseDelayPerChar * syllableCharIndex;
|
|
141
|
-
|
|
142
|
-
- charAnimationsMap.set(span, animationParts.join(', '));
|
|
143
|
-
+ charAnimationsMap.set(
|
|
144
|
-
+ span,
|
|
145
|
-
+ `grow-dynamic ${growDurationMs}ms ease-in-out ${growDelay}ms forwards`,
|
|
146
|
-
+ );
|
|
147
|
-
|
|
148
|
-
styleUpdates.push({
|
|
149
|
-
element: span,
|
|
150
|
-
@@ -4431,31 +4388,10 @@ export class AmLyrics extends LitElement {
|
|
151
|
-
value: `${translateYPeak}`,
|
|
152
|
-
});
|
|
153
|
-
});
|
|
154
|
-
- } else if (isGrowable && !isFirstSyllable && charSpans.length > 0) {
|
|
155
|
-
- // For subsequent syllables of a growable word:
|
|
156
|
-
- // If they already have `grow-dynamic`, it means the first syllable correctly took care of BOTH grow and wipe!
|
|
157
|
-
- // Otherwise, they scrubbed directly into this syllable, so let's at least do the wipe.
|
|
158
|
-
- charSpans.forEach(span => {
|
|
159
|
-
- const existingAnimation =
|
|
160
|
-
- charAnimationsMap.get(span) || span.style.animation || '';
|
|
161
|
-
- if (existingAnimation.includes('grow-dynamic')) return;
|
|
162
|
-
-
|
|
163
|
-
- const startPct = parseFloat(span.dataset.wipeStart || '0');
|
|
164
|
-
- const durationPct = parseFloat(span.dataset.wipeDuration || '0');
|
|
165
|
-
- const wipeDelay = syllableDurationMs * startPct;
|
|
166
|
-
- const wipeDuration = syllableDurationMs * durationPct;
|
|
167
|
-
-
|
|
168
|
-
- const charWipeAnimation = isRTL ? 'wipe-rtl' : 'wipe';
|
|
169
|
-
+ }
|
|
170
|
-
|
|
171
|
-
- if (wipeDuration > 0) {
|
|
172
|
-
- charAnimationsMap.set(
|
|
173
|
-
- span,
|
|
174
|
-
- `${charWipeAnimation} ${wipeDuration}ms linear ${wipeDelay}ms forwards`,
|
|
175
|
-
- );
|
|
176
|
-
- }
|
|
177
|
-
- });
|
|
178
|
-
- } else if (charSpans.length > 0) {
|
|
179
|
-
- // Per-character wipe for non-growable words (matching YouLyPlus)
|
|
180
|
-
+ // Step 2: Wipe Pass
|
|
181
|
-
+ if (charSpans.length > 0) {
|
|
182
|
-
charSpans.forEach((span, charIndex) => {
|
|
183
|
-
const startPct = parseFloat(span.dataset.wipeStart || '0');
|
|
184
|
-
const durationPct = parseFloat(span.dataset.wipeDuration || '0');
|
|
185
|
-
@@ -4471,12 +4407,23 @@ export class AmLyrics extends LitElement {
|
|
186
|
-
charWipeAnimation = isRTL ? 'wipe-rtl' : 'wipe';
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
+ const existingAnimation =
|
|
190
|
-
+ charAnimationsMap.get(span) || span.style.animation || '';
|
|
191
|
-
+
|
|
192
|
-
+ const animationParts = [];
|
|
193
|
-
+
|
|
194
|
-
+ if (existingAnimation && existingAnimation.includes('grow-dynamic')) {
|
|
195
|
-
+ animationParts.push(existingAnimation.split(',')[0].trim());
|
|
196
|
-
+ }
|
|
197
|
-
if (wipeDuration > 0) {
|
|
198
|
-
- charAnimationsMap.set(
|
|
199
|
-
- span,
|
|
200
|
-
+ animationParts.push(
|
|
201
|
-
`${charWipeAnimation} ${wipeDuration}ms linear ${wipeDelay}ms forwards`,
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
+
|
|
205
|
-
+ if (animationParts.length > 0) {
|
|
206
|
-
+ charAnimationsMap.set(span, animationParts.join(', '));
|
|
207
|
-
+ }
|
|
208
|
-
});
|
|
209
|
-
} else {
|
|
210
|
-
// Syllable-level wipe for regular (non-growable) words without chars
|
package/patch2.diff
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
diff --git a/src/AmLyrics.ts b/src/AmLyrics.ts
|
|
2
|
-
index 94ef709..f301abc 100644
|
|
3
|
-
--- a/src/AmLyrics.ts
|
|
4
|
-
+++ b/src/AmLyrics.ts
|
|
5
|
-
@@ -4414,6 +4414,20 @@ export class AmLyrics extends LitElement {
|
|
6
|
-
if (existingAnimation && existingAnimation.includes('grow-dynamic')) {
|
|
7
|
-
animationParts.push(existingAnimation.split(',')[0].trim());
|
|
8
|
-
}
|
|
9
|
-
+
|
|
10
|
-
+ if (charIndex > 0) {
|
|
11
|
-
+ const arrivalTime = parseFloat(span.dataset.preWipeArrival || '0');
|
|
12
|
-
+ const constantDuration = parseFloat(
|
|
13
|
-
+ span.dataset.preWipeDuration || '100',
|
|
14
|
-
+ );
|
|
15
|
-
+ const animDelay = arrivalTime - constantDuration;
|
|
16
|
-
+
|
|
17
|
-
+ if (constantDuration > 0) {
|
|
18
|
-
+ animationParts.push(
|
|
19
|
-
+ `pre-wipe-char ${constantDuration}ms linear ${animDelay}ms forwards`,
|
|
20
|
-
+ );
|
|
21
|
-
+ }
|
|
22
|
-
+ }
|
|
23
|
-
+
|
|
24
|
-
if (wipeDuration > 0) {
|
|
25
|
-
animationParts.push(
|
|
26
|
-
`${charWipeAnimation} ${wipeDuration}ms linear ${wipeDelay}ms forwards`,
|