@applemusic-like-lyrics/core 0.2.0 → 0.3.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 +35 -0
- package/dist/amll-core.css +2 -1
- package/dist/amll-core.js +10626 -7358
- package/dist/amll-core.js.map +1 -1
- package/dist/bg-render/base.d.ts +2 -3
- package/dist/bg-render/img.d.ts +0 -1
- package/dist/bg-render/index.d.ts +0 -1
- package/dist/bg-render/mesh-renderer/cp-generate.d.ts +0 -1
- package/dist/bg-render/mesh-renderer/cp-presets.d.ts +1 -2
- package/dist/bg-render/mesh-renderer/index.d.ts +5 -3
- package/dist/bg-render/pixi-renderer.d.ts +0 -1
- package/dist/canvas-test.d.ts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/interfaces.d.ts +52 -4
- package/dist/lyric-player/base.d.ts +52 -8
- package/dist/lyric-player/bottom-line.d.ts +4 -2
- package/dist/lyric-player/canvas/index.d.ts +0 -1
- package/dist/lyric-player/canvas/lyric-line.d.ts +0 -2
- package/dist/lyric-player/canvas/text-layout.d.ts +0 -1
- package/dist/lyric-player/dom/index.d.ts +0 -1
- package/dist/lyric-player/dom/interlude-dots.d.ts +0 -1
- package/dist/lyric-player/dom/lyric-line.d.ts +15 -8
- package/dist/lyric-player/dom-slim/index.d.ts +0 -1
- package/dist/lyric-player/dom-slim/interlude-dots.d.ts +0 -1
- package/dist/lyric-player/dom-slim/lyric-line.d.ts +2 -4
- package/dist/lyric-player/index.d.ts +21 -3
- package/dist/mg-test.d.ts +0 -1
- package/dist/utils/debounce.d.ts +0 -1
- package/dist/utils/derivative.d.ts +0 -1
- package/dist/utils/eq-set.d.ts +0 -1
- package/dist/utils/flagsets.d.ts +0 -1
- package/dist/utils/is-cjk.d.ts +0 -1
- package/dist/utils/linear.d.ts +0 -1
- package/dist/utils/lyric-split-words.d.ts +0 -1
- package/dist/utils/matrix.d.ts +0 -1
- package/dist/utils/mutex.d.ts +0 -1
- package/dist/utils/optimize-lyric.d.ts +9 -0
- package/dist/utils/resource.d.ts +0 -1
- package/dist/utils/schedule.d.ts +0 -1
- package/dist/utils/spring.d.ts +0 -1
- package/dist/utils/wa-spring.d.ts +0 -7
- package/package.json +12 -12
- package/dist/bg-render/base.d.ts.map +0 -1
- package/dist/bg-render/img.d.ts.map +0 -1
- package/dist/bg-render/index.d.ts.map +0 -1
- package/dist/bg-render/mesh-renderer/cp-generate.d.ts.map +0 -1
- package/dist/bg-render/mesh-renderer/cp-presets.d.ts.map +0 -1
- package/dist/bg-render/mesh-renderer/index.d.ts.map +0 -1
- package/dist/bg-render/pixi-renderer.d.ts.map +0 -1
- package/dist/canvas-test.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/interfaces.d.ts.map +0 -1
- package/dist/lyric-player/base.d.ts.map +0 -1
- package/dist/lyric-player/bottom-line.d.ts.map +0 -1
- package/dist/lyric-player/canvas/index.d.ts.map +0 -1
- package/dist/lyric-player/canvas/lyric-line.d.ts.map +0 -1
- package/dist/lyric-player/canvas/text-layout.d.ts.map +0 -1
- package/dist/lyric-player/dom/index.d.ts.map +0 -1
- package/dist/lyric-player/dom/interlude-dots.d.ts.map +0 -1
- package/dist/lyric-player/dom/lyric-line.d.ts.map +0 -1
- package/dist/lyric-player/dom-slim/index.d.ts.map +0 -1
- package/dist/lyric-player/dom-slim/interlude-dots.d.ts.map +0 -1
- package/dist/lyric-player/dom-slim/lyric-line.d.ts.map +0 -1
- package/dist/lyric-player/index.d.ts.map +0 -1
- package/dist/mg-test.d.ts.map +0 -1
- package/dist/utils/debounce.d.ts.map +0 -1
- package/dist/utils/derivative.d.ts.map +0 -1
- package/dist/utils/eq-set.d.ts.map +0 -1
- package/dist/utils/flagsets.d.ts.map +0 -1
- package/dist/utils/is-cjk.d.ts.map +0 -1
- package/dist/utils/linear.d.ts.map +0 -1
- package/dist/utils/lyric-split-words.d.ts.map +0 -1
- package/dist/utils/matrix.d.ts.map +0 -1
- package/dist/utils/mutex.d.ts.map +0 -1
- package/dist/utils/resource.d.ts.map +0 -1
- package/dist/utils/schedule.d.ts.map +0 -1
- package/dist/utils/spring.d.ts.map +0 -1
- package/dist/utils/wa-spring.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -14,6 +14,13 @@ Everything here is UI framework-independent, so it can be indirectly referenced
|
|
|
14
14
|
|
|
15
15
|
Or if you need to use component bindings, there's a [React binding version](../react/README.md) and a [Vue binding version](../vue/README.md)
|
|
16
16
|
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
- Pure frontend rendering for lyrics and background
|
|
20
|
+
- Word-level timed lyrics with translation and romanization
|
|
21
|
+
- Multi-line, duet, and background line support
|
|
22
|
+
- Style customization via CSS variables
|
|
23
|
+
|
|
17
24
|
## Installation
|
|
18
25
|
|
|
19
26
|
Install the required dependencies (if the dependencies listed below are not installed, you need to install them yourself):
|
|
@@ -46,3 +53,31 @@ player.update(0) // Update lyric component animation (needs to be called every f
|
|
|
46
53
|
```
|
|
47
54
|
|
|
48
55
|
The lyrics set through `LyricPlayer.setLyricLines` is a `LyricLine[]` parameter. For details, please refer to the code in [./src/interfaces.ts](./src/interfaces.ts).
|
|
56
|
+
|
|
57
|
+
## Data Model
|
|
58
|
+
|
|
59
|
+
Lyrics input is `LyricLine[]`, with each line containing:
|
|
60
|
+
|
|
61
|
+
- `words`: timed word array, each word includes `startTime` / `endTime` / `word`, with optional `romanWord`, `ruby`, and `obscene`
|
|
62
|
+
- `translatedLyric`: translation text
|
|
63
|
+
- `romanLyric`: romanization text
|
|
64
|
+
- `startTime` / `endTime`: line timestamps
|
|
65
|
+
- `isBG` / `isDuet`: background and duet flags
|
|
66
|
+
|
|
67
|
+
## Styling
|
|
68
|
+
|
|
69
|
+
The main styles are provided by `@applemusic-like-lyrics/core/style.css`. Common overrides are via CSS variables:
|
|
70
|
+
|
|
71
|
+
```css
|
|
72
|
+
.amll-lyric-player {
|
|
73
|
+
--amll-lp-color: #ffffff;
|
|
74
|
+
--amll-lp-bg-color: rgba(0, 0, 0, 0.35);
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Development
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pnpm -C packages/core dev
|
|
82
|
+
pnpm -C packages/core build
|
|
83
|
+
```
|
package/dist/amll-core.css
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
.amll-lyric-player{width:100%;max-width:100%;height:100%;color:var(--amll-lp-color,white);contain:strict;mix-blend-mode:plus-lighter;font-size:var(--amll-lp-font-size,max(max(5vh,2.5vw),12px));overflow:hidden}@media screen and (
|
|
1
|
+
.amll-lyric-player{width:100%;max-width:100%;height:100%;color:var(--amll-lp-color,white);contain:strict;mix-blend-mode:plus-lighter;font-size:var(--amll-lp-font-size,max(max(5vh, 2.5vw), 12px));overflow:hidden}@media screen and (width<=768px){.amll-lyric-player{font-size:var(--amll-lp-font-size,max(8vw, 12px))}}.amll-lyric-player.dom{--amll-lp-line-width-aspect:.8;--amll-lp-line-padding-x:1em;--amll-lp-bg-line-scale:.7;-webkit-user-select:none;user-select:none;box-sizing:content-box;z-index:1;line-height:1.2em}.amll-lyric-player.dom-slim{--amll-lp-line-width-aspect:.8;--amll-lp-line-padding-x:1em;--amll-lp-bg-line-scale:.7;-webkit-user-select:none;user-select:none;box-sizing:content-box;z-index:1;min-width:0;min-height:0;line-height:1.2em;overflow:hidden scroll}.amll-lyric-player.dom-slim::-webkit-scrollbar{opacity:0}.amll-lyric-player.dom-slim:hover::-webkit-scrollbar{opacity:1}.amll-lyric-player.dom-slim>*{content-visibility:auto;contain-intrinsic-size:100% 2em}@media screen and (width<=768px){.amll-lyric-player{--amll-lp-line-width-aspect:1;--amll-lp-line-padding-x:0}}._lyricLine_1g3au_6{backface-visibility:hidden;transform-origin:0;width:var(--amll-lp-width,100%);min-width:var(--amll-lp-width,100%);max-width:var(--amll-lp-width,100%);contain:content;will-change:transform;box-sizing:border-box;border-radius:.25em;width:100%;height:fit-content;padding:.5em 1em;transition:opacity .25s,filter .2s,background-color .25s,box-shadow .25s;position:absolute}@media screen and (width<=500px){._lyricLine_1g3au_6{padding-left:20px;padding-right:20px}}._lyricLine_1g3au_6._dirty_1g3au_34{opacity:0;visibility:hidden}._lyricLine_1g3au_6:has(>*):hover{background-color:var(--amll-lp-hover-bg-color,#fff1)}._lyricLine_1g3au_6:has(>*):active{background-color:var(--amll-lp-hover-bg-color,#ffffff05)}._lyricBgLine_1g3au_50{opacity:.0001;font-size:max(calc(1em * var(--amll-lp-bg-line-scale,.7)), 10px);padding:1vh calc(var(--amll-lp-line-padding-x,1em) / var(--amll-lp-bg-line-scale,.7));transition:opacity .25s,scale .5s,filter .2s,background-color .25s,box-shadow .25s}._lyricBgLine_1g3au_50._active_1g3au_63{opacity:.4;transition:opacity .5s .25s,scale 1.5s cubic-bezier(0,1,0,1) .25s,filter .2s,background-color .25s,box-shadow .25s}.amll-lyric-player:hover ._lyricLine_1g3au_6{filter:unset!important}.amll-lyric-player._hasDuetLine_1g3au_79 ._lyricLine_1g3au_6:not(._lyricDuetLine_1g3au_80){padding-right:15%}.amll-lyric-player._hasDuetLine_1g3au_79 ._lyricDuetLine_1g3au_80{padding-left:15%}.amll-lyric-player:not(.playing)>._lyricBgLine_1g3au_50{opacity:.4}._lyricDuetLine_1g3au_80{text-align:right;transform-origin:100%}._lyricMainLine_1g3au_99{text-wrap:balance;word-break:keep-all;overflow-wrap:break-word;margin:-1em;padding:1em;transition:opacity .3s .1s}._lyricMainLine_1g3au_99 span{text-align:start;vertical-align:bottom;display:inline-block}._lyricMainLine_1g3au_99 ._romanWord_1g3au_116{padding-inline-end:.3em;font-size:.5em;line-height:1em;display:flex}._lyricMainLine_1g3au_99 ._rubyWord_1g3au_123{justify-content:center;min-height:1em;font-size:.5em;line-height:1em;display:flex}._lyricMainLine_1g3au_99 ._wordWithRuby_1g3au_131{vertical-align:bottom;flex-direction:column;align-items:center;display:inline-flex}._lyricMainLine_1g3au_99 ._wordBody_1g3au_138{flex-direction:column;align-items:center;display:flex}._lyricMainLine_1g3au_99>span,._lyricMainLine_1g3au_99 span._emphasizeWrapper_1g3au_145{white-space:pre-wrap;will-change:transform;vertical-align:bottom;margin:-1em;padding:1em;display:inline-block}:is(._lyricMainLine_1g3au_99>span,._lyricMainLine_1g3au_99 span._emphasizeWrapper_1g3au_145)._emphasize_1g3au_145,:is(._lyricMainLine_1g3au_99>span,._lyricMainLine_1g3au_99 span._emphasizeWrapper_1g3au_145) span._emphasize_1g3au_145{backface-visibility:hidden;margin:-1em;padding:1em}:is(:is(._lyricMainLine_1g3au_99>span,._lyricMainLine_1g3au_99 span._emphasizeWrapper_1g3au_145)._emphasize_1g3au_145,:is(._lyricMainLine_1g3au_99>span,._lyricMainLine_1g3au_99 span._emphasizeWrapper_1g3au_145) span._emphasize_1g3au_145)>span{will-change:transform;backface-visibility:hidden;margin:-1em;padding:1em}._lyricSubLine_1g3au_169{opacity:.3;font-size:max(.5em,10px);line-height:1.5em;transition:opacity .2s .25s}._disableSpring_1g3au_176>*{transition:filter .25s,transform .5s,background-color .25s,box-shadow .25s}._interludeDots_1g3au_184{transform-origin:50%;opacity:0;gap:.25em;width:fit-content;height:clamp(.5em,1vh,3em);padding:2.5% .75em;transition:opacity .25s;display:flex;position:absolute;left:0}._interludeDots_1g3au_184._enabled_1g3au_196{opacity:1}._interludeDots_1g3au_184>*{aspect-ratio:1;background-color:var(--amll-lp-color,white);border-radius:50%;width:clamp(.5em,1vh,3em);height:clamp(.5em,1vh,3em);margin-right:4px;display:inline-block}._interludeDots_1g3au_184._duet_1g3au_210{transform-origin:50%;right:0}@supports (mix-blend-mode:plus-lighter){._lyricSubLine_1g3au_169{opacity:.3}}._tmpDisableTransition_1g3au_222{transition:none!important}._bottomLine_1g3au_226{cursor:default;padding-top:0;padding-bottom:0;line-height:1.8em}._bottomLine_1g3au_226:empty{height:0;margin:0;padding:0;display:none}._lyricLine_1p6y5_6{width:var(--amll-lp-width,100%);min-width:var(--amll-lp-width,100%);max-width:var(--amll-lp-width,100%);contain:content;box-sizing:border-box;border-radius:.25em;width:100%;height:fit-content;padding:2vh 1em;transition:opacity .25s,filter .2s,background-color .25s,box-shadow .25s}._lyricLine_1p6y5_6:has(>*):hover{background-color:var(--amll-lp-hover-bg-color,#fff1)}._lyricLine_1p6y5_6:has(>*):active{background-color:var(--amll-lp-hover-bg-color,#ffffff05)}._lyricBgLine_1p6y5_36{opacity:0;font-size:max(calc(1em * var(--amll-lp-bg-line-scale,.7)), 10px);padding:1vh calc(var(--amll-lp-line-padding-x,1em) / var(--amll-lp-bg-line-scale,.7));transition:opacity .25s,scale .5s,filter .2s,background-color .25s,box-shadow .25s}._lyricBgLine_1p6y5_36._active_1p6y5_49{opacity:.4;transition:opacity .5s .25s,scale 1.5s cubic-bezier(0,1,0,1) .25s,filter .2s,background-color .25s,box-shadow .25s}.amll-lyric-player:hover ._lyricLine_1p6y5_6{filter:unset!important}.amll-lyric-player._hasDuetLine_1p6y5_65 ._lyricLine_1p6y5_6:not(._lyricDuetLine_1p6y5_66){padding-right:15%}.amll-lyric-player._hasDuetLine_1p6y5_65 ._lyricDuetLine_1p6y5_66{padding-left:15%}._lyricDuetLine_1p6y5_66{text-align:right;transform-origin:100%}._lyricMainLine_1p6y5_80{contain:content paint;transition:opacity .3s .1s}._lyricMainLine_1p6y5_80 span{white-space:pre;display:inline-block}._lyricMainLine_1p6y5_80 ._romanWord_1p6y5_89{font-size:.5em;line-height:1em;display:flex}._lyricMainLine_1p6y5_80 ._rubyWord_1p6y5_95{justify-content:center;min-height:1em;font-size:.5em;line-height:1em;display:flex}._lyricMainLine_1p6y5_80 ._wordWithRuby_1p6y5_103{flex-direction:column;align-items:center;display:inline-flex}._lyricMainLine_1p6y5_80 ._wordBody_1p6y5_109{flex-direction:column;align-items:center;display:flex}._lyricSubLine_1p6y5_116{opacity:.3;font-size:max(.5em,10px);line-height:1.5em;transition:opacity .2s .25s}._interludeDots_1p6y5_123{transform-origin:50%;opacity:0;gap:.25em;width:fit-content;height:clamp(.5em,1vh,3em);padding:2.5% .75em;transition:opacity .25s;display:flex;left:0}._interludeDots_1p6y5_123._enabled_1p6y5_134{opacity:1}._interludeDots_1p6y5_123>*{aspect-ratio:1;background-color:var(--amll-lp-color,white);border-radius:50%;width:clamp(.5em,1vh,3em);height:clamp(.5em,1vh,3em);margin-right:4px;display:inline-block}._interludeDots_1p6y5_123._duet_1p6y5_148{transform-origin:50%;right:0}@supports (mix-blend-mode:plus-lighter){._lyricSubLine_1p6y5_116{opacity:.3}}._tmpDisableTransition_1p6y5_160{transition:none!important}
|
|
2
|
+
/*$vite$:1*/
|