@applemusic-like-lyrics/core 0.5.1 → 0.6.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.
@@ -0,0 +1,13 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, no_symbols) => {
4
+ let target = {};
5
+ for (var name in all) __defProp(target, name, {
6
+ get: all[name],
7
+ enumerable: true
8
+ });
9
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
+ return target;
11
+ };
12
+ //#endregion
13
+ export { __exportAll as t };
package/dist/style.css CHANGED
@@ -29,16 +29,40 @@
29
29
  --amll-lp-line-padding-x: 0;
30
30
  }
31
31
  }
32
+ @property --bright-mask-alpha {
33
+ syntax: "<number>";
34
+ inherits: true;
35
+ initial-value: 1;
36
+ }
37
+
38
+ @property --dark-mask-alpha {
39
+ syntax: "<number>";
40
+ inherits: true;
41
+ initial-value: .2;
42
+ }
43
+
32
44
  .FmKaba_lyricLineWrapper {
33
- will-change: transform, opacity, filter;
45
+ box-sizing: border-box;
46
+ width: 100%;
47
+ padding: .4em var(--lyric-line-padding-x);
48
+ will-change: transform;
49
+ border-radius: .25em;
34
50
  flex-direction: column;
35
51
  align-items: flex-start;
36
- width: 100%;
37
- transition: opacity .4s, filter .4s;
52
+ gap: .3em;
53
+ transition: opacity .4s, filter .4s, background-color .25s;
38
54
  display: flex;
39
55
  position: absolute;
40
56
  top: 0;
41
57
  left: 0;
58
+
59
+ &:not(.FmKaba_bottomLineWrapper):hover {
60
+ background-color: var(--amll-lp-hover-bg-color, #fff1);
61
+ }
62
+
63
+ &:not(.FmKaba_bottomLineWrapper):active {
64
+ background-color: var(--amll-lp-hover-bg-color, #ffffff05);
65
+ }
42
66
  }
43
67
 
44
68
  .FmKaba_lyricLine {
@@ -46,32 +70,26 @@
46
70
  width: var(--amll-lp-width, 100%);
47
71
  min-width: var(--amll-lp-width, 100%);
48
72
  max-width: var(--amll-lp-width, 100%);
49
- contain: content;
73
+ contain: layout style paint;
74
+ content-visibility: auto;
75
+ contain-intrinsic-size: auto 40px;
50
76
  backface-visibility: hidden;
51
77
  transform-origin: 0;
52
- will-change: transform;
53
- border-radius: .25em;
78
+ --mask-alpha-duration: .45s;
79
+ --bright-mask-alpha: .2;
80
+ --dark-mask-alpha: .2;
54
81
  height: fit-content;
55
- padding: .5em 1em;
56
- transition: background-color .25s, box-shadow .25s;
82
+ transition: box-shadow .25s,
83
+ --bright-mask-alpha var(--mask-alpha-duration) ease-out,
84
+ --dark-mask-alpha var(--mask-alpha-duration) ease-out;
85
+ margin: -.2em;
86
+ padding: .2em;
57
87
  position: relative;
58
88
 
59
- @media screen and (width <= 500px) {
60
- padding-left: 20px;
61
- padding-right: 20px;
62
- }
63
-
64
- &.FmKaba_dirty {
65
- opacity: 0;
66
- visibility: hidden;
67
- }
68
-
69
- &:has( > *):hover {
70
- background-color: var(--amll-lp-hover-bg-color, #fff1);
71
- }
72
-
73
- &:has( > *):active {
74
- background-color: var(--amll-lp-hover-bg-color, #ffffff05);
89
+ &.FmKaba_gradientMask {
90
+ --mask-alpha-duration: .3s;
91
+ --bright-mask-alpha: 1;
92
+ --dark-mask-alpha: .4;
75
93
  }
76
94
  }
77
95
 
@@ -81,6 +99,7 @@
81
99
  }
82
100
 
83
101
  .FmKaba_lyricMainLine {
102
+ contain: layout style;
84
103
  margin: -1em;
85
104
  padding: 1em;
86
105
  transition: opacity .3s .1s;
@@ -115,25 +134,33 @@
115
134
 
116
135
  & .FmKaba_wordBody {
117
136
  flex-direction: column;
118
- align-items: center;
119
137
  display: flex;
120
138
  }
121
139
 
140
+ & .FmKaba_rubyBaseWord {
141
+ white-space: nowrap;
142
+ flex-wrap: nowrap;
143
+ justify-content: center;
144
+ display: inline-flex;
145
+ }
146
+
122
147
  & > span, & span.FmKaba_emphasizeWrapper {
123
148
  white-space: pre-wrap;
124
149
  vertical-align: bottom;
125
- will-change: transform;
150
+ contain: layout style;
126
151
  margin: -1em;
127
152
  padding: 1em;
128
153
  display: inline-block;
129
154
 
130
- &.FmKaba_emphasize, & span.FmKaba_emphasize {
131
- backface-visibility: hidden;
155
+ & > span {
132
156
  margin: -1em;
133
157
  padding: 1em;
158
+ }
159
+
160
+ &.FmKaba_emphasize, & span.FmKaba_emphasize {
161
+ backface-visibility: hidden;
134
162
 
135
163
  & > span {
136
- will-change: transform;
137
164
  backface-visibility: hidden;
138
165
  margin: -1em;
139
166
  padding: 1em;
@@ -144,10 +171,11 @@
144
171
 
145
172
  .FmKaba_lyricBgLine {
146
173
  opacity: .4;
147
- padding: 1vh
148
- calc(var(--amll-lp-line-padding-x, 1em) / var(--amll-lp-bg-line-scale, .7));
149
174
  font-size: max(calc(1em * var(--amll-lp-bg-line-scale, .7)), 10px);
150
- transition: background-color .25s, box-shadow .25s;
175
+ transition: background-color .25s,
176
+ box-shadow .25s,
177
+ --bright-mask-alpha var(--mask-alpha-duration) ease-out,
178
+ --dark-mask-alpha var(--mask-alpha-duration) ease-out;
151
179
 
152
180
  & .FmKaba_lyricMainLine {
153
181
  padding: 1.2em 1em;
@@ -155,7 +183,10 @@
155
183
 
156
184
  &.FmKaba_active {
157
185
  opacity: .4;
158
- transition: background-color .25s, box-shadow .25s;
186
+ transition: background-color .25s,
187
+ box-shadow .25s,
188
+ --bright-mask-alpha var(--mask-alpha-duration) ease-out,
189
+ --dark-mask-alpha var(--mask-alpha-duration) ease-out;
159
190
  }
160
191
  }
161
192
 
@@ -171,10 +202,17 @@
171
202
  }
172
203
 
173
204
  .FmKaba_bottomLine {
205
+ font-size: var(--amll-lp-bottom-line-font-size, max(.7em, 10px));
174
206
  cursor: default;
207
+ opacity: .2;
175
208
  padding-top: 0;
176
209
  padding-bottom: 0;
177
210
  line-height: 1.8em;
211
+ transition: opacity .4s;
212
+
213
+ &.FmKaba_gradientMask {
214
+ opacity: .85;
215
+ }
178
216
 
179
217
  &:empty {
180
218
  height: 0;
@@ -185,34 +223,37 @@
185
223
  }
186
224
 
187
225
  .FmKaba_bgWrapper {
226
+ top: 100%;
227
+ left: var(--lyric-line-padding-x);
188
228
  z-index: -1;
189
229
  align-items: inherit;
230
+ width: calc(100% - var(--lyric-line-padding-x) * 2);
190
231
  visibility: visible;
191
232
  pointer-events: auto;
192
233
  opacity: 0;
193
- width: 100%;
194
- transform-origin: var(--lyric-line-padding-x) top;
234
+ transform-origin: 0 0;
195
235
  flex-direction: column;
196
236
  transition: opacity .3s;
197
237
  display: flex;
198
238
  position: absolute;
199
- top: 100%;
200
- left: 0;
201
239
  }
202
240
 
203
241
  .FmKaba_bgWrapperTop {
204
- transform-origin: var(--lyric-line-padding-x) bottom;
205
- margin-top: -999px;
242
+ transform-origin: 0 100%;
243
+ width: 100%;
206
244
  position: relative;
207
245
  top: auto;
208
246
  bottom: auto;
247
+ left: 0;
209
248
  }
210
249
 
211
250
  .FmKaba_bgWrapperActive {
212
251
  opacity: 1;
252
+ width: 100%;
213
253
  position: relative;
214
254
  top: auto;
215
255
  bottom: auto;
256
+ left: 0;
216
257
  }
217
258
 
218
259
  .FmKaba_bgWrapperHidden {
@@ -221,35 +262,24 @@
221
262
  }
222
263
 
223
264
  .FmKaba_interludeDots {
224
- opacity: 0;
225
- transform-origin: center;
226
- gap: .25em;
227
265
  width: fit-content;
228
266
  height: clamp(.5em, 1vh, 3em);
229
- padding: 2.5% .75em;
230
- transition: opacity .25s;
267
+ padding: .4em var(--lyric-line-padding-x);
268
+ transform-origin: center;
269
+ align-items: center;
270
+ gap: .18em;
231
271
  display: flex;
232
272
  position: absolute;
233
273
  left: 0;
234
274
 
235
- &.FmKaba_enabled {
236
- opacity: 1;
237
- }
238
-
239
275
  & > * {
240
276
  background-color: var(--amll-lp-color, white);
241
277
  aspect-ratio: 1;
242
278
  border-radius: 50%;
243
- width: clamp(.5em, 1vh, 3em);
244
- height: clamp(.5em, 1vh, 3em);
245
- margin-right: 4px;
279
+ width: .3em;
280
+ height: .3em;
246
281
  display: inline-block;
247
282
  }
248
-
249
- &.FmKaba_duet {
250
- transform-origin: center;
251
- right: 0;
252
- }
253
283
  }
254
284
 
255
285
  .FmKaba_disableSpring > *, .FmKaba_disableSpring .FmKaba_lyricLine {
@@ -262,6 +292,7 @@
262
292
 
263
293
  .amll-lyric-player {
264
294
  --lyric-line-padding-x: 1em;
295
+ touch-action: pan-x;
265
296
 
266
297
  @media screen and (width <= 500px) {
267
298
  --lyric-line-padding-x: 20px;
@@ -271,6 +302,15 @@
271
302
  filter: unset !important;
272
303
  }
273
304
 
305
+ &:not(.FmKaba_playing) .FmKaba_bgWrapper {
306
+ opacity: 1;
307
+ width: 100%;
308
+ position: relative;
309
+ top: auto;
310
+ bottom: auto;
311
+ left: 0;
312
+ }
313
+
274
314
  &.FmKaba_hasDuetLine {
275
315
  & .FmKaba_lyricLine:not(.FmKaba_lyricDuetLine) {
276
316
  padding-right: 15%;
@@ -280,23 +320,16 @@
280
320
  padding-left: 15%;
281
321
  }
282
322
 
283
- & .FmKaba_lyricLineWrapper:has(.FmKaba_lyricDuetLine) {
323
+ & .FmKaba_isDuetWrapper {
284
324
  align-items: flex-end;
285
325
 
286
326
  & .FmKaba_bgWrapper {
287
- transform-origin: calc(100% - var(--lyric-line-padding-x)) top;
327
+ transform-origin: 100% 0;
288
328
  }
289
329
 
290
330
  & .FmKaba_bgWrapperTop {
291
- transform-origin: calc(100% - var(--lyric-line-padding-x)) bottom;
331
+ transform-origin: 100% 100%;
292
332
  }
293
333
  }
294
334
  }
295
-
296
- &:not(.FmKaba_playing) .FmKaba_bgWrapper {
297
- opacity: 1;
298
- position: relative;
299
- top: auto;
300
- bottom: auto;
301
- }
302
335
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applemusic-like-lyrics/core",
3
- "version": "0.5.1",
3
+ "version": "0.6.0",
4
4
  "description": "AMLL 的纯 JS 核心组件框架,包括歌词显示组件和背景组件等其它可以复用的组件",
5
5
  "repository": {
6
6
  "url": "https://github.com/amll-dev/applemusic-like-lyrics.git",
@@ -50,16 +50,16 @@
50
50
  }
51
51
  },
52
52
  "devDependencies": {
53
- "@biomejs/biome": "^2.4.8",
53
+ "@biomejs/biome": "^2.5.7",
54
+ "@tsdown/css": "^0.22.14",
54
55
  "@types/deep-freeze": "^0.1.5",
55
56
  "@types/stats.js": "^0.17.3",
56
57
  "@types/ungap__structured-clone": "^1.2.0",
57
58
  "lil-gui": "^0.21.0",
58
59
  "stats.js": "^0.17.0",
59
- "typedoc": "^0.28.18",
60
- "typedoc-plugin-markdown": "^4.11.0",
61
- "@tsdown/css": "^0.21.9",
62
- "tsdown": "^0.21.9"
60
+ "tsdown": "^0.22.14",
61
+ "typedoc": "^0.28.20",
62
+ "typedoc-plugin-markdown": "^4.12.0"
63
63
  },
64
64
  "peerDependencies": {
65
65
  "@pixi/app": "*",
@@ -71,10 +71,11 @@
71
71
  "@pixi/sprite": "*"
72
72
  },
73
73
  "dependencies": {
74
- "@ungap/structured-clone": "^1.3.0",
75
- "bezier-easing": "^3.0.0",
74
+ "@ungap/structured-clone": "^1.3.3",
75
+ "bezier-easing": "^3.0.1",
76
76
  "deep-freeze": "^0.0.1",
77
- "gl-matrix": "4.0.0-beta.2"
77
+ "gl-matrix": "4.0.0-beta.2",
78
+ "vitest": "^4.1.10"
78
79
  },
79
80
  "scripts": {
80
81
  "build:docs": "typedoc --plugin typedoc-plugin-markdown --out docs src/index.ts",
@@ -83,6 +84,9 @@
83
84
  "build": "run-p typecheck \"build-only {@}\" --",
84
85
  "build:dev": "tsdown",
85
86
  "fmt": "biome format --write ./src",
86
- "dev": "nx run @applemusic-like-lyrics/playground-core:dev"
87
+ "dev": "nx run @applemusic-like-lyrics/playground-core:dev",
88
+ "test": "vitest test",
89
+ "test:watch": "vitest test --watch",
90
+ "test:coverage": "vitest test --coverage"
87
91
  }
88
92
  }