@applemusic-like-lyrics/vue 0.5.2 → 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.
- package/README.md +1 -3
- package/dist/amll-vue.cjs +36 -18
- package/dist/amll-vue.cjs.map +1 -1
- package/dist/amll-vue.d.cts +30 -11
- package/dist/amll-vue.d.mts +29 -10
- package/dist/amll-vue.mjs +191 -170
- package/dist/amll-vue.mjs.map +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -34,9 +34,7 @@ yarn add @applemusic-like-lyrics/vue # using yarn
|
|
|
34
34
|
|
|
35
35
|
## Usage Summary
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
(Or refer to the React binding, as both have identical properties and reference methods)
|
|
37
|
+
For detailed API documentation, please refer to [AMLL Docs](https://amll.dev/en/reference/vue.html).
|
|
40
38
|
|
|
41
39
|
A test program can be found in [../playground/vue/src/test.ts](../playground/vue/src/test.ts).
|
|
42
40
|
|
package/dist/amll-vue.cjs
CHANGED
|
@@ -210,6 +210,13 @@ const lyricPlayerProps = {
|
|
|
210
210
|
default: _applemusic_like_lyrics_core.MaskObsceneWordsMode.Disabled
|
|
211
211
|
},
|
|
212
212
|
/**
|
|
213
|
+
* 设置不雅用语掩码使用的字符,默认为 `*`
|
|
214
|
+
*/
|
|
215
|
+
maskObsceneWordChar: {
|
|
216
|
+
type: String,
|
|
217
|
+
default: "*"
|
|
218
|
+
},
|
|
219
|
+
/**
|
|
213
220
|
* 设置歌词优化选项
|
|
214
221
|
*/
|
|
215
222
|
optimizeOptions: {
|
|
@@ -291,6 +298,7 @@ const LyricPlayer = (0, vue.defineComponent)({
|
|
|
291
298
|
setup(props, { expose, emit, attrs, slots }) {
|
|
292
299
|
const wrapperRef = (0, vue.useTemplateRef)("wrapper-ref");
|
|
293
300
|
const playerRef = (0, vue.ref)();
|
|
301
|
+
let prevLyricLines;
|
|
294
302
|
const lineClickHandler = (e) => emit("lineClick", e);
|
|
295
303
|
const lineContextMenuHandler = (e) => emit("lineContextmenu", e);
|
|
296
304
|
(0, vue.onMounted)(() => {
|
|
@@ -326,10 +334,35 @@ const LyricPlayer = (0, vue.defineComponent)({
|
|
|
326
334
|
});
|
|
327
335
|
}
|
|
328
336
|
});
|
|
337
|
+
(0, vue.watch)([
|
|
338
|
+
playerRef,
|
|
339
|
+
() => props.lyricLines,
|
|
340
|
+
() => props.optimizeOptions,
|
|
341
|
+
() => props.maskObsceneWordsMode,
|
|
342
|
+
() => props.maskObsceneWordChar
|
|
343
|
+
], ([player, lyricLines]) => {
|
|
344
|
+
if (!player) return;
|
|
345
|
+
const isLyricLinesChanged = lyricLines !== prevLyricLines;
|
|
346
|
+
prevLyricLines = lyricLines;
|
|
347
|
+
if (isLyricLinesChanged) {
|
|
348
|
+
player.setLyricProcessConfig({
|
|
349
|
+
optimizeOptions: props.optimizeOptions,
|
|
350
|
+
maskMode: props.maskObsceneWordsMode,
|
|
351
|
+
maskChar: props.maskObsceneWordChar
|
|
352
|
+
});
|
|
353
|
+
player.setLyricLines(lyricLines ?? []);
|
|
354
|
+
if (props.currentTime !== void 0) player.setCurrentTime(props.currentTime, true);
|
|
355
|
+
} else player.updateLyricProcessConfig({
|
|
356
|
+
optimizeOptions: props.optimizeOptions,
|
|
357
|
+
maskMode: props.maskObsceneWordsMode,
|
|
358
|
+
maskChar: props.maskObsceneWordChar
|
|
359
|
+
});
|
|
360
|
+
}, { immediate: true });
|
|
329
361
|
(0, vue.watchEffect)(() => {
|
|
330
|
-
if (props.playing !== void 0)
|
|
331
|
-
|
|
332
|
-
|
|
362
|
+
if (props.playing !== void 0) {
|
|
363
|
+
if (props.playing) playerRef.value?.resume();
|
|
364
|
+
else playerRef.value?.pause();
|
|
365
|
+
} else playerRef.value?.resume();
|
|
333
366
|
});
|
|
334
367
|
(0, vue.watchEffect)(() => {
|
|
335
368
|
if (props.alignAnchor !== void 0) playerRef.value?.setAlignAnchor(props.alignAnchor);
|
|
@@ -337,10 +370,6 @@ const LyricPlayer = (0, vue.defineComponent)({
|
|
|
337
370
|
(0, vue.watchEffect)(() => {
|
|
338
371
|
if (props.hidePassedLines !== void 0) playerRef.value?.setHidePassedLines(props.hidePassedLines);
|
|
339
372
|
});
|
|
340
|
-
(0, vue.watchEffect)(() => {
|
|
341
|
-
if (props.maskObsceneWordsMode !== void 0) playerRef.value?.setMaskObsceneWords(props.maskObsceneWordsMode);
|
|
342
|
-
else playerRef.value?.setMaskObsceneWords(_applemusic_like_lyrics_core.MaskObsceneWordsMode.Disabled);
|
|
343
|
-
});
|
|
344
373
|
(0, vue.watchEffect)(() => {
|
|
345
374
|
if (props.alignPosition !== void 0) playerRef.value?.setAlignPosition(props.alignPosition);
|
|
346
375
|
});
|
|
@@ -356,17 +385,6 @@ const LyricPlayer = (0, vue.defineComponent)({
|
|
|
356
385
|
if (props.enableScale !== void 0) playerRef.value?.setEnableScale(props.enableScale);
|
|
357
386
|
else playerRef.value?.setEnableScale(true);
|
|
358
387
|
});
|
|
359
|
-
(0, vue.watch)([
|
|
360
|
-
playerRef,
|
|
361
|
-
() => props.lyricLines,
|
|
362
|
-
() => props.optimizeOptions
|
|
363
|
-
], ([player, lyricLines, optimizeOptions]) => {
|
|
364
|
-
if (!player) return;
|
|
365
|
-
if (optimizeOptions !== void 0) player.setOptimizeOptions(optimizeOptions);
|
|
366
|
-
if (lyricLines !== void 0) player.setLyricLines(lyricLines);
|
|
367
|
-
else player.setLyricLines([]);
|
|
368
|
-
if (props.currentTime !== void 0) player.setCurrentTime(props.currentTime, true);
|
|
369
|
-
}, { immediate: true });
|
|
370
388
|
(0, vue.watchEffect)(() => {
|
|
371
389
|
if (props.currentTime !== void 0) playerRef.value?.setCurrentTime(props.currentTime);
|
|
372
390
|
});
|
package/dist/amll-vue.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amll-vue.cjs","names":["AbstractBaseRenderer","BaseRenderer","BackgroundRender","CoreBackgroundRender","MeshGradientRenderer","defineComponent","ExtractPublicPropTypes","onMounted","onUnmounted","PropType","Ref","ref","ShallowRef","useTemplateRef","watchEffect","BackgroundRenderRef","bgRender","wrapperEl","Readonly","HTMLDivElement","backgroundRenderProps","album","type","String","Object","HTMLImageElement","HTMLVideoElement","required","albumIsVideo","Boolean","fps","Number","playing","flowSpeed","hasLyric","lowFreqVolume","renderScale","renderer","args","ConstructorParameters","const","BackgroundRenderProps","name","props","setup","expose","wrapperRef","bgRenderRef","value","new","el","getElement","style","width","height","appendChild","dispose","setAlbum","setFPS","pause","resume","setFlowSpeed","setRenderScale","setLowFreqVolume","undefined","setHasLyric","_createVNode","BaseRenderer","LyricPlayer","CoreLyricPlayer","LyricLine","LyricLineMouseEvent","LyricPlayerBase","MaskObsceneWordsMode","OptimizeLyricOptions","spring","computed","defineComponent","ExtractPublicPropTypes","onMounted","onUnmounted","PropType","Ref","ref","ShallowRef","SlotsType","Teleport","useTemplateRef","watch","watchEffect","lyricPlayerProps","disabled","type","Boolean","default","playing","alignAnchor","String","alignPosition","Number","enableSpring","enableBlur","enableScale","hidePassedLines","maskObsceneWordsMode","Disabled","optimizeOptions","Object","required","lyricLines","currentTime","wordFadeWidth","linePosXSpringParams","Partial","SpringParams","linePosYSpringParams","lineScaleSpringParams","lyricPlayer","args","ConstructorParameters","const","LyricPlayerProps","lyricPlayerEmits","lineClick","_","lineContextmenu","LyricPlayerEmits","LyricPlayerRef","wrapperEl","Readonly","HTMLDivElement","name","props","emits","slots","setup","expose","emit","attrs","wrapperRef","playerRef","lineClickHandler","e","Event","lineContextMenuHandler","wrapper","value","appendChild","getElement","addEventListener","removeEventListener","dispose","onCleanup","canceled","lastTime","onFrame","time","update","requestAnimationFrame","undefined","resume","pause","setAlignAnchor","setHidePassedLines","setMaskObsceneWords","setAlignPosition","setEnableSpring","setEnableBlur","setEnableScale","player","setOptimizeOptions","setLyricLines","setCurrentTime","immediate","setWordFadeWidth","setLinePosXSpringParams","setLinePosYSpringParams","setLineScaleSpringParams","bottomLineEl","getBottomLineElement","_createVNode","_mergeProps"],"sources":["../src/BackgroundRender.tsx","../src/LyricPlayer.tsx"],"sourcesContent":["import {\n\ttype AbstractBaseRenderer,\n\ttype BaseRenderer,\n\tBackgroundRender as CoreBackgroundRender,\n\tMeshGradientRenderer,\n} from \"@applemusic-like-lyrics/core\";\nimport {\n\tdefineComponent,\n\ttype ExtractPublicPropTypes,\n\tonMounted,\n\tonUnmounted,\n\ttype PropType,\n\ttype Ref,\n\tref,\n\ttype ShallowRef,\n\tuseTemplateRef,\n\twatchEffect,\n} from \"vue\";\n\n/**\n * 背景渲染组件的引用\n */\nexport interface BackgroundRenderRef {\n\t/**\n\t * 背景渲染实例引用\n\t */\n\tbgRender?: Ref<AbstractBaseRenderer | undefined>;\n\t/**\n\t * 将背景渲染实例的元素包裹起来的 DIV 元素实例\n\t */\n\twrapperEl: Readonly<ShallowRef<HTMLDivElement | null>>;\n}\n\nconst backgroundRenderProps = {\n\t/**\n\t * 设置背景专辑资源\n\t */\n\talbum: {\n\t\ttype: [String, Object] as PropType<\n\t\t\tstring | HTMLImageElement | HTMLVideoElement\n\t\t>,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置专辑资源是否为视频\n\t */\n\talbumIsVideo: {\n\t\ttype: Boolean,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置当前背景动画帧率,如果为 `undefined` 则默认为 `30`\n\t */\n\tfps: {\n\t\ttype: Number,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置当前播放状态,如果为 `undefined` 则默认为 `true`\n\t */\n\tplaying: {\n\t\ttype: Boolean,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置当前动画流动速度,如果为 `undefined` 则默认为 `2`\n\t */\n\tflowSpeed: {\n\t\ttype: Number,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置背景是否根据“是否有歌词”这个特征调整自身效果,例如有歌词时会变得更加活跃\n\t *\n\t * 部分渲染器会根据这个特征调整自身效果\n\t *\n\t * 如果不确定是否需要赋值或无法知晓是否包含歌词,请传入 true 或不做任何处理(默认值为 true)\n\t */\n\thasLyric: {\n\t\ttype: Boolean,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置低频的音量大小,范围在 80hz-120hz 之间为宜,取值范围在 [0.0-1.0] 之间\n\t *\n\t * 部分渲染器会根据音量大小调整背景效果(例如根据鼓点跳动)\n\t *\n\t * 如果无法获取到类似的数据,请传入 undefined 或 1.0 作为默认值,或不做任何处理(默认值即 1.0)\n\t */\n\tlowFreqVolume: {\n\t\ttype: Number,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置当前渲染缩放比例,如果为 `undefined` 则默认为 `0.5`\n\t */\n\trenderScale: {\n\t\ttype: Number,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置渲染器,如果为 `undefined` 则默认为 `MeshGradientRenderer`\n\t * 默认渲染器有可能会随着版本更新而更换\n\t */\n\trenderer: {\n\t\ttype: Object as PropType<{\n\t\t\tnew (...args: ConstructorParameters<typeof BaseRenderer>): BaseRenderer;\n\t\t}>,\n\t\trequired: false,\n\t},\n} as const;\n\nexport type BackgroundRenderProps = ExtractPublicPropTypes<\n\ttypeof backgroundRenderProps\n>;\n\nexport const BackgroundRender = defineComponent({\n\tname: \"BackgroundRender\",\n\tprops: backgroundRenderProps,\n\tsetup(props, { expose }) {\n\t\tconst wrapperRef = useTemplateRef<HTMLDivElement>(\"wrapper-ref\");\n\t\tconst bgRenderRef = ref<AbstractBaseRenderer>();\n\n\t\tonMounted(() => {\n\t\t\tif (wrapperRef.value) {\n\t\t\t\tbgRenderRef.value = CoreBackgroundRender.new(\n\t\t\t\t\tprops.renderer ?? MeshGradientRenderer,\n\t\t\t\t);\n\t\t\t\tconst el = bgRenderRef.value.getElement();\n\t\t\t\tel.style.width = \"100%\";\n\t\t\t\tel.style.height = \"100%\";\n\t\t\t\twrapperRef.value.appendChild(el);\n\t\t\t}\n\t\t});\n\n\t\tonUnmounted(() => {\n\t\t\tif (bgRenderRef.value) {\n\t\t\t\tbgRenderRef.value.dispose();\n\t\t\t}\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.album)\n\t\t\t\tbgRenderRef.value?.setAlbum(props.album, props.albumIsVideo);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.fps) bgRenderRef.value?.setFPS(props.fps);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.playing) bgRenderRef.value?.pause();\n\t\t\telse bgRenderRef.value?.resume();\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.flowSpeed) bgRenderRef.value?.setFlowSpeed(props.flowSpeed);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.renderScale)\n\t\t\t\tbgRenderRef.value?.setRenderScale(props.renderScale);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.lowFreqVolume)\n\t\t\t\tbgRenderRef.value?.setLowFreqVolume(props.lowFreqVolume);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.hasLyric !== undefined)\n\t\t\t\tbgRenderRef.value?.setHasLyric(props.hasLyric ?? true);\n\t\t});\n\n\t\texpose<BackgroundRenderRef>({\n\t\t\tbgRender: bgRenderRef,\n\t\t\twrapperEl: wrapperRef,\n\t\t});\n\n\t\treturn () => <div style=\"display: contents;\" ref=\"wrapper-ref\" />;\n\t},\n});\n","import {\n\ttype BaseRenderer,\n\tLyricPlayer as CoreLyricPlayer,\n\ttype LyricLine,\n\ttype LyricLineMouseEvent,\n\ttype LyricPlayerBase,\n\tMaskObsceneWordsMode,\n\ttype OptimizeLyricOptions,\n\ttype spring,\n} from \"@applemusic-like-lyrics/core\";\nimport {\n\tcomputed,\n\tdefineComponent,\n\ttype ExtractPublicPropTypes,\n\tonMounted,\n\tonUnmounted,\n\ttype PropType,\n\ttype Ref,\n\tref,\n\ttype ShallowRef,\n\ttype SlotsType,\n\tTeleport,\n\tuseTemplateRef,\n\twatch,\n\twatchEffect,\n} from \"vue\";\n\nconst lyricPlayerProps = {\n\t/**\n\t * 是否禁用歌词播放组件,默认为 `false`,歌词组件启用后将会开始逐帧更新歌词的动画效果,并对传入的其他参数变更做出反馈。\n\t *\n\t * 如果禁用了歌词组件动画,你也可以通过引用取得原始渲染组件实例,手动逐帧调用其 `update` 函数来更新动画效果。\n\t */\n\tdisabled: {\n\t\ttype: Boolean,\n\t\tdefault: false,\n\t},\n\t/**\n\t * 是否演出部分效果,目前会控制播放间奏点的动画的播放暂停与否,默认为 `true`\n\t */\n\tplaying: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * 设置歌词行的对齐方式,如果为 `undefined` 则默认为 `center`\n\t *\n\t * - 设置成 `top` 的话将会向目标歌词行的顶部对齐\n\t * - 设置成 `bottom` 的话将会向目标歌词行的底部对齐\n\t * - 设置成 `center` 的话将会向目标歌词行的垂直中心对齐\n\t */\n\talignAnchor: {\n\t\ttype: String as PropType<\"top\" | \"bottom\" | \"center\">,\n\t\tdefault: \"center\",\n\t},\n\t/**\n\t * 设置默认的歌词行对齐位置,相对于整个歌词播放组件的大小位置,如果为 `undefined`\n\t * 则默认为 `0.5`\n\t *\n\t * 可以设置一个 `[0.0-1.0]` 之间的任意数字,代表组件高度由上到下的比例位置\n\t */\n\talignPosition: {\n\t\ttype: Number,\n\t\tdefault: 0.5,\n\t},\n\t/**\n\t * 设置是否使用物理弹簧算法实现歌词动画效果,默认启用\n\t *\n\t * 如果启用,则会通过弹簧算法实时处理歌词位置,但是需要性能足够强劲的电脑方可流畅运行\n\t *\n\t * 如果不启用,则会回退到基于 `transition` 的过渡效果,对低性能的机器比较友好,但是效果会比较单一\n\t */\n\tenableSpring: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * 设置是否启用歌词行的模糊效果,默认为 `true`\n\t */\n\tenableBlur: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * 设置是否使用物理弹簧算法实现歌词动画效果,默认启用\n\t *\n\t * 如果启用,则会通过弹簧算法实时处理歌词位置,但是需要性能足够强劲的电脑方可流畅运行\n\t *\n\t * 如果不启用,则会回退到基于 `transition` 的过渡效果,对低性能的机器比较友好,但是效果会比较单一\n\t */\n\tenableScale: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * 设置是否隐藏已经播放过的歌词行,默认不隐藏\n\t */\n\thidePassedLines: {\n\t\ttype: Boolean,\n\t\tdefault: false,\n\t},\n\t/**\n\t * 设置歌词中不雅用语的掩码模式,默认为 `MaskObsceneWordsMode.Disabled`,即不掩码\n\t */\n\tmaskObsceneWordsMode: {\n\t\ttype: String as PropType<MaskObsceneWordsMode>,\n\t\tdefault: MaskObsceneWordsMode.Disabled,\n\t},\n\t/**\n\t * 设置歌词优化选项\n\t */\n\toptimizeOptions: {\n\t\ttype: Object as PropType<OptimizeLyricOptions>,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置当前播放歌词,要注意传入后这个数组内的信息不得修改,否则会发生错误\n\t */\n\tlyricLines: {\n\t\ttype: Object as PropType<LyricLine[]>,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置当前播放进度,单位为毫秒且**必须是整数**,此时将会更新内部的歌词进度信息\n\t * 内部会根据调用间隔和播放进度自动决定如何滚动和显示歌词,所以这个的调用频率越快越准确越好\n\t */\n\tcurrentTime: {\n\t\ttype: Number,\n\t\tdefault: 0,\n\t},\n\t/**\n\t * 设置文字动画的渐变宽度,单位以歌词行的主文字字体大小的倍数为单位,默认为 0.5,即一个全角字符的一半宽度\n\t *\n\t * 如果要模拟 Apple Music for Android 的效果,可以设置为 1\n\t *\n\t * 如果要模拟 Apple Music for iPad 的效果,可以设置为 0.5\n\t *\n\t * 如果想要近乎禁用渐变效果,可以设置成非常接近 0 的小数(例如 `0.0001` ),但是**不可以为 0**\n\t */\n\twordFadeWidth: {\n\t\ttype: Number,\n\t\tdefault: 0.5,\n\t},\n\t/**\n\t * 设置所有歌词行在横坐标上的弹簧属性,包括重量、弹力和阻力。\n\t *\n\t * @param params 需要设置的弹簧属性,提供的属性将会覆盖原来的属性,未提供的属性将会保持原样\n\t */\n\tlinePosXSpringParams: {\n\t\ttype: Object as PropType<Partial<spring.SpringParams>>,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置所有歌词行在纵坐标上的弹簧属性,包括重量、弹力和阻力。\n\t *\n\t * @param params 需要设置的弹簧属性,提供的属性将会覆盖原来的属性,未提供的属性将会保持原样\n\t */\n\tlinePosYSpringParams: {\n\t\ttype: Object as PropType<Partial<spring.SpringParams>>,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置所有歌词行在缩放大小上的弹簧属性,包括重量、弹力和阻力。\n\t *\n\t * @param params 需要设置的弹簧属性,提供的属性将会覆盖原来的属性,未提供的属性将会保持原样\n\t */\n\tlineScaleSpringParams: {\n\t\ttype: Object as PropType<Partial<spring.SpringParams>>,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置渲染器,如果为 `undefined` 则默认为 `MeshGradientRenderer`\n\t * 默认渲染器有可能会随着版本更新而更换\n\t */\n\tlyricPlayer: {\n\t\ttype: Object as PropType<{\n\t\t\tnew (...args: ConstructorParameters<typeof BaseRenderer>): BaseRenderer;\n\t\t}>,\n\t\trequired: false,\n\t},\n} as const;\n\n/**\n * 歌词播放组件的属性\n */\nexport type LyricPlayerProps = ExtractPublicPropTypes<typeof lyricPlayerProps>;\n\nconst lyricPlayerEmits = {\n\tlineClick: (_: LyricLineMouseEvent) => true,\n\tlineContextmenu: (_: LyricLineMouseEvent) => true,\n} as const;\n\n/**\n * 歌词播放组件的事件\n */\nexport type LyricPlayerEmits = typeof lyricPlayerEmits;\n\n/**\n * 歌词播放组件的引用\n */\nexport interface LyricPlayerRef {\n\t/**\n\t * 歌词播放实例\n\t */\n\tlyricPlayer: Ref<LyricPlayerBase | undefined>;\n\t/**\n\t * 将歌词播放实例的元素包裹起来的 DIV 元素实例\n\t */\n\twrapperEl: Readonly<ShallowRef<HTMLDivElement | null>>;\n}\n\nexport const LyricPlayer = defineComponent({\n\tname: \"LyricPlayer\",\n\tprops: lyricPlayerProps,\n\temits: lyricPlayerEmits,\n\tslots: Object as SlotsType<{\n\t\t\"bottom-line\": () => void;\n\t}>,\n\tsetup(props, { expose, emit, attrs, slots }) {\n\t\tconst wrapperRef = useTemplateRef<HTMLDivElement>(\"wrapper-ref\");\n\t\tconst playerRef = ref<CoreLyricPlayer>();\n\n\t\tconst lineClickHandler = (e: Event) =>\n\t\t\temit(\"lineClick\", e as LyricLineMouseEvent);\n\t\tconst lineContextMenuHandler = (e: Event) =>\n\t\t\temit(\"lineContextmenu\", e as LyricLineMouseEvent);\n\n\t\tonMounted(() => {\n\t\t\tconst wrapper = wrapperRef.value;\n\t\t\tif (wrapper) {\n\t\t\t\tplayerRef.value = new CoreLyricPlayer();\n\t\t\t\twrapper.appendChild(playerRef.value.getElement());\n\t\t\t\tplayerRef.value.addEventListener(\"line-click\", lineClickHandler);\n\t\t\t\tplayerRef.value.addEventListener(\n\t\t\t\t\t\"line-contextmenu\",\n\t\t\t\t\tlineContextMenuHandler,\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\n\t\tonUnmounted(() => {\n\t\t\tif (playerRef.value) {\n\t\t\t\tplayerRef.value.removeEventListener(\"line-click\", lineClickHandler);\n\t\t\t\tplayerRef.value.removeEventListener(\n\t\t\t\t\t\"line-contextmenu\",\n\t\t\t\t\tlineContextMenuHandler,\n\t\t\t\t);\n\t\t\t\tplayerRef.value.dispose();\n\t\t\t}\n\t\t});\n\n\t\twatchEffect((onCleanup) => {\n\t\t\tif (!props.disabled) {\n\t\t\t\tlet canceled = false;\n\t\t\t\tlet lastTime = -1;\n\t\t\t\tconst onFrame = (time: number) => {\n\t\t\t\t\tif (canceled) return;\n\t\t\t\t\tif (lastTime === -1) {\n\t\t\t\t\t\tlastTime = time;\n\t\t\t\t\t}\n\t\t\t\t\tplayerRef.value?.update(time - lastTime);\n\t\t\t\t\tlastTime = time;\n\t\t\t\t\trequestAnimationFrame(onFrame);\n\t\t\t\t};\n\t\t\t\trequestAnimationFrame(onFrame);\n\t\t\t\tonCleanup(() => {\n\t\t\t\t\tcanceled = true;\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.playing !== undefined) {\n\t\t\t\tif (props.playing) {\n\t\t\t\t\tplayerRef.value?.resume();\n\t\t\t\t} else {\n\t\t\t\t\tplayerRef.value?.pause();\n\t\t\t\t}\n\t\t\t} else playerRef.value?.resume();\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.alignAnchor !== undefined)\n\t\t\t\tplayerRef.value?.setAlignAnchor(props.alignAnchor);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.hidePassedLines !== undefined)\n\t\t\t\tplayerRef.value?.setHidePassedLines(props.hidePassedLines);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.maskObsceneWordsMode !== undefined)\n\t\t\t\tplayerRef.value?.setMaskObsceneWords(props.maskObsceneWordsMode);\n\t\t\telse playerRef.value?.setMaskObsceneWords(MaskObsceneWordsMode.Disabled);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.alignPosition !== undefined)\n\t\t\t\tplayerRef.value?.setAlignPosition(props.alignPosition);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.enableSpring !== undefined)\n\t\t\t\tplayerRef.value?.setEnableSpring(props.enableSpring);\n\t\t\telse playerRef.value?.setEnableSpring(true);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.enableBlur !== undefined)\n\t\t\t\tplayerRef.value?.setEnableBlur(props.enableBlur);\n\t\t\telse playerRef.value?.setEnableBlur(true);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.enableScale !== undefined)\n\t\t\t\tplayerRef.value?.setEnableScale(props.enableScale);\n\t\t\telse playerRef.value?.setEnableScale(true);\n\t\t});\n\n\t\twatch(\n\t\t\t[playerRef, () => props.lyricLines, () => props.optimizeOptions],\n\t\t\t([player, lyricLines, optimizeOptions]) => {\n\t\t\t\tif (!player) return;\n\n\t\t\t\tif (optimizeOptions !== undefined) {\n\t\t\t\t\tplayer.setOptimizeOptions(optimizeOptions);\n\t\t\t\t}\n\n\t\t\t\tif (lyricLines !== undefined) {\n\t\t\t\t\tplayer.setLyricLines(lyricLines);\n\t\t\t\t} else {\n\t\t\t\t\tplayer.setLyricLines([]);\n\t\t\t\t}\n\n\t\t\t\tif (props.currentTime !== undefined) {\n\t\t\t\t\tplayer.setCurrentTime(props.currentTime, true);\n\t\t\t\t}\n\t\t\t},\n\t\t\t{ immediate: true },\n\t\t);\n\n\t\twatchEffect(() => {\n\t\t\tif (props.currentTime !== undefined)\n\t\t\t\tplayerRef.value?.setCurrentTime(props.currentTime);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.wordFadeWidth !== undefined)\n\t\t\t\tplayerRef.value?.setWordFadeWidth(props.wordFadeWidth);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.linePosXSpringParams !== undefined)\n\t\t\t\tplayerRef.value?.setLinePosXSpringParams(props.linePosXSpringParams);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.linePosYSpringParams !== undefined)\n\t\t\t\tplayerRef.value?.setLinePosYSpringParams(props.linePosYSpringParams);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.lineScaleSpringParams !== undefined)\n\t\t\t\tplayerRef.value?.setLineScaleSpringParams(props.lineScaleSpringParams);\n\t\t});\n\n\t\tconst bottomLineEl = computed(() =>\n\t\t\tplayerRef.value?.getBottomLineElement(),\n\t\t);\n\n\t\texpose<LyricPlayerRef>({\n\t\t\tlyricPlayer: playerRef,\n\t\t\twrapperEl: wrapperRef,\n\t\t});\n\n\t\treturn () => (\n\t\t\t<div ref=\"wrapper-ref\" {...attrs}>\n\t\t\t\t{bottomLineEl.value && (\n\t\t\t\t\t<Teleport to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AAO0B,eAAexC,MAAMtB,YAAY;IAClD;EAEFrB,CAAAA,GAAAA,IAAAA,mBAAkB;GACjB,IAAI2C,MAAMrB,kBAAkBgD,KAAAA,GAC3BnB,UAAUM,OAAO4B,iBAAiB1C,MAAMrB,cAAc;IACtD;EAEFtB,CAAAA,GAAAA,IAAAA,mBAAkB;GACjB,IAAI2C,MAAMpB,yBAAyB+C,KAAAA,GAClCnB,UAAUM,OAAO6B,wBAAwB3C,MAAMpB,qBAAqB;IACpE;EAEFvB,CAAAA,GAAAA,IAAAA,mBAAkB;GACjB,IAAI2C,MAAMjB,yBAAyB4C,KAAAA,GAClCnB,UAAUM,OAAO8B,wBAAwB5C,MAAMjB,qBAAqB;IACpE;EAEF1B,CAAAA,GAAAA,IAAAA,mBAAkB;GACjB,IAAI2C,MAAMhB,0BAA0B2C,KAAAA,GACnCnB,UAAUM,OAAO+B,yBAAyB7C,MAAMhB,sBAAsB;IACtE;EAEF,MAAM8D,gBAAAA,GAAAA,IAAAA,gBACLtC,UAAUM,OAAOiC,sBAClB,CAAC;EAED3C,OAAuB;GACtBnB,aAAauB;GACbZ,WAAWW;GACX,CAAC;EAEF,cAAA,GAAA,IAAA,aAAO,QAAA,GAAA,IAAA,YAAA,EAAA,OAAA,eAAA,EACqBD,MAAK,EAAA,CAC9BwC,aAAahC,UAAAA,GAAAA,IAAAA,aAAK5D,IAAAA,UAAA,EAAA,MACJ4F,aAAahC,OAAK,EAAA,EAAApD,eAAA,CAC9BwC,MAAM,kBAAkB,CAAA,EAAA,CAE1B,CAAA,CAEF;;CAEF,CAAC"}
|
|
1
|
+
{"version":3,"file":"amll-vue.cjs","names":[],"sources":["../src/BackgroundRender.tsx","../src/LyricPlayer.tsx"],"sourcesContent":["import {\n\ttype AbstractBaseRenderer,\n\ttype BaseRenderer,\n\tBackgroundRender as CoreBackgroundRender,\n\tMeshGradientRenderer,\n} from \"@applemusic-like-lyrics/core\";\nimport {\n\tdefineComponent,\n\ttype ExtractPublicPropTypes,\n\tonMounted,\n\tonUnmounted,\n\ttype PropType,\n\ttype Ref,\n\tref,\n\ttype ShallowRef,\n\tuseTemplateRef,\n\twatchEffect,\n} from \"vue\";\n\n/**\n * 背景渲染组件的引用\n */\nexport interface BackgroundRenderRef {\n\t/**\n\t * 背景渲染实例引用\n\t */\n\tbgRender?: Ref<AbstractBaseRenderer | undefined>;\n\t/**\n\t * 将背景渲染实例的元素包裹起来的 DIV 元素实例\n\t */\n\twrapperEl: Readonly<ShallowRef<HTMLDivElement | null>>;\n}\n\nconst backgroundRenderProps = {\n\t/**\n\t * 设置背景专辑资源\n\t */\n\talbum: {\n\t\ttype: [String, Object] as PropType<\n\t\t\tstring | HTMLImageElement | HTMLVideoElement\n\t\t>,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置专辑资源是否为视频\n\t */\n\talbumIsVideo: {\n\t\ttype: Boolean,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置当前背景动画帧率,如果为 `undefined` 则默认为 `30`\n\t */\n\tfps: {\n\t\ttype: Number,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置当前播放状态,如果为 `undefined` 则默认为 `true`\n\t */\n\tplaying: {\n\t\ttype: Boolean,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置当前动画流动速度,如果为 `undefined` 则默认为 `2`\n\t */\n\tflowSpeed: {\n\t\ttype: Number,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置背景是否根据“是否有歌词”这个特征调整自身效果,例如有歌词时会变得更加活跃\n\t *\n\t * 部分渲染器会根据这个特征调整自身效果\n\t *\n\t * 如果不确定是否需要赋值或无法知晓是否包含歌词,请传入 true 或不做任何处理(默认值为 true)\n\t */\n\thasLyric: {\n\t\ttype: Boolean,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置低频的音量大小,范围在 80hz-120hz 之间为宜,取值范围在 [0.0-1.0] 之间\n\t *\n\t * 部分渲染器会根据音量大小调整背景效果(例如根据鼓点跳动)\n\t *\n\t * 如果无法获取到类似的数据,请传入 undefined 或 1.0 作为默认值,或不做任何处理(默认值即 1.0)\n\t */\n\tlowFreqVolume: {\n\t\ttype: Number,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置当前渲染缩放比例,如果为 `undefined` 则默认为 `0.5`\n\t */\n\trenderScale: {\n\t\ttype: Number,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置渲染器,如果为 `undefined` 则默认为 `MeshGradientRenderer`\n\t * 默认渲染器有可能会随着版本更新而更换\n\t */\n\trenderer: {\n\t\ttype: Object as PropType<{\n\t\t\tnew (...args: ConstructorParameters<typeof BaseRenderer>): BaseRenderer;\n\t\t}>,\n\t\trequired: false,\n\t},\n} as const;\n\nexport type BackgroundRenderProps = ExtractPublicPropTypes<\n\ttypeof backgroundRenderProps\n>;\n\nexport const BackgroundRender = defineComponent({\n\tname: \"BackgroundRender\",\n\tprops: backgroundRenderProps,\n\tsetup(props, { expose }) {\n\t\tconst wrapperRef = useTemplateRef<HTMLDivElement>(\"wrapper-ref\");\n\t\tconst bgRenderRef = ref<AbstractBaseRenderer>();\n\n\t\tonMounted(() => {\n\t\t\tif (wrapperRef.value) {\n\t\t\t\tbgRenderRef.value = CoreBackgroundRender.new(\n\t\t\t\t\tprops.renderer ?? MeshGradientRenderer,\n\t\t\t\t);\n\t\t\t\tconst el = bgRenderRef.value.getElement();\n\t\t\t\tel.style.width = \"100%\";\n\t\t\t\tel.style.height = \"100%\";\n\t\t\t\twrapperRef.value.appendChild(el);\n\t\t\t}\n\t\t});\n\n\t\tonUnmounted(() => {\n\t\t\tif (bgRenderRef.value) {\n\t\t\t\tbgRenderRef.value.dispose();\n\t\t\t}\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.album)\n\t\t\t\tbgRenderRef.value?.setAlbum(props.album, props.albumIsVideo);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.fps) bgRenderRef.value?.setFPS(props.fps);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.playing) bgRenderRef.value?.pause();\n\t\t\telse bgRenderRef.value?.resume();\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.flowSpeed) bgRenderRef.value?.setFlowSpeed(props.flowSpeed);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.renderScale)\n\t\t\t\tbgRenderRef.value?.setRenderScale(props.renderScale);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.lowFreqVolume)\n\t\t\t\tbgRenderRef.value?.setLowFreqVolume(props.lowFreqVolume);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.hasLyric !== undefined)\n\t\t\t\tbgRenderRef.value?.setHasLyric(props.hasLyric ?? true);\n\t\t});\n\n\t\texpose<BackgroundRenderRef>({\n\t\t\tbgRender: bgRenderRef,\n\t\t\twrapperEl: wrapperRef,\n\t\t});\n\n\t\treturn () => <div style=\"display: contents;\" ref=\"wrapper-ref\" />;\n\t},\n});\n","import {\n\ttype BaseRenderer,\n\tLyricPlayer as CoreLyricPlayer,\n\ttype LyricLine,\n\ttype LyricLineMouseEvent,\n\ttype LyricPlayerBase,\n\tMaskObsceneWordsMode,\n\ttype OptimizeLyricOptions,\n\ttype spring,\n} from \"@applemusic-like-lyrics/core\";\nimport {\n\tcomputed,\n\tdefineComponent,\n\ttype ExtractPublicPropTypes,\n\tonMounted,\n\tonUnmounted,\n\ttype PropType,\n\ttype Ref,\n\tref,\n\ttype ShallowRef,\n\ttype SlotsType,\n\tTeleport,\n\tuseTemplateRef,\n\twatch,\n\twatchEffect,\n} from \"vue\";\n\nconst lyricPlayerProps = {\n\t/**\n\t * 是否禁用歌词播放组件,默认为 `false`,歌词组件启用后将会开始逐帧更新歌词的动画效果,并对传入的其他参数变更做出反馈。\n\t *\n\t * 如果禁用了歌词组件动画,你也可以通过引用取得原始渲染组件实例,手动逐帧调用其 `update` 函数来更新动画效果。\n\t */\n\tdisabled: {\n\t\ttype: Boolean,\n\t\tdefault: false,\n\t},\n\t/**\n\t * 是否演出部分效果,目前会控制播放间奏点的动画的播放暂停与否,默认为 `true`\n\t */\n\tplaying: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * 设置歌词行的对齐方式,如果为 `undefined` 则默认为 `center`\n\t *\n\t * - 设置成 `top` 的话将会向目标歌词行的顶部对齐\n\t * - 设置成 `bottom` 的话将会向目标歌词行的底部对齐\n\t * - 设置成 `center` 的话将会向目标歌词行的垂直中心对齐\n\t */\n\talignAnchor: {\n\t\ttype: String as PropType<\"top\" | \"bottom\" | \"center\">,\n\t\tdefault: \"center\",\n\t},\n\t/**\n\t * 设置默认的歌词行对齐位置,相对于整个歌词播放组件的大小位置,如果为 `undefined`\n\t * 则默认为 `0.5`\n\t *\n\t * 可以设置一个 `[0.0-1.0]` 之间的任意数字,代表组件高度由上到下的比例位置\n\t */\n\talignPosition: {\n\t\ttype: Number,\n\t\tdefault: 0.5,\n\t},\n\t/**\n\t * 设置是否使用物理弹簧算法实现歌词动画效果,默认启用\n\t *\n\t * 如果启用,则会通过弹簧算法实时处理歌词位置,但是需要性能足够强劲的电脑方可流畅运行\n\t *\n\t * 如果不启用,则会回退到基于 `transition` 的过渡效果,对低性能的机器比较友好,但是效果会比较单一\n\t */\n\tenableSpring: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * 设置是否启用歌词行的模糊效果,默认为 `true`\n\t */\n\tenableBlur: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * 设置是否使用物理弹簧算法实现歌词动画效果,默认启用\n\t *\n\t * 如果启用,则会通过弹簧算法实时处理歌词位置,但是需要性能足够强劲的电脑方可流畅运行\n\t *\n\t * 如果不启用,则会回退到基于 `transition` 的过渡效果,对低性能的机器比较友好,但是效果会比较单一\n\t */\n\tenableScale: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * 设置是否隐藏已经播放过的歌词行,默认不隐藏\n\t */\n\thidePassedLines: {\n\t\ttype: Boolean,\n\t\tdefault: false,\n\t},\n\t/**\n\t * 设置歌词中不雅用语的掩码模式,默认为 `MaskObsceneWordsMode.Disabled`,即不掩码\n\t */\n\tmaskObsceneWordsMode: {\n\t\ttype: String as PropType<MaskObsceneWordsMode>,\n\t\tdefault: MaskObsceneWordsMode.Disabled,\n\t},\n\t/**\n\t * 设置不雅用语掩码使用的字符,默认为 `*`\n\t */\n\tmaskObsceneWordChar: {\n\t\ttype: String,\n\t\tdefault: \"*\",\n\t},\n\t/**\n\t * 设置歌词优化选项\n\t */\n\toptimizeOptions: {\n\t\ttype: Object as PropType<OptimizeLyricOptions>,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置当前播放歌词,要注意传入后这个数组内的信息不得修改,否则会发生错误\n\t */\n\tlyricLines: {\n\t\ttype: Object as PropType<LyricLine[]>,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置当前播放进度,单位为毫秒且**必须是整数**,此时将会更新内部的歌词进度信息\n\t * 内部会根据调用间隔和播放进度自动决定如何滚动和显示歌词,所以这个的调用频率越快越准确越好\n\t */\n\tcurrentTime: {\n\t\ttype: Number,\n\t\tdefault: 0,\n\t},\n\t/**\n\t * 设置文字动画的渐变宽度,单位以歌词行的主文字字体大小的倍数为单位,默认为 0.5,即一个全角字符的一半宽度\n\t *\n\t * 如果要模拟 Apple Music for Android 的效果,可以设置为 1\n\t *\n\t * 如果要模拟 Apple Music for iPad 的效果,可以设置为 0.5\n\t *\n\t * 如果想要近乎禁用渐变效果,可以设置成非常接近 0 的小数(例如 `0.0001` ),但是**不可以为 0**\n\t */\n\twordFadeWidth: {\n\t\ttype: Number,\n\t\tdefault: 0.5,\n\t},\n\t/**\n\t * 设置所有歌词行在横坐标上的弹簧属性,包括重量、弹力和阻力。\n\t *\n\t * @param params 需要设置的弹簧属性,提供的属性将会覆盖原来的属性,未提供的属性将会保持原样\n\t */\n\tlinePosXSpringParams: {\n\t\ttype: Object as PropType<Partial<spring.SpringParams>>,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置所有歌词行在纵坐标上的弹簧属性,包括重量、弹力和阻力。\n\t *\n\t * @param params 需要设置的弹簧属性,提供的属性将会覆盖原来的属性,未提供的属性将会保持原样\n\t */\n\tlinePosYSpringParams: {\n\t\ttype: Object as PropType<Partial<spring.SpringParams>>,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置所有歌词行在缩放大小上的弹簧属性,包括重量、弹力和阻力。\n\t *\n\t * @param params 需要设置的弹簧属性,提供的属性将会覆盖原来的属性,未提供的属性将会保持原样\n\t */\n\tlineScaleSpringParams: {\n\t\ttype: Object as PropType<Partial<spring.SpringParams>>,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置渲染器,如果为 `undefined` 则默认为 `MeshGradientRenderer`\n\t * 默认渲染器有可能会随着版本更新而更换\n\t */\n\tlyricPlayer: {\n\t\ttype: Object as PropType<{\n\t\t\tnew (...args: ConstructorParameters<typeof BaseRenderer>): BaseRenderer;\n\t\t}>,\n\t\trequired: false,\n\t},\n} as const;\n\n/**\n * 歌词播放组件的属性\n */\nexport type LyricPlayerProps = ExtractPublicPropTypes<typeof lyricPlayerProps>;\n\nconst lyricPlayerEmits = {\n\tlineClick: (_: LyricLineMouseEvent) => true,\n\tlineContextmenu: (_: LyricLineMouseEvent) => true,\n} as const;\n\n/**\n * 歌词播放组件的事件\n */\nexport type LyricPlayerEmits = typeof lyricPlayerEmits;\n\n/**\n * 歌词播放组件的引用\n */\nexport interface LyricPlayerRef {\n\t/**\n\t * 歌词播放实例\n\t */\n\tlyricPlayer: Ref<LyricPlayerBase | undefined>;\n\t/**\n\t * 将歌词播放实例的元素包裹起来的 DIV 元素实例\n\t */\n\twrapperEl: Readonly<ShallowRef<HTMLDivElement | null>>;\n}\n\nexport const LyricPlayer = defineComponent({\n\tname: \"LyricPlayer\",\n\tprops: lyricPlayerProps,\n\temits: lyricPlayerEmits,\n\tslots: Object as SlotsType<{\n\t\t\"bottom-line\": () => void;\n\t}>,\n\tsetup(props, { expose, emit, attrs, slots }) {\n\t\tconst wrapperRef = useTemplateRef<HTMLDivElement>(\"wrapper-ref\");\n\t\tconst playerRef = ref<CoreLyricPlayer>();\n\t\tlet prevLyricLines: LyricLine[] | undefined;\n\n\t\tconst lineClickHandler = (e: Event) =>\n\t\t\temit(\"lineClick\", e as LyricLineMouseEvent);\n\t\tconst lineContextMenuHandler = (e: Event) =>\n\t\t\temit(\"lineContextmenu\", e as LyricLineMouseEvent);\n\n\t\tonMounted(() => {\n\t\t\tconst wrapper = wrapperRef.value;\n\t\t\tif (wrapper) {\n\t\t\t\tplayerRef.value = new CoreLyricPlayer();\n\t\t\t\twrapper.appendChild(playerRef.value.getElement());\n\t\t\t\tplayerRef.value.addEventListener(\"line-click\", lineClickHandler);\n\t\t\t\tplayerRef.value.addEventListener(\n\t\t\t\t\t\"line-contextmenu\",\n\t\t\t\t\tlineContextMenuHandler,\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\n\t\tonUnmounted(() => {\n\t\t\tif (playerRef.value) {\n\t\t\t\tplayerRef.value.removeEventListener(\"line-click\", lineClickHandler);\n\t\t\t\tplayerRef.value.removeEventListener(\n\t\t\t\t\t\"line-contextmenu\",\n\t\t\t\t\tlineContextMenuHandler,\n\t\t\t\t);\n\t\t\t\tplayerRef.value.dispose();\n\t\t\t}\n\t\t});\n\n\t\twatchEffect((onCleanup) => {\n\t\t\tif (!props.disabled) {\n\t\t\t\tlet canceled = false;\n\t\t\t\tlet lastTime = -1;\n\t\t\t\tconst onFrame = (time: number) => {\n\t\t\t\t\tif (canceled) return;\n\t\t\t\t\tif (lastTime === -1) {\n\t\t\t\t\t\tlastTime = time;\n\t\t\t\t\t}\n\t\t\t\t\tplayerRef.value?.update(time - lastTime);\n\t\t\t\t\tlastTime = time;\n\t\t\t\t\trequestAnimationFrame(onFrame);\n\t\t\t\t};\n\t\t\t\trequestAnimationFrame(onFrame);\n\t\t\t\tonCleanup(() => {\n\t\t\t\t\tcanceled = true;\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\twatch(\n\t\t\t[\n\t\t\t\tplayerRef,\n\t\t\t\t() => props.lyricLines,\n\t\t\t\t() => props.optimizeOptions,\n\t\t\t\t() => props.maskObsceneWordsMode,\n\t\t\t\t() => props.maskObsceneWordChar,\n\t\t\t],\n\t\t\t([player, lyricLines]) => {\n\t\t\t\tif (!player) return;\n\n\t\t\t\tconst isLyricLinesChanged = lyricLines !== prevLyricLines;\n\t\t\t\tprevLyricLines = lyricLines;\n\n\t\t\t\tif (isLyricLinesChanged) {\n\t\t\t\t\tplayer.setLyricProcessConfig({\n\t\t\t\t\t\toptimizeOptions: props.optimizeOptions,\n\t\t\t\t\t\tmaskMode: props.maskObsceneWordsMode,\n\t\t\t\t\t\tmaskChar: props.maskObsceneWordChar,\n\t\t\t\t\t});\n\t\t\t\t\tplayer.setLyricLines(lyricLines ?? []);\n\n\t\t\t\t\tif (props.currentTime !== undefined) {\n\t\t\t\t\t\tplayer.setCurrentTime(props.currentTime, true);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tplayer.updateLyricProcessConfig({\n\t\t\t\t\t\toptimizeOptions: props.optimizeOptions,\n\t\t\t\t\t\tmaskMode: props.maskObsceneWordsMode,\n\t\t\t\t\t\tmaskChar: props.maskObsceneWordChar,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t\t{ immediate: true },\n\t\t);\n\n\t\twatchEffect(() => {\n\t\t\tif (props.playing !== undefined) {\n\t\t\t\tif (props.playing) {\n\t\t\t\t\tplayerRef.value?.resume();\n\t\t\t\t} else {\n\t\t\t\t\tplayerRef.value?.pause();\n\t\t\t\t}\n\t\t\t} else playerRef.value?.resume();\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.alignAnchor !== undefined)\n\t\t\t\tplayerRef.value?.setAlignAnchor(props.alignAnchor);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.hidePassedLines !== undefined)\n\t\t\t\tplayerRef.value?.setHidePassedLines(props.hidePassedLines);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.alignPosition !== undefined)\n\t\t\t\tplayerRef.value?.setAlignPosition(props.alignPosition);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.enableSpring !== undefined)\n\t\t\t\tplayerRef.value?.setEnableSpring(props.enableSpring);\n\t\t\telse playerRef.value?.setEnableSpring(true);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.enableBlur !== undefined)\n\t\t\t\tplayerRef.value?.setEnableBlur(props.enableBlur);\n\t\t\telse playerRef.value?.setEnableBlur(true);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.enableScale !== undefined)\n\t\t\t\tplayerRef.value?.setEnableScale(props.enableScale);\n\t\t\telse playerRef.value?.setEnableScale(true);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.currentTime !== undefined)\n\t\t\t\tplayerRef.value?.setCurrentTime(props.currentTime);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.wordFadeWidth !== undefined)\n\t\t\t\tplayerRef.value?.setWordFadeWidth(props.wordFadeWidth);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.linePosXSpringParams !== undefined)\n\t\t\t\tplayerRef.value?.setLinePosXSpringParams(props.linePosXSpringParams);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.linePosYSpringParams !== undefined)\n\t\t\t\tplayerRef.value?.setLinePosYSpringParams(props.linePosYSpringParams);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.lineScaleSpringParams !== undefined)\n\t\t\t\tplayerRef.value?.setLineScaleSpringParams(props.lineScaleSpringParams);\n\t\t});\n\n\t\tconst bottomLineEl = computed(() =>\n\t\t\tplayerRef.value?.getBottomLineElement(),\n\t\t);\n\n\t\texpose<LyricPlayerRef>({\n\t\t\tlyricPlayer: playerRef,\n\t\t\twrapperEl: wrapperRef,\n\t\t});\n\n\t\treturn () => (\n\t\t\t<div ref=\"wrapper-ref\" {...attrs}>\n\t\t\t\t{bottomLineEl.value && (\n\t\t\t\t\t<Teleport to={bottomLineEl.value}>\n\t\t\t\t\t\t{slots[\"bottom-line\"]?.()}\n\t\t\t\t\t</Teleport>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t);\n\t},\n});\n"],"mappings":";;;;AAiCA,MAAM,wBAAwB;;;;CAI7B,OAAO;EACN,MAAM,CAAC,QAAQ,MAAM;EAGrB,UAAU;CACX;;;;CAIA,cAAc;EACb,MAAM;EACN,UAAU;CACX;;;;CAIA,KAAK;EACJ,MAAM;EACN,UAAU;CACX;;;;CAIA,SAAS;EACR,MAAM;EACN,UAAU;CACX;;;;CAIA,WAAW;EACV,MAAM;EACN,UAAU;CACX;;;;;;;;CAQA,UAAU;EACT,MAAM;EACN,UAAU;CACX;;;;;;;;CAQA,eAAe;EACd,MAAM;EACN,UAAU;CACX;;;;CAIA,aAAa;EACZ,MAAM;EACN,UAAU;CACX;;;;;CAKA,UAAU;EACT,MAAM;EAGN,UAAU;CACX;AACD;AAMA,MAAa,oBAAA,GAAmB,IAAA,gBAAA,CAAgB;CAC/C,MAAM;CACN,OAAO;CACP,MAAM,OAAO,EAAE,UAAU;EACxB,MAAM,cAAA,GAAa,IAAA,eAAA,CAA+B,aAAa;EAC/D,MAAM,eAAA,GAAc,IAAA,IAAA,CAA0B;EAE9C,CAAA,GAAA,IAAA,UAAA,OAAgB;GACf,IAAI,WAAW,OAAO;IACrB,YAAY,QAAQ,6BAAA,iBAAqB,IACxC,MAAM,YAAY,6BAAA,oBACnB;IACA,MAAM,KAAK,YAAY,MAAM,WAAW;IACxC,GAAG,MAAM,QAAQ;IACjB,GAAG,MAAM,SAAS;IAClB,WAAW,MAAM,YAAY,EAAE;GAChC;EACD,CAAC;EAED,CAAA,GAAA,IAAA,YAAA,OAAkB;GACjB,IAAI,YAAY,OACf,YAAY,MAAM,QAAQ;EAE5B,CAAC;E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EACrE,CAAC;EAED,CAAA,GAAA,IAAA,YAAA,OAAkB;GACjB,IAAI,MAAM,0BAA0B,KAAA,GACnC,UAAU,OAAO,yBAAyB,MAAM,qBAAqB;EACvE,CAAC;EAED,MAAM,gBAAA,GAAe,IAAA,SAAA,OACpB,UAAU,OAAO,qBAAqB,CACvC;EAEA,OAAuB;GACtB,aAAa;GACb,WAAW;EACZ,CAAC;EAED,cAAA,GAAO,IAAA,YAAA,CAAA,QAAA,GAAA,IAAA,WAAA,CAAA,EAAA,OAAA,cAAA,GACqB,KAAK,GAAA,CAC9B,aAAa,UAAA,GAAK,IAAA,YAAA,CAAA,IAAA,UAAA,EAAA,MACJ,aAAa,MAAK,GAAA,EAAA,eAAA,CAC9B,MAAM,cAAc,GAAG,CAAC,EAAA,CAAA,CAE1B,CAAA;CAGJ;AACD,CAAC"}
|
package/dist/amll-vue.d.cts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import * as _$vue from "vue";
|
|
2
|
-
import { ExtractPublicPropTypes, PropType, Ref, ShallowRef, SlotsType } from "vue";
|
|
3
|
-
import * as _$vue_jsx_runtime0 from "vue/jsx-runtime";
|
|
4
1
|
import { AbstractBaseRenderer, BaseRenderer, LyricLine, LyricLineMouseEvent, LyricPlayerBase, MaskObsceneWordsMode, OptimizeLyricOptions, spring } from "@applemusic-like-lyrics/core";
|
|
5
|
-
|
|
2
|
+
import { ExtractPublicPropTypes, PropType, Ref, ShallowRef, SlotsType } from "vue";
|
|
6
3
|
//#region src/BackgroundRender.d.ts
|
|
7
4
|
/**
|
|
8
5
|
* 背景渲染组件的引用
|
|
@@ -94,7 +91,7 @@ declare const backgroundRenderProps: {
|
|
|
94
91
|
};
|
|
95
92
|
};
|
|
96
93
|
type BackgroundRenderProps = ExtractPublicPropTypes<typeof backgroundRenderProps>;
|
|
97
|
-
declare const BackgroundRender:
|
|
94
|
+
declare const BackgroundRender: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
98
95
|
/**
|
|
99
96
|
* 设置背景专辑资源
|
|
100
97
|
*/
|
|
@@ -169,7 +166,7 @@ declare const BackgroundRender: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
169
166
|
}>;
|
|
170
167
|
readonly required: false;
|
|
171
168
|
};
|
|
172
|
-
}>, () =>
|
|
169
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
173
170
|
/**
|
|
174
171
|
* 设置背景专辑资源
|
|
175
172
|
*/
|
|
@@ -248,7 +245,7 @@ declare const BackgroundRender: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
248
245
|
readonly albumIsVideo: boolean;
|
|
249
246
|
readonly playing: boolean;
|
|
250
247
|
readonly hasLyric: boolean;
|
|
251
|
-
}, {}, {}, {}, string,
|
|
248
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
252
249
|
//#endregion
|
|
253
250
|
//#region src/LyricPlayer.d.ts
|
|
254
251
|
declare const lyricPlayerProps: {
|
|
@@ -332,6 +329,13 @@ declare const lyricPlayerProps: {
|
|
|
332
329
|
readonly type: PropType<MaskObsceneWordsMode>;
|
|
333
330
|
readonly default: "";
|
|
334
331
|
};
|
|
332
|
+
/**
|
|
333
|
+
* 设置不雅用语掩码使用的字符,默认为 `*`
|
|
334
|
+
*/
|
|
335
|
+
readonly maskObsceneWordChar: {
|
|
336
|
+
readonly type: StringConstructor;
|
|
337
|
+
readonly default: "*";
|
|
338
|
+
};
|
|
335
339
|
/**
|
|
336
340
|
* 设置歌词优化选项
|
|
337
341
|
*/
|
|
@@ -430,7 +434,7 @@ interface LyricPlayerRef {
|
|
|
430
434
|
*/
|
|
431
435
|
wrapperEl: Readonly<ShallowRef<HTMLDivElement | null>>;
|
|
432
436
|
}
|
|
433
|
-
declare const LyricPlayer:
|
|
437
|
+
declare const LyricPlayer: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
434
438
|
/**
|
|
435
439
|
* 是否禁用歌词播放组件,默认为 `false`,歌词组件启用后将会开始逐帧更新歌词的动画效果,并对传入的其他参数变更做出反馈。
|
|
436
440
|
*
|
|
@@ -511,6 +515,13 @@ declare const LyricPlayer: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
511
515
|
readonly type: PropType<MaskObsceneWordsMode>;
|
|
512
516
|
readonly default: "";
|
|
513
517
|
};
|
|
518
|
+
/**
|
|
519
|
+
* 设置不雅用语掩码使用的字符,默认为 `*`
|
|
520
|
+
*/
|
|
521
|
+
readonly maskObsceneWordChar: {
|
|
522
|
+
readonly type: StringConstructor;
|
|
523
|
+
readonly default: "*";
|
|
524
|
+
};
|
|
514
525
|
/**
|
|
515
526
|
* 设置歌词优化选项
|
|
516
527
|
*/
|
|
@@ -583,10 +594,10 @@ declare const LyricPlayer: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
583
594
|
}>;
|
|
584
595
|
readonly required: false;
|
|
585
596
|
};
|
|
586
|
-
}>, () =>
|
|
597
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
587
598
|
readonly lineClick: (_: LyricLineMouseEvent) => boolean;
|
|
588
599
|
readonly lineContextmenu: (_: LyricLineMouseEvent) => boolean;
|
|
589
|
-
}, string,
|
|
600
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
590
601
|
/**
|
|
591
602
|
* 是否禁用歌词播放组件,默认为 `false`,歌词组件启用后将会开始逐帧更新歌词的动画效果,并对传入的其他参数变更做出反馈。
|
|
592
603
|
*
|
|
@@ -667,6 +678,13 @@ declare const LyricPlayer: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
667
678
|
readonly type: PropType<MaskObsceneWordsMode>;
|
|
668
679
|
readonly default: "";
|
|
669
680
|
};
|
|
681
|
+
/**
|
|
682
|
+
* 设置不雅用语掩码使用的字符,默认为 `*`
|
|
683
|
+
*/
|
|
684
|
+
readonly maskObsceneWordChar: {
|
|
685
|
+
readonly type: StringConstructor;
|
|
686
|
+
readonly default: "*";
|
|
687
|
+
};
|
|
670
688
|
/**
|
|
671
689
|
* 设置歌词优化选项
|
|
672
690
|
*/
|
|
@@ -752,11 +770,12 @@ declare const LyricPlayer: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
752
770
|
readonly enableScale: boolean;
|
|
753
771
|
readonly hidePassedLines: boolean;
|
|
754
772
|
readonly maskObsceneWordsMode: MaskObsceneWordsMode;
|
|
773
|
+
readonly maskObsceneWordChar: string;
|
|
755
774
|
readonly currentTime: number;
|
|
756
775
|
readonly wordFadeWidth: number;
|
|
757
776
|
}, SlotsType<{
|
|
758
777
|
"bottom-line": () => void;
|
|
759
|
-
}>, {}, {}, string,
|
|
778
|
+
}>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
760
779
|
//#endregion
|
|
761
780
|
export { BackgroundRender, BackgroundRenderProps, BackgroundRenderRef, LyricPlayer, LyricPlayerEmits, LyricPlayerProps, LyricPlayerRef };
|
|
762
781
|
//# sourceMappingURL=amll-vue.d.cts.map
|
package/dist/amll-vue.d.mts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import * as _$vue from "vue";
|
|
2
1
|
import { ExtractPublicPropTypes, PropType, Ref, ShallowRef, SlotsType } from "vue";
|
|
3
2
|
import { AbstractBaseRenderer, BaseRenderer, LyricLine, LyricLineMouseEvent, LyricPlayerBase, MaskObsceneWordsMode, OptimizeLyricOptions, spring } from "@applemusic-like-lyrics/core";
|
|
4
|
-
import * as _$vue_jsx_runtime0 from "vue/jsx-runtime";
|
|
5
|
-
|
|
6
3
|
//#region src/BackgroundRender.d.ts
|
|
7
4
|
/**
|
|
8
5
|
* 背景渲染组件的引用
|
|
@@ -94,7 +91,7 @@ declare const backgroundRenderProps: {
|
|
|
94
91
|
};
|
|
95
92
|
};
|
|
96
93
|
type BackgroundRenderProps = ExtractPublicPropTypes<typeof backgroundRenderProps>;
|
|
97
|
-
declare const BackgroundRender:
|
|
94
|
+
declare const BackgroundRender: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
98
95
|
/**
|
|
99
96
|
* 设置背景专辑资源
|
|
100
97
|
*/
|
|
@@ -169,7 +166,7 @@ declare const BackgroundRender: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
169
166
|
}>;
|
|
170
167
|
readonly required: false;
|
|
171
168
|
};
|
|
172
|
-
}>, () =>
|
|
169
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
173
170
|
/**
|
|
174
171
|
* 设置背景专辑资源
|
|
175
172
|
*/
|
|
@@ -248,7 +245,7 @@ declare const BackgroundRender: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
248
245
|
readonly albumIsVideo: boolean;
|
|
249
246
|
readonly playing: boolean;
|
|
250
247
|
readonly hasLyric: boolean;
|
|
251
|
-
}, {}, {}, {}, string,
|
|
248
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
252
249
|
//#endregion
|
|
253
250
|
//#region src/LyricPlayer.d.ts
|
|
254
251
|
declare const lyricPlayerProps: {
|
|
@@ -332,6 +329,13 @@ declare const lyricPlayerProps: {
|
|
|
332
329
|
readonly type: PropType<MaskObsceneWordsMode>;
|
|
333
330
|
readonly default: "";
|
|
334
331
|
};
|
|
332
|
+
/**
|
|
333
|
+
* 设置不雅用语掩码使用的字符,默认为 `*`
|
|
334
|
+
*/
|
|
335
|
+
readonly maskObsceneWordChar: {
|
|
336
|
+
readonly type: StringConstructor;
|
|
337
|
+
readonly default: "*";
|
|
338
|
+
};
|
|
335
339
|
/**
|
|
336
340
|
* 设置歌词优化选项
|
|
337
341
|
*/
|
|
@@ -430,7 +434,7 @@ interface LyricPlayerRef {
|
|
|
430
434
|
*/
|
|
431
435
|
wrapperEl: Readonly<ShallowRef<HTMLDivElement | null>>;
|
|
432
436
|
}
|
|
433
|
-
declare const LyricPlayer:
|
|
437
|
+
declare const LyricPlayer: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
434
438
|
/**
|
|
435
439
|
* 是否禁用歌词播放组件,默认为 `false`,歌词组件启用后将会开始逐帧更新歌词的动画效果,并对传入的其他参数变更做出反馈。
|
|
436
440
|
*
|
|
@@ -511,6 +515,13 @@ declare const LyricPlayer: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
511
515
|
readonly type: PropType<MaskObsceneWordsMode>;
|
|
512
516
|
readonly default: "";
|
|
513
517
|
};
|
|
518
|
+
/**
|
|
519
|
+
* 设置不雅用语掩码使用的字符,默认为 `*`
|
|
520
|
+
*/
|
|
521
|
+
readonly maskObsceneWordChar: {
|
|
522
|
+
readonly type: StringConstructor;
|
|
523
|
+
readonly default: "*";
|
|
524
|
+
};
|
|
514
525
|
/**
|
|
515
526
|
* 设置歌词优化选项
|
|
516
527
|
*/
|
|
@@ -583,10 +594,10 @@ declare const LyricPlayer: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
583
594
|
}>;
|
|
584
595
|
readonly required: false;
|
|
585
596
|
};
|
|
586
|
-
}>, () =>
|
|
597
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
587
598
|
readonly lineClick: (_: LyricLineMouseEvent) => boolean;
|
|
588
599
|
readonly lineContextmenu: (_: LyricLineMouseEvent) => boolean;
|
|
589
|
-
}, string,
|
|
600
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
590
601
|
/**
|
|
591
602
|
* 是否禁用歌词播放组件,默认为 `false`,歌词组件启用后将会开始逐帧更新歌词的动画效果,并对传入的其他参数变更做出反馈。
|
|
592
603
|
*
|
|
@@ -667,6 +678,13 @@ declare const LyricPlayer: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
667
678
|
readonly type: PropType<MaskObsceneWordsMode>;
|
|
668
679
|
readonly default: "";
|
|
669
680
|
};
|
|
681
|
+
/**
|
|
682
|
+
* 设置不雅用语掩码使用的字符,默认为 `*`
|
|
683
|
+
*/
|
|
684
|
+
readonly maskObsceneWordChar: {
|
|
685
|
+
readonly type: StringConstructor;
|
|
686
|
+
readonly default: "*";
|
|
687
|
+
};
|
|
670
688
|
/**
|
|
671
689
|
* 设置歌词优化选项
|
|
672
690
|
*/
|
|
@@ -752,11 +770,12 @@ declare const LyricPlayer: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
752
770
|
readonly enableScale: boolean;
|
|
753
771
|
readonly hidePassedLines: boolean;
|
|
754
772
|
readonly maskObsceneWordsMode: MaskObsceneWordsMode;
|
|
773
|
+
readonly maskObsceneWordChar: string;
|
|
755
774
|
readonly currentTime: number;
|
|
756
775
|
readonly wordFadeWidth: number;
|
|
757
776
|
}, SlotsType<{
|
|
758
777
|
"bottom-line": () => void;
|
|
759
|
-
}>, {}, {}, string,
|
|
778
|
+
}>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
760
779
|
//#endregion
|
|
761
780
|
export { BackgroundRender, BackgroundRenderProps, BackgroundRenderRef, LyricPlayer, LyricPlayerEmits, LyricPlayerProps, LyricPlayerRef };
|
|
762
781
|
//# sourceMappingURL=amll-vue.d.mts.map
|
package/dist/amll-vue.mjs
CHANGED
|
@@ -123,160 +123,170 @@ const BackgroundRender = defineComponent({
|
|
|
123
123
|
}, null);
|
|
124
124
|
}
|
|
125
125
|
});
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/LyricPlayer.tsx
|
|
128
|
+
const lyricPlayerProps = {
|
|
129
|
+
/**
|
|
130
|
+
* 是否禁用歌词播放组件,默认为 `false`,歌词组件启用后将会开始逐帧更新歌词的动画效果,并对传入的其他参数变更做出反馈。
|
|
131
|
+
*
|
|
132
|
+
* 如果禁用了歌词组件动画,你也可以通过引用取得原始渲染组件实例,手动逐帧调用其 `update` 函数来更新动画效果。
|
|
133
|
+
*/
|
|
134
|
+
disabled: {
|
|
135
|
+
type: Boolean,
|
|
136
|
+
default: false
|
|
137
|
+
},
|
|
138
|
+
/**
|
|
139
|
+
* 是否演出部分效果,目前会控制播放间奏点的动画的播放暂停与否,默认为 `true`
|
|
140
|
+
*/
|
|
141
|
+
playing: {
|
|
142
|
+
type: Boolean,
|
|
143
|
+
default: true
|
|
144
|
+
},
|
|
145
|
+
/**
|
|
146
|
+
* 设置歌词行的对齐方式,如果为 `undefined` 则默认为 `center`
|
|
147
|
+
*
|
|
148
|
+
* - 设置成 `top` 的话将会向目标歌词行的顶部对齐
|
|
149
|
+
* - 设置成 `bottom` 的话将会向目标歌词行的底部对齐
|
|
150
|
+
* - 设置成 `center` 的话将会向目标歌词行的垂直中心对齐
|
|
151
|
+
*/
|
|
152
|
+
alignAnchor: {
|
|
153
|
+
type: String,
|
|
154
|
+
default: "center"
|
|
155
|
+
},
|
|
156
|
+
/**
|
|
157
|
+
* 设置默认的歌词行对齐位置,相对于整个歌词播放组件的大小位置,如果为 `undefined`
|
|
158
|
+
* 则默认为 `0.5`
|
|
159
|
+
*
|
|
160
|
+
* 可以设置一个 `[0.0-1.0]` 之间的任意数字,代表组件高度由上到下的比例位置
|
|
161
|
+
*/
|
|
162
|
+
alignPosition: {
|
|
163
|
+
type: Number,
|
|
164
|
+
default: .5
|
|
165
|
+
},
|
|
166
|
+
/**
|
|
167
|
+
* 设置是否使用物理弹簧算法实现歌词动画效果,默认启用
|
|
168
|
+
*
|
|
169
|
+
* 如果启用,则会通过弹簧算法实时处理歌词位置,但是需要性能足够强劲的电脑方可流畅运行
|
|
170
|
+
*
|
|
171
|
+
* 如果不启用,则会回退到基于 `transition` 的过渡效果,对低性能的机器比较友好,但是效果会比较单一
|
|
172
|
+
*/
|
|
173
|
+
enableSpring: {
|
|
174
|
+
type: Boolean,
|
|
175
|
+
default: true
|
|
176
|
+
},
|
|
177
|
+
/**
|
|
178
|
+
* 设置是否启用歌词行的模糊效果,默认为 `true`
|
|
179
|
+
*/
|
|
180
|
+
enableBlur: {
|
|
181
|
+
type: Boolean,
|
|
182
|
+
default: true
|
|
183
|
+
},
|
|
184
|
+
/**
|
|
185
|
+
* 设置是否使用物理弹簧算法实现歌词动画效果,默认启用
|
|
186
|
+
*
|
|
187
|
+
* 如果启用,则会通过弹簧算法实时处理歌词位置,但是需要性能足够强劲的电脑方可流畅运行
|
|
188
|
+
*
|
|
189
|
+
* 如果不启用,则会回退到基于 `transition` 的过渡效果,对低性能的机器比较友好,但是效果会比较单一
|
|
190
|
+
*/
|
|
191
|
+
enableScale: {
|
|
192
|
+
type: Boolean,
|
|
193
|
+
default: true
|
|
194
|
+
},
|
|
195
|
+
/**
|
|
196
|
+
* 设置是否隐藏已经播放过的歌词行,默认不隐藏
|
|
197
|
+
*/
|
|
198
|
+
hidePassedLines: {
|
|
199
|
+
type: Boolean,
|
|
200
|
+
default: false
|
|
201
|
+
},
|
|
202
|
+
/**
|
|
203
|
+
* 设置歌词中不雅用语的掩码模式,默认为 `MaskObsceneWordsMode.Disabled`,即不掩码
|
|
204
|
+
*/
|
|
205
|
+
maskObsceneWordsMode: {
|
|
206
|
+
type: String,
|
|
207
|
+
default: MaskObsceneWordsMode.Disabled
|
|
208
|
+
},
|
|
209
|
+
/**
|
|
210
|
+
* 设置不雅用语掩码使用的字符,默认为 `*`
|
|
211
|
+
*/
|
|
212
|
+
maskObsceneWordChar: {
|
|
213
|
+
type: String,
|
|
214
|
+
default: "*"
|
|
215
|
+
},
|
|
216
|
+
/**
|
|
217
|
+
* 设置歌词优化选项
|
|
218
|
+
*/
|
|
219
|
+
optimizeOptions: {
|
|
220
|
+
type: Object,
|
|
221
|
+
required: false
|
|
222
|
+
},
|
|
223
|
+
/**
|
|
224
|
+
* 设置当前播放歌词,要注意传入后这个数组内的信息不得修改,否则会发生错误
|
|
225
|
+
*/
|
|
226
|
+
lyricLines: {
|
|
227
|
+
type: Object,
|
|
228
|
+
required: false
|
|
229
|
+
},
|
|
230
|
+
/**
|
|
231
|
+
* 设置当前播放进度,单位为毫秒且**必须是整数**,此时将会更新内部的歌词进度信息
|
|
232
|
+
* 内部会根据调用间隔和播放进度自动决定如何滚动和显示歌词,所以这个的调用频率越快越准确越好
|
|
233
|
+
*/
|
|
234
|
+
currentTime: {
|
|
235
|
+
type: Number,
|
|
236
|
+
default: 0
|
|
237
|
+
},
|
|
238
|
+
/**
|
|
239
|
+
* 设置文字动画的渐变宽度,单位以歌词行的主文字字体大小的倍数为单位,默认为 0.5,即一个全角字符的一半宽度
|
|
240
|
+
*
|
|
241
|
+
* 如果要模拟 Apple Music for Android 的效果,可以设置为 1
|
|
242
|
+
*
|
|
243
|
+
* 如果要模拟 Apple Music for iPad 的效果,可以设置为 0.5
|
|
244
|
+
*
|
|
245
|
+
* 如果想要近乎禁用渐变效果,可以设置成非常接近 0 的小数(例如 `0.0001` ),但是**不可以为 0**
|
|
246
|
+
*/
|
|
247
|
+
wordFadeWidth: {
|
|
248
|
+
type: Number,
|
|
249
|
+
default: .5
|
|
250
|
+
},
|
|
251
|
+
/**
|
|
252
|
+
* 设置所有歌词行在横坐标上的弹簧属性,包括重量、弹力和阻力。
|
|
253
|
+
*
|
|
254
|
+
* @param params 需要设置的弹簧属性,提供的属性将会覆盖原来的属性,未提供的属性将会保持原样
|
|
255
|
+
*/
|
|
256
|
+
linePosXSpringParams: {
|
|
257
|
+
type: Object,
|
|
258
|
+
required: false
|
|
259
|
+
},
|
|
260
|
+
/**
|
|
261
|
+
* 设置所有歌词行在纵坐标上的弹簧属性,包括重量、弹力和阻力。
|
|
262
|
+
*
|
|
263
|
+
* @param params 需要设置的弹簧属性,提供的属性将会覆盖原来的属性,未提供的属性将会保持原样
|
|
264
|
+
*/
|
|
265
|
+
linePosYSpringParams: {
|
|
266
|
+
type: Object,
|
|
267
|
+
required: false
|
|
268
|
+
},
|
|
269
|
+
/**
|
|
270
|
+
* 设置所有歌词行在缩放大小上的弹簧属性,包括重量、弹力和阻力。
|
|
271
|
+
*
|
|
272
|
+
* @param params 需要设置的弹簧属性,提供的属性将会覆盖原来的属性,未提供的属性将会保持原样
|
|
273
|
+
*/
|
|
274
|
+
lineScaleSpringParams: {
|
|
275
|
+
type: Object,
|
|
276
|
+
required: false
|
|
277
|
+
},
|
|
278
|
+
/**
|
|
279
|
+
* 设置渲染器,如果为 `undefined` 则默认为 `MeshGradientRenderer`
|
|
280
|
+
* 默认渲染器有可能会随着版本更新而更换
|
|
281
|
+
*/
|
|
282
|
+
lyricPlayer: {
|
|
283
|
+
type: Object,
|
|
284
|
+
required: false
|
|
285
|
+
}
|
|
286
|
+
};
|
|
126
287
|
const LyricPlayer = defineComponent({
|
|
127
288
|
name: "LyricPlayer",
|
|
128
|
-
props:
|
|
129
|
-
/**
|
|
130
|
-
* 是否禁用歌词播放组件,默认为 `false`,歌词组件启用后将会开始逐帧更新歌词的动画效果,并对传入的其他参数变更做出反馈。
|
|
131
|
-
*
|
|
132
|
-
* 如果禁用了歌词组件动画,你也可以通过引用取得原始渲染组件实例,手动逐帧调用其 `update` 函数来更新动画效果。
|
|
133
|
-
*/
|
|
134
|
-
disabled: {
|
|
135
|
-
type: Boolean,
|
|
136
|
-
default: false
|
|
137
|
-
},
|
|
138
|
-
/**
|
|
139
|
-
* 是否演出部分效果,目前会控制播放间奏点的动画的播放暂停与否,默认为 `true`
|
|
140
|
-
*/
|
|
141
|
-
playing: {
|
|
142
|
-
type: Boolean,
|
|
143
|
-
default: true
|
|
144
|
-
},
|
|
145
|
-
/**
|
|
146
|
-
* 设置歌词行的对齐方式,如果为 `undefined` 则默认为 `center`
|
|
147
|
-
*
|
|
148
|
-
* - 设置成 `top` 的话将会向目标歌词行的顶部对齐
|
|
149
|
-
* - 设置成 `bottom` 的话将会向目标歌词行的底部对齐
|
|
150
|
-
* - 设置成 `center` 的话将会向目标歌词行的垂直中心对齐
|
|
151
|
-
*/
|
|
152
|
-
alignAnchor: {
|
|
153
|
-
type: String,
|
|
154
|
-
default: "center"
|
|
155
|
-
},
|
|
156
|
-
/**
|
|
157
|
-
* 设置默认的歌词行对齐位置,相对于整个歌词播放组件的大小位置,如果为 `undefined`
|
|
158
|
-
* 则默认为 `0.5`
|
|
159
|
-
*
|
|
160
|
-
* 可以设置一个 `[0.0-1.0]` 之间的任意数字,代表组件高度由上到下的比例位置
|
|
161
|
-
*/
|
|
162
|
-
alignPosition: {
|
|
163
|
-
type: Number,
|
|
164
|
-
default: .5
|
|
165
|
-
},
|
|
166
|
-
/**
|
|
167
|
-
* 设置是否使用物理弹簧算法实现歌词动画效果,默认启用
|
|
168
|
-
*
|
|
169
|
-
* 如果启用,则会通过弹簧算法实时处理歌词位置,但是需要性能足够强劲的电脑方可流畅运行
|
|
170
|
-
*
|
|
171
|
-
* 如果不启用,则会回退到基于 `transition` 的过渡效果,对低性能的机器比较友好,但是效果会比较单一
|
|
172
|
-
*/
|
|
173
|
-
enableSpring: {
|
|
174
|
-
type: Boolean,
|
|
175
|
-
default: true
|
|
176
|
-
},
|
|
177
|
-
/**
|
|
178
|
-
* 设置是否启用歌词行的模糊效果,默认为 `true`
|
|
179
|
-
*/
|
|
180
|
-
enableBlur: {
|
|
181
|
-
type: Boolean,
|
|
182
|
-
default: true
|
|
183
|
-
},
|
|
184
|
-
/**
|
|
185
|
-
* 设置是否使用物理弹簧算法实现歌词动画效果,默认启用
|
|
186
|
-
*
|
|
187
|
-
* 如果启用,则会通过弹簧算法实时处理歌词位置,但是需要性能足够强劲的电脑方可流畅运行
|
|
188
|
-
*
|
|
189
|
-
* 如果不启用,则会回退到基于 `transition` 的过渡效果,对低性能的机器比较友好,但是效果会比较单一
|
|
190
|
-
*/
|
|
191
|
-
enableScale: {
|
|
192
|
-
type: Boolean,
|
|
193
|
-
default: true
|
|
194
|
-
},
|
|
195
|
-
/**
|
|
196
|
-
* 设置是否隐藏已经播放过的歌词行,默认不隐藏
|
|
197
|
-
*/
|
|
198
|
-
hidePassedLines: {
|
|
199
|
-
type: Boolean,
|
|
200
|
-
default: false
|
|
201
|
-
},
|
|
202
|
-
/**
|
|
203
|
-
* 设置歌词中不雅用语的掩码模式,默认为 `MaskObsceneWordsMode.Disabled`,即不掩码
|
|
204
|
-
*/
|
|
205
|
-
maskObsceneWordsMode: {
|
|
206
|
-
type: String,
|
|
207
|
-
default: MaskObsceneWordsMode.Disabled
|
|
208
|
-
},
|
|
209
|
-
/**
|
|
210
|
-
* 设置歌词优化选项
|
|
211
|
-
*/
|
|
212
|
-
optimizeOptions: {
|
|
213
|
-
type: Object,
|
|
214
|
-
required: false
|
|
215
|
-
},
|
|
216
|
-
/**
|
|
217
|
-
* 设置当前播放歌词,要注意传入后这个数组内的信息不得修改,否则会发生错误
|
|
218
|
-
*/
|
|
219
|
-
lyricLines: {
|
|
220
|
-
type: Object,
|
|
221
|
-
required: false
|
|
222
|
-
},
|
|
223
|
-
/**
|
|
224
|
-
* 设置当前播放进度,单位为毫秒且**必须是整数**,此时将会更新内部的歌词进度信息
|
|
225
|
-
* 内部会根据调用间隔和播放进度自动决定如何滚动和显示歌词,所以这个的调用频率越快越准确越好
|
|
226
|
-
*/
|
|
227
|
-
currentTime: {
|
|
228
|
-
type: Number,
|
|
229
|
-
default: 0
|
|
230
|
-
},
|
|
231
|
-
/**
|
|
232
|
-
* 设置文字动画的渐变宽度,单位以歌词行的主文字字体大小的倍数为单位,默认为 0.5,即一个全角字符的一半宽度
|
|
233
|
-
*
|
|
234
|
-
* 如果要模拟 Apple Music for Android 的效果,可以设置为 1
|
|
235
|
-
*
|
|
236
|
-
* 如果要模拟 Apple Music for iPad 的效果,可以设置为 0.5
|
|
237
|
-
*
|
|
238
|
-
* 如果想要近乎禁用渐变效果,可以设置成非常接近 0 的小数(例如 `0.0001` ),但是**不可以为 0**
|
|
239
|
-
*/
|
|
240
|
-
wordFadeWidth: {
|
|
241
|
-
type: Number,
|
|
242
|
-
default: .5
|
|
243
|
-
},
|
|
244
|
-
/**
|
|
245
|
-
* 设置所有歌词行在横坐标上的弹簧属性,包括重量、弹力和阻力。
|
|
246
|
-
*
|
|
247
|
-
* @param params 需要设置的弹簧属性,提供的属性将会覆盖原来的属性,未提供的属性将会保持原样
|
|
248
|
-
*/
|
|
249
|
-
linePosXSpringParams: {
|
|
250
|
-
type: Object,
|
|
251
|
-
required: false
|
|
252
|
-
},
|
|
253
|
-
/**
|
|
254
|
-
* 设置所有歌词行在纵坐标上的弹簧属性,包括重量、弹力和阻力。
|
|
255
|
-
*
|
|
256
|
-
* @param params 需要设置的弹簧属性,提供的属性将会覆盖原来的属性,未提供的属性将会保持原样
|
|
257
|
-
*/
|
|
258
|
-
linePosYSpringParams: {
|
|
259
|
-
type: Object,
|
|
260
|
-
required: false
|
|
261
|
-
},
|
|
262
|
-
/**
|
|
263
|
-
* 设置所有歌词行在缩放大小上的弹簧属性,包括重量、弹力和阻力。
|
|
264
|
-
*
|
|
265
|
-
* @param params 需要设置的弹簧属性,提供的属性将会覆盖原来的属性,未提供的属性将会保持原样
|
|
266
|
-
*/
|
|
267
|
-
lineScaleSpringParams: {
|
|
268
|
-
type: Object,
|
|
269
|
-
required: false
|
|
270
|
-
},
|
|
271
|
-
/**
|
|
272
|
-
* 设置渲染器,如果为 `undefined` 则默认为 `MeshGradientRenderer`
|
|
273
|
-
* 默认渲染器有可能会随着版本更新而更换
|
|
274
|
-
*/
|
|
275
|
-
lyricPlayer: {
|
|
276
|
-
type: Object,
|
|
277
|
-
required: false
|
|
278
|
-
}
|
|
279
|
-
},
|
|
289
|
+
props: lyricPlayerProps,
|
|
280
290
|
emits: {
|
|
281
291
|
lineClick: (_) => true,
|
|
282
292
|
lineContextmenu: (_) => true
|
|
@@ -285,6 +295,7 @@ const LyricPlayer = defineComponent({
|
|
|
285
295
|
setup(props, { expose, emit, attrs, slots }) {
|
|
286
296
|
const wrapperRef = useTemplateRef("wrapper-ref");
|
|
287
297
|
const playerRef = ref();
|
|
298
|
+
let prevLyricLines;
|
|
288
299
|
const lineClickHandler = (e) => emit("lineClick", e);
|
|
289
300
|
const lineContextMenuHandler = (e) => emit("lineContextmenu", e);
|
|
290
301
|
onMounted(() => {
|
|
@@ -320,10 +331,35 @@ const LyricPlayer = defineComponent({
|
|
|
320
331
|
});
|
|
321
332
|
}
|
|
322
333
|
});
|
|
334
|
+
watch([
|
|
335
|
+
playerRef,
|
|
336
|
+
() => props.lyricLines,
|
|
337
|
+
() => props.optimizeOptions,
|
|
338
|
+
() => props.maskObsceneWordsMode,
|
|
339
|
+
() => props.maskObsceneWordChar
|
|
340
|
+
], ([player, lyricLines]) => {
|
|
341
|
+
if (!player) return;
|
|
342
|
+
const isLyricLinesChanged = lyricLines !== prevLyricLines;
|
|
343
|
+
prevLyricLines = lyricLines;
|
|
344
|
+
if (isLyricLinesChanged) {
|
|
345
|
+
player.setLyricProcessConfig({
|
|
346
|
+
optimizeOptions: props.optimizeOptions,
|
|
347
|
+
maskMode: props.maskObsceneWordsMode,
|
|
348
|
+
maskChar: props.maskObsceneWordChar
|
|
349
|
+
});
|
|
350
|
+
player.setLyricLines(lyricLines ?? []);
|
|
351
|
+
if (props.currentTime !== void 0) player.setCurrentTime(props.currentTime, true);
|
|
352
|
+
} else player.updateLyricProcessConfig({
|
|
353
|
+
optimizeOptions: props.optimizeOptions,
|
|
354
|
+
maskMode: props.maskObsceneWordsMode,
|
|
355
|
+
maskChar: props.maskObsceneWordChar
|
|
356
|
+
});
|
|
357
|
+
}, { immediate: true });
|
|
323
358
|
watchEffect(() => {
|
|
324
|
-
if (props.playing !== void 0)
|
|
325
|
-
|
|
326
|
-
|
|
359
|
+
if (props.playing !== void 0) {
|
|
360
|
+
if (props.playing) playerRef.value?.resume();
|
|
361
|
+
else playerRef.value?.pause();
|
|
362
|
+
} else playerRef.value?.resume();
|
|
327
363
|
});
|
|
328
364
|
watchEffect(() => {
|
|
329
365
|
if (props.alignAnchor !== void 0) playerRef.value?.setAlignAnchor(props.alignAnchor);
|
|
@@ -331,10 +367,6 @@ const LyricPlayer = defineComponent({
|
|
|
331
367
|
watchEffect(() => {
|
|
332
368
|
if (props.hidePassedLines !== void 0) playerRef.value?.setHidePassedLines(props.hidePassedLines);
|
|
333
369
|
});
|
|
334
|
-
watchEffect(() => {
|
|
335
|
-
if (props.maskObsceneWordsMode !== void 0) playerRef.value?.setMaskObsceneWords(props.maskObsceneWordsMode);
|
|
336
|
-
else playerRef.value?.setMaskObsceneWords(MaskObsceneWordsMode.Disabled);
|
|
337
|
-
});
|
|
338
370
|
watchEffect(() => {
|
|
339
371
|
if (props.alignPosition !== void 0) playerRef.value?.setAlignPosition(props.alignPosition);
|
|
340
372
|
});
|
|
@@ -350,17 +382,6 @@ const LyricPlayer = defineComponent({
|
|
|
350
382
|
if (props.enableScale !== void 0) playerRef.value?.setEnableScale(props.enableScale);
|
|
351
383
|
else playerRef.value?.setEnableScale(true);
|
|
352
384
|
});
|
|
353
|
-
watch([
|
|
354
|
-
playerRef,
|
|
355
|
-
() => props.lyricLines,
|
|
356
|
-
() => props.optimizeOptions
|
|
357
|
-
], ([player, lyricLines, optimizeOptions]) => {
|
|
358
|
-
if (!player) return;
|
|
359
|
-
if (optimizeOptions !== void 0) player.setOptimizeOptions(optimizeOptions);
|
|
360
|
-
if (lyricLines !== void 0) player.setLyricLines(lyricLines);
|
|
361
|
-
else player.setLyricLines([]);
|
|
362
|
-
if (props.currentTime !== void 0) player.setCurrentTime(props.currentTime, true);
|
|
363
|
-
}, { immediate: true });
|
|
364
385
|
watchEffect(() => {
|
|
365
386
|
if (props.currentTime !== void 0) playerRef.value?.setCurrentTime(props.currentTime);
|
|
366
387
|
});
|
package/dist/amll-vue.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amll-vue.mjs","names":["AbstractBaseRenderer","BaseRenderer","BackgroundRender","CoreBackgroundRender","MeshGradientRenderer","defineComponent","ExtractPublicPropTypes","onMounted","onUnmounted","PropType","Ref","ref","ShallowRef","useTemplateRef","watchEffect","BackgroundRenderRef","bgRender","wrapperEl","Readonly","HTMLDivElement","backgroundRenderProps","album","type","String","Object","HTMLImageElement","HTMLVideoElement","required","albumIsVideo","Boolean","fps","Number","playing","flowSpeed","hasLyric","lowFreqVolume","renderScale","renderer","args","ConstructorParameters","const","BackgroundRenderProps","name","props","setup","expose","wrapperRef","bgRenderRef","value","new","el","getElement","style","width","height","appendChild","dispose","setAlbum","setFPS","pause","resume","setFlowSpeed","setRenderScale","setLowFreqVolume","undefined","setHasLyric","_createVNode","BaseRenderer","LyricPlayer","CoreLyricPlayer","LyricLine","LyricLineMouseEvent","LyricPlayerBase","MaskObsceneWordsMode","OptimizeLyricOptions","spring","computed","defineComponent","ExtractPublicPropTypes","onMounted","onUnmounted","PropType","Ref","ref","ShallowRef","SlotsType","Teleport","useTemplateRef","watch","watchEffect","lyricPlayerProps","disabled","type","Boolean","default","playing","alignAnchor","String","alignPosition","Number","enableSpring","enableBlur","enableScale","hidePassedLines","maskObsceneWordsMode","Disabled","optimizeOptions","Object","required","lyricLines","currentTime","wordFadeWidth","linePosXSpringParams","Partial","SpringParams","linePosYSpringParams","lineScaleSpringParams","lyricPlayer","args","ConstructorParameters","const","LyricPlayerProps","lyricPlayerEmits","lineClick","_","lineContextmenu","LyricPlayerEmits","LyricPlayerRef","wrapperEl","Readonly","HTMLDivElement","name","props","emits","slots","setup","expose","emit","attrs","wrapperRef","playerRef","lineClickHandler","e","Event","lineContextMenuHandler","wrapper","value","appendChild","getElement","addEventListener","removeEventListener","dispose","onCleanup","canceled","lastTime","onFrame","time","update","requestAnimationFrame","undefined","resume","pause","setAlignAnchor","setHidePassedLines","setMaskObsceneWords","setAlignPosition","setEnableSpring","setEnableBlur","setEnableScale","player","setOptimizeOptions","setLyricLines","setCurrentTime","immediate","setWordFadeWidth","setLinePosXSpringParams","setLinePosYSpringParams","setLineScaleSpringParams","bottomLineEl","getBottomLineElement","_createVNode","_mergeProps"],"sources":["../src/BackgroundRender.tsx","../src/LyricPlayer.tsx"],"sourcesContent":["import {\n\ttype AbstractBaseRenderer,\n\ttype BaseRenderer,\n\tBackgroundRender as CoreBackgroundRender,\n\tMeshGradientRenderer,\n} from \"@applemusic-like-lyrics/core\";\nimport {\n\tdefineComponent,\n\ttype ExtractPublicPropTypes,\n\tonMounted,\n\tonUnmounted,\n\ttype PropType,\n\ttype Ref,\n\tref,\n\ttype ShallowRef,\n\tuseTemplateRef,\n\twatchEffect,\n} from \"vue\";\n\n/**\n * 背景渲染组件的引用\n */\nexport interface BackgroundRenderRef {\n\t/**\n\t * 背景渲染实例引用\n\t */\n\tbgRender?: Ref<AbstractBaseRenderer | undefined>;\n\t/**\n\t * 将背景渲染实例的元素包裹起来的 DIV 元素实例\n\t */\n\twrapperEl: Readonly<ShallowRef<HTMLDivElement | null>>;\n}\n\nconst backgroundRenderProps = {\n\t/**\n\t * 设置背景专辑资源\n\t */\n\talbum: {\n\t\ttype: [String, Object] as PropType<\n\t\t\tstring | HTMLImageElement | HTMLVideoElement\n\t\t>,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置专辑资源是否为视频\n\t */\n\talbumIsVideo: {\n\t\ttype: Boolean,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置当前背景动画帧率,如果为 `undefined` 则默认为 `30`\n\t */\n\tfps: {\n\t\ttype: Number,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置当前播放状态,如果为 `undefined` 则默认为 `true`\n\t */\n\tplaying: {\n\t\ttype: Boolean,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置当前动画流动速度,如果为 `undefined` 则默认为 `2`\n\t */\n\tflowSpeed: {\n\t\ttype: Number,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置背景是否根据“是否有歌词”这个特征调整自身效果,例如有歌词时会变得更加活跃\n\t *\n\t * 部分渲染器会根据这个特征调整自身效果\n\t *\n\t * 如果不确定是否需要赋值或无法知晓是否包含歌词,请传入 true 或不做任何处理(默认值为 true)\n\t */\n\thasLyric: {\n\t\ttype: Boolean,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置低频的音量大小,范围在 80hz-120hz 之间为宜,取值范围在 [0.0-1.0] 之间\n\t *\n\t * 部分渲染器会根据音量大小调整背景效果(例如根据鼓点跳动)\n\t *\n\t * 如果无法获取到类似的数据,请传入 undefined 或 1.0 作为默认值,或不做任何处理(默认值即 1.0)\n\t */\n\tlowFreqVolume: {\n\t\ttype: Number,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置当前渲染缩放比例,如果为 `undefined` 则默认为 `0.5`\n\t */\n\trenderScale: {\n\t\ttype: Number,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置渲染器,如果为 `undefined` 则默认为 `MeshGradientRenderer`\n\t * 默认渲染器有可能会随着版本更新而更换\n\t */\n\trenderer: {\n\t\ttype: Object as PropType<{\n\t\t\tnew (...args: ConstructorParameters<typeof BaseRenderer>): BaseRenderer;\n\t\t}>,\n\t\trequired: false,\n\t},\n} as const;\n\nexport type BackgroundRenderProps = ExtractPublicPropTypes<\n\ttypeof backgroundRenderProps\n>;\n\nexport const BackgroundRender = defineComponent({\n\tname: \"BackgroundRender\",\n\tprops: backgroundRenderProps,\n\tsetup(props, { expose }) {\n\t\tconst wrapperRef = useTemplateRef<HTMLDivElement>(\"wrapper-ref\");\n\t\tconst bgRenderRef = ref<AbstractBaseRenderer>();\n\n\t\tonMounted(() => {\n\t\t\tif (wrapperRef.value) {\n\t\t\t\tbgRenderRef.value = CoreBackgroundRender.new(\n\t\t\t\t\tprops.renderer ?? MeshGradientRenderer,\n\t\t\t\t);\n\t\t\t\tconst el = bgRenderRef.value.getElement();\n\t\t\t\tel.style.width = \"100%\";\n\t\t\t\tel.style.height = \"100%\";\n\t\t\t\twrapperRef.value.appendChild(el);\n\t\t\t}\n\t\t});\n\n\t\tonUnmounted(() => {\n\t\t\tif (bgRenderRef.value) {\n\t\t\t\tbgRenderRef.value.dispose();\n\t\t\t}\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.album)\n\t\t\t\tbgRenderRef.value?.setAlbum(props.album, props.albumIsVideo);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.fps) bgRenderRef.value?.setFPS(props.fps);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.playing) bgRenderRef.value?.pause();\n\t\t\telse bgRenderRef.value?.resume();\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.flowSpeed) bgRenderRef.value?.setFlowSpeed(props.flowSpeed);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.renderScale)\n\t\t\t\tbgRenderRef.value?.setRenderScale(props.renderScale);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.lowFreqVolume)\n\t\t\t\tbgRenderRef.value?.setLowFreqVolume(props.lowFreqVolume);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.hasLyric !== undefined)\n\t\t\t\tbgRenderRef.value?.setHasLyric(props.hasLyric ?? true);\n\t\t});\n\n\t\texpose<BackgroundRenderRef>({\n\t\t\tbgRender: bgRenderRef,\n\t\t\twrapperEl: wrapperRef,\n\t\t});\n\n\t\treturn () => <div style=\"display: contents;\" ref=\"wrapper-ref\" />;\n\t},\n});\n","import {\n\ttype BaseRenderer,\n\tLyricPlayer as CoreLyricPlayer,\n\ttype LyricLine,\n\ttype LyricLineMouseEvent,\n\ttype LyricPlayerBase,\n\tMaskObsceneWordsMode,\n\ttype OptimizeLyricOptions,\n\ttype spring,\n} from \"@applemusic-like-lyrics/core\";\nimport {\n\tcomputed,\n\tdefineComponent,\n\ttype ExtractPublicPropTypes,\n\tonMounted,\n\tonUnmounted,\n\ttype PropType,\n\ttype Ref,\n\tref,\n\ttype ShallowRef,\n\ttype SlotsType,\n\tTeleport,\n\tuseTemplateRef,\n\twatch,\n\twatchEffect,\n} from \"vue\";\n\nconst lyricPlayerProps = {\n\t/**\n\t * 是否禁用歌词播放组件,默认为 `false`,歌词组件启用后将会开始逐帧更新歌词的动画效果,并对传入的其他参数变更做出反馈。\n\t *\n\t * 如果禁用了歌词组件动画,你也可以通过引用取得原始渲染组件实例,手动逐帧调用其 `update` 函数来更新动画效果。\n\t */\n\tdisabled: {\n\t\ttype: Boolean,\n\t\tdefault: false,\n\t},\n\t/**\n\t * 是否演出部分效果,目前会控制播放间奏点的动画的播放暂停与否,默认为 `true`\n\t */\n\tplaying: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * 设置歌词行的对齐方式,如果为 `undefined` 则默认为 `center`\n\t *\n\t * - 设置成 `top` 的话将会向目标歌词行的顶部对齐\n\t * - 设置成 `bottom` 的话将会向目标歌词行的底部对齐\n\t * - 设置成 `center` 的话将会向目标歌词行的垂直中心对齐\n\t */\n\talignAnchor: {\n\t\ttype: String as PropType<\"top\" | \"bottom\" | \"center\">,\n\t\tdefault: \"center\",\n\t},\n\t/**\n\t * 设置默认的歌词行对齐位置,相对于整个歌词播放组件的大小位置,如果为 `undefined`\n\t * 则默认为 `0.5`\n\t *\n\t * 可以设置一个 `[0.0-1.0]` 之间的任意数字,代表组件高度由上到下的比例位置\n\t */\n\talignPosition: {\n\t\ttype: Number,\n\t\tdefault: 0.5,\n\t},\n\t/**\n\t * 设置是否使用物理弹簧算法实现歌词动画效果,默认启用\n\t *\n\t * 如果启用,则会通过弹簧算法实时处理歌词位置,但是需要性能足够强劲的电脑方可流畅运行\n\t *\n\t * 如果不启用,则会回退到基于 `transition` 的过渡效果,对低性能的机器比较友好,但是效果会比较单一\n\t */\n\tenableSpring: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * 设置是否启用歌词行的模糊效果,默认为 `true`\n\t */\n\tenableBlur: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * 设置是否使用物理弹簧算法实现歌词动画效果,默认启用\n\t *\n\t * 如果启用,则会通过弹簧算法实时处理歌词位置,但是需要性能足够强劲的电脑方可流畅运行\n\t *\n\t * 如果不启用,则会回退到基于 `transition` 的过渡效果,对低性能的机器比较友好,但是效果会比较单一\n\t */\n\tenableScale: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * 设置是否隐藏已经播放过的歌词行,默认不隐藏\n\t */\n\thidePassedLines: {\n\t\ttype: Boolean,\n\t\tdefault: false,\n\t},\n\t/**\n\t * 设置歌词中不雅用语的掩码模式,默认为 `MaskObsceneWordsMode.Disabled`,即不掩码\n\t */\n\tmaskObsceneWordsMode: {\n\t\ttype: String as PropType<MaskObsceneWordsMode>,\n\t\tdefault: MaskObsceneWordsMode.Disabled,\n\t},\n\t/**\n\t * 设置歌词优化选项\n\t */\n\toptimizeOptions: {\n\t\ttype: Object as PropType<OptimizeLyricOptions>,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置当前播放歌词,要注意传入后这个数组内的信息不得修改,否则会发生错误\n\t */\n\tlyricLines: {\n\t\ttype: Object as PropType<LyricLine[]>,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置当前播放进度,单位为毫秒且**必须是整数**,此时将会更新内部的歌词进度信息\n\t * 内部会根据调用间隔和播放进度自动决定如何滚动和显示歌词,所以这个的调用频率越快越准确越好\n\t */\n\tcurrentTime: {\n\t\ttype: Number,\n\t\tdefault: 0,\n\t},\n\t/**\n\t * 设置文字动画的渐变宽度,单位以歌词行的主文字字体大小的倍数为单位,默认为 0.5,即一个全角字符的一半宽度\n\t *\n\t * 如果要模拟 Apple Music for Android 的效果,可以设置为 1\n\t *\n\t * 如果要模拟 Apple Music for iPad 的效果,可以设置为 0.5\n\t *\n\t * 如果想要近乎禁用渐变效果,可以设置成非常接近 0 的小数(例如 `0.0001` ),但是**不可以为 0**\n\t */\n\twordFadeWidth: {\n\t\ttype: Number,\n\t\tdefault: 0.5,\n\t},\n\t/**\n\t * 设置所有歌词行在横坐标上的弹簧属性,包括重量、弹力和阻力。\n\t *\n\t * @param params 需要设置的弹簧属性,提供的属性将会覆盖原来的属性,未提供的属性将会保持原样\n\t */\n\tlinePosXSpringParams: {\n\t\ttype: Object as PropType<Partial<spring.SpringParams>>,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置所有歌词行在纵坐标上的弹簧属性,包括重量、弹力和阻力。\n\t *\n\t * @param params 需要设置的弹簧属性,提供的属性将会覆盖原来的属性,未提供的属性将会保持原样\n\t */\n\tlinePosYSpringParams: {\n\t\ttype: Object as PropType<Partial<spring.SpringParams>>,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置所有歌词行在缩放大小上的弹簧属性,包括重量、弹力和阻力。\n\t *\n\t * @param params 需要设置的弹簧属性,提供的属性将会覆盖原来的属性,未提供的属性将会保持原样\n\t */\n\tlineScaleSpringParams: {\n\t\ttype: Object as PropType<Partial<spring.SpringParams>>,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置渲染器,如果为 `undefined` 则默认为 `MeshGradientRenderer`\n\t * 默认渲染器有可能会随着版本更新而更换\n\t */\n\tlyricPlayer: {\n\t\ttype: Object as PropType<{\n\t\t\tnew (...args: ConstructorParameters<typeof BaseRenderer>): BaseRenderer;\n\t\t}>,\n\t\trequired: false,\n\t},\n} as const;\n\n/**\n * 歌词播放组件的属性\n */\nexport type LyricPlayerProps = ExtractPublicPropTypes<typeof lyricPlayerProps>;\n\nconst lyricPlayerEmits = {\n\tlineClick: (_: LyricLineMouseEvent) => true,\n\tlineContextmenu: (_: LyricLineMouseEvent) => true,\n} as const;\n\n/**\n * 歌词播放组件的事件\n */\nexport type LyricPlayerEmits = typeof lyricPlayerEmits;\n\n/**\n * 歌词播放组件的引用\n */\nexport interface LyricPlayerRef {\n\t/**\n\t * 歌词播放实例\n\t */\n\tlyricPlayer: Ref<LyricPlayerBase | undefined>;\n\t/**\n\t * 将歌词播放实例的元素包裹起来的 DIV 元素实例\n\t */\n\twrapperEl: Readonly<ShallowRef<HTMLDivElement | null>>;\n}\n\nexport const LyricPlayer = defineComponent({\n\tname: \"LyricPlayer\",\n\tprops: lyricPlayerProps,\n\temits: lyricPlayerEmits,\n\tslots: Object as SlotsType<{\n\t\t\"bottom-line\": () => void;\n\t}>,\n\tsetup(props, { expose, emit, attrs, slots }) {\n\t\tconst wrapperRef = useTemplateRef<HTMLDivElement>(\"wrapper-ref\");\n\t\tconst playerRef = ref<CoreLyricPlayer>();\n\n\t\tconst lineClickHandler = (e: Event) =>\n\t\t\temit(\"lineClick\", e as LyricLineMouseEvent);\n\t\tconst lineContextMenuHandler = (e: Event) =>\n\t\t\temit(\"lineContextmenu\", e as LyricLineMouseEvent);\n\n\t\tonMounted(() => {\n\t\t\tconst wrapper = wrapperRef.value;\n\t\t\tif (wrapper) {\n\t\t\t\tplayerRef.value = new CoreLyricPlayer();\n\t\t\t\twrapper.appendChild(playerRef.value.getElement());\n\t\t\t\tplayerRef.value.addEventListener(\"line-click\", lineClickHandler);\n\t\t\t\tplayerRef.value.addEventListener(\n\t\t\t\t\t\"line-contextmenu\",\n\t\t\t\t\tlineContextMenuHandler,\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\n\t\tonUnmounted(() => {\n\t\t\tif (playerRef.value) {\n\t\t\t\tplayerRef.value.removeEventListener(\"line-click\", lineClickHandler);\n\t\t\t\tplayerRef.value.removeEventListener(\n\t\t\t\t\t\"line-contextmenu\",\n\t\t\t\t\tlineContextMenuHandler,\n\t\t\t\t);\n\t\t\t\tplayerRef.value.dispose();\n\t\t\t}\n\t\t});\n\n\t\twatchEffect((onCleanup) => {\n\t\t\tif (!props.disabled) {\n\t\t\t\tlet canceled = false;\n\t\t\t\tlet lastTime = -1;\n\t\t\t\tconst onFrame = (time: number) => {\n\t\t\t\t\tif (canceled) return;\n\t\t\t\t\tif (lastTime === -1) {\n\t\t\t\t\t\tlastTime = time;\n\t\t\t\t\t}\n\t\t\t\t\tplayerRef.value?.update(time - lastTime);\n\t\t\t\t\tlastTime = time;\n\t\t\t\t\trequestAnimationFrame(onFrame);\n\t\t\t\t};\n\t\t\t\trequestAnimationFrame(onFrame);\n\t\t\t\tonCleanup(() => {\n\t\t\t\t\tcanceled = true;\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.playing !== undefined) {\n\t\t\t\tif (props.playing) {\n\t\t\t\t\tplayerRef.value?.resume();\n\t\t\t\t} else {\n\t\t\t\t\tplayerRef.value?.pause();\n\t\t\t\t}\n\t\t\t} else playerRef.value?.resume();\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.alignAnchor !== undefined)\n\t\t\t\tplayerRef.value?.setAlignAnchor(props.alignAnchor);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.hidePassedLines !== undefined)\n\t\t\t\tplayerRef.value?.setHidePassedLines(props.hidePassedLines);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.maskObsceneWordsMode !== undefined)\n\t\t\t\tplayerRef.value?.setMaskObsceneWords(props.maskObsceneWordsMode);\n\t\t\telse playerRef.value?.setMaskObsceneWords(MaskObsceneWordsMode.Disabled);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.alignPosition !== undefined)\n\t\t\t\tplayerRef.value?.setAlignPosition(props.alignPosition);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.enableSpring !== undefined)\n\t\t\t\tplayerRef.value?.setEnableSpring(props.enableSpring);\n\t\t\telse playerRef.value?.setEnableSpring(true);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.enableBlur !== undefined)\n\t\t\t\tplayerRef.value?.setEnableBlur(props.enableBlur);\n\t\t\telse playerRef.value?.setEnableBlur(true);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.enableScale !== undefined)\n\t\t\t\tplayerRef.value?.setEnableScale(props.enableScale);\n\t\t\telse playerRef.value?.setEnableScale(true);\n\t\t});\n\n\t\twatch(\n\t\t\t[playerRef, () => props.lyricLines, () => props.optimizeOptions],\n\t\t\t([player, lyricLines, optimizeOptions]) => {\n\t\t\t\tif (!player) return;\n\n\t\t\t\tif (optimizeOptions !== undefined) {\n\t\t\t\t\tplayer.setOptimizeOptions(optimizeOptions);\n\t\t\t\t}\n\n\t\t\t\tif (lyricLines !== undefined) {\n\t\t\t\t\tplayer.setLyricLines(lyricLines);\n\t\t\t\t} else {\n\t\t\t\t\tplayer.setLyricLines([]);\n\t\t\t\t}\n\n\t\t\t\tif (props.currentTime !== undefined) {\n\t\t\t\t\tplayer.setCurrentTime(props.currentTime, true);\n\t\t\t\t}\n\t\t\t},\n\t\t\t{ immediate: true },\n\t\t);\n\n\t\twatchEffect(() => {\n\t\t\tif (props.currentTime !== undefined)\n\t\t\t\tplayerRef.value?.setCurrentTime(props.currentTime);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.wordFadeWidth !== undefined)\n\t\t\t\tplayerRef.value?.setWordFadeWidth(props.wordFadeWidth);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.linePosXSpringParams !== undefined)\n\t\t\t\tplayerRef.value?.setLinePosXSpringParams(props.linePosXSpringParams);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.linePosYSpringParams !== undefined)\n\t\t\t\tplayerRef.value?.setLinePosYSpringParams(props.linePosYSpringParams);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.lineScaleSpringParams !== undefined)\n\t\t\t\tplayerRef.value?.setLineScaleSpringParams(props.lineScaleSpringParams);\n\t\t});\n\n\t\tconst bottomLineEl = computed(() =>\n\t\t\tplayerRef.value?.getBottomLineElement(),\n\t\t);\n\n\t\texpose<LyricPlayerRef>({\n\t\t\tlyricPlayer: playerRef,\n\t\t\twrapperEl: wrapperRef,\n\t\t});\n\n\t\treturn () => (\n\t\t\t<div ref=\"wrapper-ref\" {...attrs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C;EAEF,aAAOyC,YAAA,OAAAC,WAAA,EAAA,OAAA,eAAA,EACqB3C,MAAK,EAAA,CAC9BwC,aAAahC,SAAKkC,YAAA9F,UAAA,EAAA,MACJ4F,aAAahC,OAAK,EAAA,EAAApD,eAAA,CAC9BwC,MAAM,kBAAkB,CAAA,EAAA,CAE1B,CAAA,CAEF;;CAEF,CAAC"}
|
|
1
|
+
{"version":3,"file":"amll-vue.mjs","names":[],"sources":["../src/BackgroundRender.tsx","../src/LyricPlayer.tsx"],"sourcesContent":["import {\n\ttype AbstractBaseRenderer,\n\ttype BaseRenderer,\n\tBackgroundRender as CoreBackgroundRender,\n\tMeshGradientRenderer,\n} from \"@applemusic-like-lyrics/core\";\nimport {\n\tdefineComponent,\n\ttype ExtractPublicPropTypes,\n\tonMounted,\n\tonUnmounted,\n\ttype PropType,\n\ttype Ref,\n\tref,\n\ttype ShallowRef,\n\tuseTemplateRef,\n\twatchEffect,\n} from \"vue\";\n\n/**\n * 背景渲染组件的引用\n */\nexport interface BackgroundRenderRef {\n\t/**\n\t * 背景渲染实例引用\n\t */\n\tbgRender?: Ref<AbstractBaseRenderer | undefined>;\n\t/**\n\t * 将背景渲染实例的元素包裹起来的 DIV 元素实例\n\t */\n\twrapperEl: Readonly<ShallowRef<HTMLDivElement | null>>;\n}\n\nconst backgroundRenderProps = {\n\t/**\n\t * 设置背景专辑资源\n\t */\n\talbum: {\n\t\ttype: [String, Object] as PropType<\n\t\t\tstring | HTMLImageElement | HTMLVideoElement\n\t\t>,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置专辑资源是否为视频\n\t */\n\talbumIsVideo: {\n\t\ttype: Boolean,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置当前背景动画帧率,如果为 `undefined` 则默认为 `30`\n\t */\n\tfps: {\n\t\ttype: Number,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置当前播放状态,如果为 `undefined` 则默认为 `true`\n\t */\n\tplaying: {\n\t\ttype: Boolean,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置当前动画流动速度,如果为 `undefined` 则默认为 `2`\n\t */\n\tflowSpeed: {\n\t\ttype: Number,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置背景是否根据“是否有歌词”这个特征调整自身效果,例如有歌词时会变得更加活跃\n\t *\n\t * 部分渲染器会根据这个特征调整自身效果\n\t *\n\t * 如果不确定是否需要赋值或无法知晓是否包含歌词,请传入 true 或不做任何处理(默认值为 true)\n\t */\n\thasLyric: {\n\t\ttype: Boolean,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置低频的音量大小,范围在 80hz-120hz 之间为宜,取值范围在 [0.0-1.0] 之间\n\t *\n\t * 部分渲染器会根据音量大小调整背景效果(例如根据鼓点跳动)\n\t *\n\t * 如果无法获取到类似的数据,请传入 undefined 或 1.0 作为默认值,或不做任何处理(默认值即 1.0)\n\t */\n\tlowFreqVolume: {\n\t\ttype: Number,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置当前渲染缩放比例,如果为 `undefined` 则默认为 `0.5`\n\t */\n\trenderScale: {\n\t\ttype: Number,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置渲染器,如果为 `undefined` 则默认为 `MeshGradientRenderer`\n\t * 默认渲染器有可能会随着版本更新而更换\n\t */\n\trenderer: {\n\t\ttype: Object as PropType<{\n\t\t\tnew (...args: ConstructorParameters<typeof BaseRenderer>): BaseRenderer;\n\t\t}>,\n\t\trequired: false,\n\t},\n} as const;\n\nexport type BackgroundRenderProps = ExtractPublicPropTypes<\n\ttypeof backgroundRenderProps\n>;\n\nexport const BackgroundRender = defineComponent({\n\tname: \"BackgroundRender\",\n\tprops: backgroundRenderProps,\n\tsetup(props, { expose }) {\n\t\tconst wrapperRef = useTemplateRef<HTMLDivElement>(\"wrapper-ref\");\n\t\tconst bgRenderRef = ref<AbstractBaseRenderer>();\n\n\t\tonMounted(() => {\n\t\t\tif (wrapperRef.value) {\n\t\t\t\tbgRenderRef.value = CoreBackgroundRender.new(\n\t\t\t\t\tprops.renderer ?? MeshGradientRenderer,\n\t\t\t\t);\n\t\t\t\tconst el = bgRenderRef.value.getElement();\n\t\t\t\tel.style.width = \"100%\";\n\t\t\t\tel.style.height = \"100%\";\n\t\t\t\twrapperRef.value.appendChild(el);\n\t\t\t}\n\t\t});\n\n\t\tonUnmounted(() => {\n\t\t\tif (bgRenderRef.value) {\n\t\t\t\tbgRenderRef.value.dispose();\n\t\t\t}\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.album)\n\t\t\t\tbgRenderRef.value?.setAlbum(props.album, props.albumIsVideo);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.fps) bgRenderRef.value?.setFPS(props.fps);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.playing) bgRenderRef.value?.pause();\n\t\t\telse bgRenderRef.value?.resume();\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.flowSpeed) bgRenderRef.value?.setFlowSpeed(props.flowSpeed);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.renderScale)\n\t\t\t\tbgRenderRef.value?.setRenderScale(props.renderScale);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.lowFreqVolume)\n\t\t\t\tbgRenderRef.value?.setLowFreqVolume(props.lowFreqVolume);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.hasLyric !== undefined)\n\t\t\t\tbgRenderRef.value?.setHasLyric(props.hasLyric ?? true);\n\t\t});\n\n\t\texpose<BackgroundRenderRef>({\n\t\t\tbgRender: bgRenderRef,\n\t\t\twrapperEl: wrapperRef,\n\t\t});\n\n\t\treturn () => <div style=\"display: contents;\" ref=\"wrapper-ref\" />;\n\t},\n});\n","import {\n\ttype BaseRenderer,\n\tLyricPlayer as CoreLyricPlayer,\n\ttype LyricLine,\n\ttype LyricLineMouseEvent,\n\ttype LyricPlayerBase,\n\tMaskObsceneWordsMode,\n\ttype OptimizeLyricOptions,\n\ttype spring,\n} from \"@applemusic-like-lyrics/core\";\nimport {\n\tcomputed,\n\tdefineComponent,\n\ttype ExtractPublicPropTypes,\n\tonMounted,\n\tonUnmounted,\n\ttype PropType,\n\ttype Ref,\n\tref,\n\ttype ShallowRef,\n\ttype SlotsType,\n\tTeleport,\n\tuseTemplateRef,\n\twatch,\n\twatchEffect,\n} from \"vue\";\n\nconst lyricPlayerProps = {\n\t/**\n\t * 是否禁用歌词播放组件,默认为 `false`,歌词组件启用后将会开始逐帧更新歌词的动画效果,并对传入的其他参数变更做出反馈。\n\t *\n\t * 如果禁用了歌词组件动画,你也可以通过引用取得原始渲染组件实例,手动逐帧调用其 `update` 函数来更新动画效果。\n\t */\n\tdisabled: {\n\t\ttype: Boolean,\n\t\tdefault: false,\n\t},\n\t/**\n\t * 是否演出部分效果,目前会控制播放间奏点的动画的播放暂停与否,默认为 `true`\n\t */\n\tplaying: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * 设置歌词行的对齐方式,如果为 `undefined` 则默认为 `center`\n\t *\n\t * - 设置成 `top` 的话将会向目标歌词行的顶部对齐\n\t * - 设置成 `bottom` 的话将会向目标歌词行的底部对齐\n\t * - 设置成 `center` 的话将会向目标歌词行的垂直中心对齐\n\t */\n\talignAnchor: {\n\t\ttype: String as PropType<\"top\" | \"bottom\" | \"center\">,\n\t\tdefault: \"center\",\n\t},\n\t/**\n\t * 设置默认的歌词行对齐位置,相对于整个歌词播放组件的大小位置,如果为 `undefined`\n\t * 则默认为 `0.5`\n\t *\n\t * 可以设置一个 `[0.0-1.0]` 之间的任意数字,代表组件高度由上到下的比例位置\n\t */\n\talignPosition: {\n\t\ttype: Number,\n\t\tdefault: 0.5,\n\t},\n\t/**\n\t * 设置是否使用物理弹簧算法实现歌词动画效果,默认启用\n\t *\n\t * 如果启用,则会通过弹簧算法实时处理歌词位置,但是需要性能足够强劲的电脑方可流畅运行\n\t *\n\t * 如果不启用,则会回退到基于 `transition` 的过渡效果,对低性能的机器比较友好,但是效果会比较单一\n\t */\n\tenableSpring: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * 设置是否启用歌词行的模糊效果,默认为 `true`\n\t */\n\tenableBlur: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * 设置是否使用物理弹簧算法实现歌词动画效果,默认启用\n\t *\n\t * 如果启用,则会通过弹簧算法实时处理歌词位置,但是需要性能足够强劲的电脑方可流畅运行\n\t *\n\t * 如果不启用,则会回退到基于 `transition` 的过渡效果,对低性能的机器比较友好,但是效果会比较单一\n\t */\n\tenableScale: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/**\n\t * 设置是否隐藏已经播放过的歌词行,默认不隐藏\n\t */\n\thidePassedLines: {\n\t\ttype: Boolean,\n\t\tdefault: false,\n\t},\n\t/**\n\t * 设置歌词中不雅用语的掩码模式,默认为 `MaskObsceneWordsMode.Disabled`,即不掩码\n\t */\n\tmaskObsceneWordsMode: {\n\t\ttype: String as PropType<MaskObsceneWordsMode>,\n\t\tdefault: MaskObsceneWordsMode.Disabled,\n\t},\n\t/**\n\t * 设置不雅用语掩码使用的字符,默认为 `*`\n\t */\n\tmaskObsceneWordChar: {\n\t\ttype: String,\n\t\tdefault: \"*\",\n\t},\n\t/**\n\t * 设置歌词优化选项\n\t */\n\toptimizeOptions: {\n\t\ttype: Object as PropType<OptimizeLyricOptions>,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置当前播放歌词,要注意传入后这个数组内的信息不得修改,否则会发生错误\n\t */\n\tlyricLines: {\n\t\ttype: Object as PropType<LyricLine[]>,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置当前播放进度,单位为毫秒且**必须是整数**,此时将会更新内部的歌词进度信息\n\t * 内部会根据调用间隔和播放进度自动决定如何滚动和显示歌词,所以这个的调用频率越快越准确越好\n\t */\n\tcurrentTime: {\n\t\ttype: Number,\n\t\tdefault: 0,\n\t},\n\t/**\n\t * 设置文字动画的渐变宽度,单位以歌词行的主文字字体大小的倍数为单位,默认为 0.5,即一个全角字符的一半宽度\n\t *\n\t * 如果要模拟 Apple Music for Android 的效果,可以设置为 1\n\t *\n\t * 如果要模拟 Apple Music for iPad 的效果,可以设置为 0.5\n\t *\n\t * 如果想要近乎禁用渐变效果,可以设置成非常接近 0 的小数(例如 `0.0001` ),但是**不可以为 0**\n\t */\n\twordFadeWidth: {\n\t\ttype: Number,\n\t\tdefault: 0.5,\n\t},\n\t/**\n\t * 设置所有歌词行在横坐标上的弹簧属性,包括重量、弹力和阻力。\n\t *\n\t * @param params 需要设置的弹簧属性,提供的属性将会覆盖原来的属性,未提供的属性将会保持原样\n\t */\n\tlinePosXSpringParams: {\n\t\ttype: Object as PropType<Partial<spring.SpringParams>>,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置所有歌词行在纵坐标上的弹簧属性,包括重量、弹力和阻力。\n\t *\n\t * @param params 需要设置的弹簧属性,提供的属性将会覆盖原来的属性,未提供的属性将会保持原样\n\t */\n\tlinePosYSpringParams: {\n\t\ttype: Object as PropType<Partial<spring.SpringParams>>,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置所有歌词行在缩放大小上的弹簧属性,包括重量、弹力和阻力。\n\t *\n\t * @param params 需要设置的弹簧属性,提供的属性将会覆盖原来的属性,未提供的属性将会保持原样\n\t */\n\tlineScaleSpringParams: {\n\t\ttype: Object as PropType<Partial<spring.SpringParams>>,\n\t\trequired: false,\n\t},\n\t/**\n\t * 设置渲染器,如果为 `undefined` 则默认为 `MeshGradientRenderer`\n\t * 默认渲染器有可能会随着版本更新而更换\n\t */\n\tlyricPlayer: {\n\t\ttype: Object as PropType<{\n\t\t\tnew (...args: ConstructorParameters<typeof BaseRenderer>): BaseRenderer;\n\t\t}>,\n\t\trequired: false,\n\t},\n} as const;\n\n/**\n * 歌词播放组件的属性\n */\nexport type LyricPlayerProps = ExtractPublicPropTypes<typeof lyricPlayerProps>;\n\nconst lyricPlayerEmits = {\n\tlineClick: (_: LyricLineMouseEvent) => true,\n\tlineContextmenu: (_: LyricLineMouseEvent) => true,\n} as const;\n\n/**\n * 歌词播放组件的事件\n */\nexport type LyricPlayerEmits = typeof lyricPlayerEmits;\n\n/**\n * 歌词播放组件的引用\n */\nexport interface LyricPlayerRef {\n\t/**\n\t * 歌词播放实例\n\t */\n\tlyricPlayer: Ref<LyricPlayerBase | undefined>;\n\t/**\n\t * 将歌词播放实例的元素包裹起来的 DIV 元素实例\n\t */\n\twrapperEl: Readonly<ShallowRef<HTMLDivElement | null>>;\n}\n\nexport const LyricPlayer = defineComponent({\n\tname: \"LyricPlayer\",\n\tprops: lyricPlayerProps,\n\temits: lyricPlayerEmits,\n\tslots: Object as SlotsType<{\n\t\t\"bottom-line\": () => void;\n\t}>,\n\tsetup(props, { expose, emit, attrs, slots }) {\n\t\tconst wrapperRef = useTemplateRef<HTMLDivElement>(\"wrapper-ref\");\n\t\tconst playerRef = ref<CoreLyricPlayer>();\n\t\tlet prevLyricLines: LyricLine[] | undefined;\n\n\t\tconst lineClickHandler = (e: Event) =>\n\t\t\temit(\"lineClick\", e as LyricLineMouseEvent);\n\t\tconst lineContextMenuHandler = (e: Event) =>\n\t\t\temit(\"lineContextmenu\", e as LyricLineMouseEvent);\n\n\t\tonMounted(() => {\n\t\t\tconst wrapper = wrapperRef.value;\n\t\t\tif (wrapper) {\n\t\t\t\tplayerRef.value = new CoreLyricPlayer();\n\t\t\t\twrapper.appendChild(playerRef.value.getElement());\n\t\t\t\tplayerRef.value.addEventListener(\"line-click\", lineClickHandler);\n\t\t\t\tplayerRef.value.addEventListener(\n\t\t\t\t\t\"line-contextmenu\",\n\t\t\t\t\tlineContextMenuHandler,\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\n\t\tonUnmounted(() => {\n\t\t\tif (playerRef.value) {\n\t\t\t\tplayerRef.value.removeEventListener(\"line-click\", lineClickHandler);\n\t\t\t\tplayerRef.value.removeEventListener(\n\t\t\t\t\t\"line-contextmenu\",\n\t\t\t\t\tlineContextMenuHandler,\n\t\t\t\t);\n\t\t\t\tplayerRef.value.dispose();\n\t\t\t}\n\t\t});\n\n\t\twatchEffect((onCleanup) => {\n\t\t\tif (!props.disabled) {\n\t\t\t\tlet canceled = false;\n\t\t\t\tlet lastTime = -1;\n\t\t\t\tconst onFrame = (time: number) => {\n\t\t\t\t\tif (canceled) return;\n\t\t\t\t\tif (lastTime === -1) {\n\t\t\t\t\t\tlastTime = time;\n\t\t\t\t\t}\n\t\t\t\t\tplayerRef.value?.update(time - lastTime);\n\t\t\t\t\tlastTime = time;\n\t\t\t\t\trequestAnimationFrame(onFrame);\n\t\t\t\t};\n\t\t\t\trequestAnimationFrame(onFrame);\n\t\t\t\tonCleanup(() => {\n\t\t\t\t\tcanceled = true;\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\twatch(\n\t\t\t[\n\t\t\t\tplayerRef,\n\t\t\t\t() => props.lyricLines,\n\t\t\t\t() => props.optimizeOptions,\n\t\t\t\t() => props.maskObsceneWordsMode,\n\t\t\t\t() => props.maskObsceneWordChar,\n\t\t\t],\n\t\t\t([player, lyricLines]) => {\n\t\t\t\tif (!player) return;\n\n\t\t\t\tconst isLyricLinesChanged = lyricLines !== prevLyricLines;\n\t\t\t\tprevLyricLines = lyricLines;\n\n\t\t\t\tif (isLyricLinesChanged) {\n\t\t\t\t\tplayer.setLyricProcessConfig({\n\t\t\t\t\t\toptimizeOptions: props.optimizeOptions,\n\t\t\t\t\t\tmaskMode: props.maskObsceneWordsMode,\n\t\t\t\t\t\tmaskChar: props.maskObsceneWordChar,\n\t\t\t\t\t});\n\t\t\t\t\tplayer.setLyricLines(lyricLines ?? []);\n\n\t\t\t\t\tif (props.currentTime !== undefined) {\n\t\t\t\t\t\tplayer.setCurrentTime(props.currentTime, true);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tplayer.updateLyricProcessConfig({\n\t\t\t\t\t\toptimizeOptions: props.optimizeOptions,\n\t\t\t\t\t\tmaskMode: props.maskObsceneWordsMode,\n\t\t\t\t\t\tmaskChar: props.maskObsceneWordChar,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t\t{ immediate: true },\n\t\t);\n\n\t\twatchEffect(() => {\n\t\t\tif (props.playing !== undefined) {\n\t\t\t\tif (props.playing) {\n\t\t\t\t\tplayerRef.value?.resume();\n\t\t\t\t} else {\n\t\t\t\t\tplayerRef.value?.pause();\n\t\t\t\t}\n\t\t\t} else playerRef.value?.resume();\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.alignAnchor !== undefined)\n\t\t\t\tplayerRef.value?.setAlignAnchor(props.alignAnchor);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.hidePassedLines !== undefined)\n\t\t\t\tplayerRef.value?.setHidePassedLines(props.hidePassedLines);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.alignPosition !== undefined)\n\t\t\t\tplayerRef.value?.setAlignPosition(props.alignPosition);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.enableSpring !== undefined)\n\t\t\t\tplayerRef.value?.setEnableSpring(props.enableSpring);\n\t\t\telse playerRef.value?.setEnableSpring(true);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.enableBlur !== undefined)\n\t\t\t\tplayerRef.value?.setEnableBlur(props.enableBlur);\n\t\t\telse playerRef.value?.setEnableBlur(true);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.enableScale !== undefined)\n\t\t\t\tplayerRef.value?.setEnableScale(props.enableScale);\n\t\t\telse playerRef.value?.setEnableScale(true);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.currentTime !== undefined)\n\t\t\t\tplayerRef.value?.setCurrentTime(props.currentTime);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.wordFadeWidth !== undefined)\n\t\t\t\tplayerRef.value?.setWordFadeWidth(props.wordFadeWidth);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.linePosXSpringParams !== undefined)\n\t\t\t\tplayerRef.value?.setLinePosXSpringParams(props.linePosXSpringParams);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.linePosYSpringParams !== undefined)\n\t\t\t\tplayerRef.value?.setLinePosYSpringParams(props.linePosYSpringParams);\n\t\t});\n\n\t\twatchEffect(() => {\n\t\t\tif (props.lineScaleSpringParams !== undefined)\n\t\t\t\tplayerRef.value?.setLineScaleSpringParams(props.lineScaleSpringParams);\n\t\t});\n\n\t\tconst bottomLineEl = computed(() =>\n\t\t\tplayerRef.value?.getBottomLineElement(),\n\t\t);\n\n\t\texpose<LyricPlayerRef>({\n\t\t\tlyricPlayer: playerRef,\n\t\t\twrapperEl: wrapperRef,\n\t\t});\n\n\t\treturn () => (\n\t\t\t<div ref=\"wrapper-ref\" {...attrs}>\n\t\t\t\t{bottomLineEl.value && (\n\t\t\t\t\t<Teleport to={bottomLineEl.value}>\n\t\t\t\t\t\t{slots[\"bottom-line\"]?.()}\n\t\t\t\t\t</Teleport>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t);\n\t},\n});\n"],"mappings":";;AAoHA,MAAa,mBAAmB,gBAAgB;CAC/C,MAAM;CACN,OAAO;;;;EAjFP,OAAO;GACN,MAAM,CAAC,QAAQ,MAAM;GAGrB,UAAU;EACX;;;;EAIA,cAAc;GACb,MAAM;GACN,UAAU;EACX;;;;EAIA,KAAK;GACJ,MAAM;GACN,UAAU;EACX;;;;EAIA,SAAS;GACR,MAAM;GACN,UAAU;EACX;;;;EAIA,WAAW;GACV,MAAM;GACN,UAAU;EACX;;;;;;;;EAQA,UAAU;GACT,MAAM;GACN,UAAU;EACX;;;;;;;;EAQA,eAAe;GACd,MAAM;GACN,UAAU;EACX;;;;EAIA,aAAa;GACZ,MAAM;GACN,UAAU;EACX;;;;;EAKA,UAAU;GACT,MAAM;GAGN,UAAU;EACX;CASO;CACP,MAAM,OAAO,EAAE,UAAU;EACxB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A,cAAA,GACqB,KAAK,GAAA,CAC9B,aAAa,SAAK,YAAA,UAAA,EAAA,MACJ,aAAa,MAAK,GAAA,EAAA,eAAA,CAC9B,MAAM,cAAc,GAAG,CAAC,EAAA,CAAA,CAE1B,CAAA;CAGJ;AACD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applemusic-like-lyrics/vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "AMLL 组件库的 Vue 绑定",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/amll-dev/applemusic-like-lyrics.git",
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@applemusic-like-lyrics/core": "^0.
|
|
42
|
+
"@applemusic-like-lyrics/core": "^0.6.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"vue": "*"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@biomejs/biome": "^2.
|
|
48
|
+
"@biomejs/biome": "^2.5.7",
|
|
49
49
|
"@pixi/app": "^7.4.3",
|
|
50
50
|
"@pixi/core": "^7.4.3",
|
|
51
51
|
"@pixi/display": "^7.4.3",
|
|
@@ -53,12 +53,12 @@
|
|
|
53
53
|
"@pixi/filter-color-matrix": "^7.4.3",
|
|
54
54
|
"@pixi/sprite": "^7.4.3",
|
|
55
55
|
"@rolldown/plugin-babel": "^0.2.3",
|
|
56
|
-
"@vue/babel-plugin-jsx": "^
|
|
57
|
-
"tsdown": "^0.22.
|
|
56
|
+
"@vue/babel-plugin-jsx": "^3.0.0",
|
|
57
|
+
"tsdown": "^0.22.14",
|
|
58
58
|
"typedoc": "^0.28.17",
|
|
59
|
-
"typedoc-plugin-markdown": "^4.
|
|
60
|
-
"vue": "^3.5.
|
|
61
|
-
"@applemusic-like-lyrics/core": "^0.
|
|
59
|
+
"typedoc-plugin-markdown": "^4.12.0",
|
|
60
|
+
"vue": "^3.5.41",
|
|
61
|
+
"@applemusic-like-lyrics/core": "^0.6.0"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|
|
64
64
|
"typecheck": "tsgo -b",
|