@applemusic-like-lyrics/react 0.0.2
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 +29 -0
- package/dist/amll-react.js +1 -0
- package/dist/amll-react.mjs +106 -0
- package/dist/bg-render.d.ts +44 -0
- package/dist/index.d.ts +2 -0
- package/dist/lyric-player.d.ts +79 -0
- package/package.json +42 -0
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# AMLL for React
|
|
2
|
+
|
|
3
|
+
AMLL 组件库的 React 绑定,你可以通过此库来更加方便地使用 AMLL 歌词组件。
|
|
4
|
+
|
|
5
|
+
详情可以访问 [Core 核心组件的 README.md](../core/README.md)。
|
|
6
|
+
|
|
7
|
+
## 安装
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @applemusic-like-lyrics/react # 使用 npm
|
|
11
|
+
yarn add @applemusic-like-lyrics/react # 使用 yarn
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## 使用方式摘要
|
|
15
|
+
|
|
16
|
+
详细的 API 文档请参考 [./docs/modules.md](./docs/modules.md)
|
|
17
|
+
|
|
18
|
+
一个测试用途的程序可以在 [./src/test.tsx](./src/test.tsx) 里找到。
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import { LyricPlayer } from "@applemusic-like-lyrics/react";
|
|
22
|
+
|
|
23
|
+
const App = () => {
|
|
24
|
+
const [currentTime, setCurrentTime] = useState(0);
|
|
25
|
+
const [lyricLines, setLyricLines] = useState<LyricLine[]>([]);
|
|
26
|
+
return <LyricPlayer lyricLines={lyricLines} currentTime={currentTime} />
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),v=require("@applemusic-like-lyrics/core"),r=require("react"),q=r.forwardRef(({albumImageUrl:i,fps:d,playing:o,flowSpeed:a,renderScale:E,...l},p)=>{const c=r.useRef(),f=r.useRef(null);return r.useEffect(()=>(c.current=new v.BackgroundRender,()=>{var u;(u=c.current)==null||u.dispose()}),[]),r.useEffect(()=>{var u;i&&((u=c.current)==null||u.setAlbumImage(i))},[i]),r.useEffect(()=>{var u;d&&((u=c.current)==null||u.setFPS(d))},[d]),r.useEffect(()=>{var u,s,t;o===void 0?(u=c.current)==null||u.resume():o?(s=c.current)==null||s.resume():(t=c.current)==null||t.pause()},[o]),r.useEffect(()=>{var u;a&&((u=c.current)==null||u.setFlowSpeed(a))},[a]),r.useEffect(()=>{var u;E&&((u=c.current)==null||u.setRenderScale(E))},[E]),r.useEffect(()=>{var u;if(c.current){const s=c.current.getElement();s.style.width="100%",s.style.height="100%",(u=f.current)==null||u.appendChild(s)}}),r.useImperativeHandle(p,()=>({wrapperEl:f.current,bgRender:c.current}),[f.current,c.current]),m.jsx("div",{...l,ref:f})}),F=r.forwardRef(({enable:i,alignAnchor:d,enableSpring:o,enableBlur:a,lyricLines:E,currentTime:l,linePosXSpringParams:p,linePosYSpringParams:c,lineScaleSpringParams:f,...u},s)=>{const t=r.useRef(),y=r.useRef(null);return r.useEffect(()=>(t.current=new v.LyricPlayer,()=>{var e;(e=t.current)==null||e.dispose()}),[]),r.useEffect(()=>{if(i!==void 0&&i){let e=!1,n=-1;const w=R=>{var L;e||(n===-1&&(n=R),(L=t.current)==null||L.update(R-n),n=R,requestAnimationFrame(w))};return requestAnimationFrame(w),()=>{e=!0}}},[i]),r.useEffect(()=>{var e;t.current&&((e=y.current)==null||e.appendChild(t.current.getElement()))},[y.current]),r.useEffect(()=>{var e;d&&((e=t.current)==null||e.setAlignAnchor(d))},[d]),r.useEffect(()=>{var e,n;o?(e=t.current)==null||e.setEnableSpring(o):(n=t.current)==null||n.setEnableSpring(!0)},[o]),r.useEffect(()=>{var e;(e=t.current)==null||e.setEnableBlur(a??!0)},[a]),r.useEffect(()=>{var e,n,w,R;E?((e=t.current)==null||e.setLyricLines(E),(n=t.current)==null||n.update()):((w=t.current)==null||w.setLyricLines([]),(R=t.current)==null||R.update())},[E]),r.useEffect(()=>{var e,n;l?(e=t.current)==null||e.setCurrentTime(l):(n=t.current)==null||n.setCurrentTime(0)},[l]),r.useEffect(()=>{var e;p&&((e=t.current)==null||e.setLinePosXSpringParams(p))},[p]),r.useEffect(()=>{var e;c&&((e=t.current)==null||e.setLinePosYSpringParams(c))},[c]),r.useEffect(()=>{var e;f&&((e=t.current)==null||e.setLineScaleSpringParams(f))},[f]),r.useImperativeHandle(s,()=>({wrapperEl:y.current,lyricPlayer:t.current}),[y.current,t.current]),m.jsx("div",{...u,ref:y})});exports.BackgroundRender=q;exports.LyricPlayer=F;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { jsx as v } from "react/jsx-runtime";
|
|
2
|
+
import { BackgroundRender as B, LyricPlayer as C } from "@applemusic-like-lyrics/core";
|
|
3
|
+
import { forwardRef as F, useRef as L, useEffect as n, useImperativeHandle as h } from "react";
|
|
4
|
+
const x = F(({ albumImageUrl: f, fps: o, playing: d, flowSpeed: a, renderScale: p, ...l }, m) => {
|
|
5
|
+
const u = L(), s = L(null);
|
|
6
|
+
return n(() => (u.current = new B(), () => {
|
|
7
|
+
var t;
|
|
8
|
+
(t = u.current) == null || t.dispose();
|
|
9
|
+
}), []), n(() => {
|
|
10
|
+
var t;
|
|
11
|
+
f && ((t = u.current) == null || t.setAlbumImage(f));
|
|
12
|
+
}, [f]), n(() => {
|
|
13
|
+
var t;
|
|
14
|
+
o && ((t = u.current) == null || t.setFPS(o));
|
|
15
|
+
}, [o]), n(() => {
|
|
16
|
+
var t, i, r;
|
|
17
|
+
d === void 0 ? (t = u.current) == null || t.resume() : d ? (i = u.current) == null || i.resume() : (r = u.current) == null || r.pause();
|
|
18
|
+
}, [d]), n(() => {
|
|
19
|
+
var t;
|
|
20
|
+
a && ((t = u.current) == null || t.setFlowSpeed(a));
|
|
21
|
+
}, [a]), n(() => {
|
|
22
|
+
var t;
|
|
23
|
+
p && ((t = u.current) == null || t.setRenderScale(p));
|
|
24
|
+
}, [p]), n(() => {
|
|
25
|
+
var t;
|
|
26
|
+
if (u.current) {
|
|
27
|
+
const i = u.current.getElement();
|
|
28
|
+
i.style.width = "100%", i.style.height = "100%", (t = s.current) == null || t.appendChild(i);
|
|
29
|
+
}
|
|
30
|
+
}), h(
|
|
31
|
+
m,
|
|
32
|
+
() => ({
|
|
33
|
+
wrapperEl: s.current,
|
|
34
|
+
bgRender: u.current
|
|
35
|
+
}),
|
|
36
|
+
[s.current, u.current]
|
|
37
|
+
), /* @__PURE__ */ v("div", { ...l, ref: s });
|
|
38
|
+
}), $ = F(
|
|
39
|
+
({
|
|
40
|
+
enable: f,
|
|
41
|
+
alignAnchor: o,
|
|
42
|
+
enableSpring: d,
|
|
43
|
+
enableBlur: a,
|
|
44
|
+
lyricLines: p,
|
|
45
|
+
currentTime: l,
|
|
46
|
+
linePosXSpringParams: m,
|
|
47
|
+
linePosYSpringParams: u,
|
|
48
|
+
lineScaleSpringParams: s,
|
|
49
|
+
...t
|
|
50
|
+
}, i) => {
|
|
51
|
+
const r = L(), y = L(null);
|
|
52
|
+
return n(() => (r.current = new C(), () => {
|
|
53
|
+
var e;
|
|
54
|
+
(e = r.current) == null || e.dispose();
|
|
55
|
+
}), []), n(() => {
|
|
56
|
+
if (f !== void 0 && f) {
|
|
57
|
+
let e = !1, c = -1;
|
|
58
|
+
const E = (R) => {
|
|
59
|
+
var w;
|
|
60
|
+
e || (c === -1 && (c = R), (w = r.current) == null || w.update(R - c), c = R, requestAnimationFrame(E));
|
|
61
|
+
};
|
|
62
|
+
return requestAnimationFrame(E), () => {
|
|
63
|
+
e = !0;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}, [f]), n(() => {
|
|
67
|
+
var e;
|
|
68
|
+
r.current && ((e = y.current) == null || e.appendChild(r.current.getElement()));
|
|
69
|
+
}, [y.current]), n(() => {
|
|
70
|
+
var e;
|
|
71
|
+
o && ((e = r.current) == null || e.setAlignAnchor(o));
|
|
72
|
+
}, [o]), n(() => {
|
|
73
|
+
var e, c;
|
|
74
|
+
d ? (e = r.current) == null || e.setEnableSpring(d) : (c = r.current) == null || c.setEnableSpring(!0);
|
|
75
|
+
}, [d]), n(() => {
|
|
76
|
+
var e;
|
|
77
|
+
(e = r.current) == null || e.setEnableBlur(a ?? !0);
|
|
78
|
+
}, [a]), n(() => {
|
|
79
|
+
var e, c, E, R;
|
|
80
|
+
p ? ((e = r.current) == null || e.setLyricLines(p), (c = r.current) == null || c.update()) : ((E = r.current) == null || E.setLyricLines([]), (R = r.current) == null || R.update());
|
|
81
|
+
}, [p]), n(() => {
|
|
82
|
+
var e, c;
|
|
83
|
+
l ? (e = r.current) == null || e.setCurrentTime(l) : (c = r.current) == null || c.setCurrentTime(0);
|
|
84
|
+
}, [l]), n(() => {
|
|
85
|
+
var e;
|
|
86
|
+
m && ((e = r.current) == null || e.setLinePosXSpringParams(m));
|
|
87
|
+
}, [m]), n(() => {
|
|
88
|
+
var e;
|
|
89
|
+
u && ((e = r.current) == null || e.setLinePosYSpringParams(u));
|
|
90
|
+
}, [u]), n(() => {
|
|
91
|
+
var e;
|
|
92
|
+
s && ((e = r.current) == null || e.setLineScaleSpringParams(s));
|
|
93
|
+
}, [s]), h(
|
|
94
|
+
i,
|
|
95
|
+
() => ({
|
|
96
|
+
wrapperEl: y.current,
|
|
97
|
+
lyricPlayer: r.current
|
|
98
|
+
}),
|
|
99
|
+
[y.current, r.current]
|
|
100
|
+
), /* @__PURE__ */ v("div", { ...t, ref: y });
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
export {
|
|
104
|
+
x as BackgroundRender,
|
|
105
|
+
$ as LyricPlayer
|
|
106
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { BackgroundRender as CoreBackgroundRender } from "@applemusic-like-lyrics/core";
|
|
2
|
+
import { type HTMLProps } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* 背景渲染组件的属性
|
|
5
|
+
*/
|
|
6
|
+
export interface BackgroundRenderProps {
|
|
7
|
+
/**
|
|
8
|
+
* 设置背景专辑图片
|
|
9
|
+
*/
|
|
10
|
+
albumImageUrl?: string;
|
|
11
|
+
/**
|
|
12
|
+
* 设置当前背景动画帧率,如果为 `undefined` 则默认为 `30`
|
|
13
|
+
*/
|
|
14
|
+
fps?: number;
|
|
15
|
+
/**
|
|
16
|
+
* 设置当前播放状态,如果为 `undefined` 则默认为 `true`
|
|
17
|
+
*/
|
|
18
|
+
playing?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* 设置当前动画流动速度,如果为 `undefined` 则默认为 `2`
|
|
21
|
+
*/
|
|
22
|
+
flowSpeed?: number;
|
|
23
|
+
/**
|
|
24
|
+
* 设置当前渲染缩放比例,如果为 `undefined` 则默认为 `0.5`
|
|
25
|
+
*/
|
|
26
|
+
renderScale?: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 背景渲染组件的引用
|
|
30
|
+
*/
|
|
31
|
+
export interface BackgroundRenderRef {
|
|
32
|
+
/**
|
|
33
|
+
* 背景渲染实例引用
|
|
34
|
+
*/
|
|
35
|
+
bgRender?: CoreBackgroundRender;
|
|
36
|
+
/**
|
|
37
|
+
* 将背景渲染实例的元素包裹起来的 DIV 元素实例
|
|
38
|
+
*/
|
|
39
|
+
wrapperEl: HTMLDivElement | null;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 流体背景渲染组件,通过提供图片链接可以显示出酷似 Apple Music 的流体背景效果
|
|
43
|
+
*/
|
|
44
|
+
export declare const BackgroundRender: import("react").ForwardRefExoticComponent<Pick<HTMLProps<HTMLDivElement> & BackgroundRenderProps, "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "cite" | "classID" | "cols" | "colSpan" | "content" | "controls" | "coords" | "crossOrigin" | "data" | "dateTime" | "default" | "defer" | "disabled" | "download" | "encType" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "label" | "list" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "name" | "noValidate" | "open" | "optimum" | "pattern" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "size" | "sizes" | "span" | "src" | "srcDoc" | "srcLang" | "srcSet" | "start" | "step" | "summary" | "target" | "type" | "useMap" | "value" | "width" | "wmode" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | keyof BackgroundRenderProps> & import("react").RefAttributes<BackgroundRenderRef>>;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { LyricPlayer as CoreLyricPlayer, type LyricLine, type spring } from "@applemusic-like-lyrics/core";
|
|
2
|
+
import { type HTMLProps } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* 歌词播放组件的属性
|
|
5
|
+
*/
|
|
6
|
+
export interface LyricPlayerProps {
|
|
7
|
+
/**
|
|
8
|
+
* 是否启用歌词播放组件,默认为 `true`,设置为 `true` 将会开始逐帧更新歌词的动画效果,并对传入的其他参数变更做出反馈。
|
|
9
|
+
*
|
|
10
|
+
* 如果不设置该选项,你也可以通过引用取得原始渲染组件实例,手动逐帧调用其 `update` 函数来更新动画效果。
|
|
11
|
+
*/
|
|
12
|
+
enable?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* 设置歌词行的对齐方式,如果为 `undefined` 则默认为 `top`
|
|
15
|
+
*
|
|
16
|
+
* - 设置成 `top` 的话歌词将会向组件顶部对齐
|
|
17
|
+
* - 设置成 `bottom` 的话歌词将会向组件底部对齐
|
|
18
|
+
* - 设置成 [0.0-1.0] 之间任意数字的话则会根据当前组件高度从顶部向下位移为对齐位置垂直居中对齐
|
|
19
|
+
*/
|
|
20
|
+
alignAnchor?: "top" | "bottom" | number;
|
|
21
|
+
/**
|
|
22
|
+
* 设置是否使用物理弹簧算法实现歌词动画效果,默认启用
|
|
23
|
+
*
|
|
24
|
+
* 如果启用,则会通过弹簧算法实时处理歌词位置,但是需要性能足够强劲的电脑方可流畅运行
|
|
25
|
+
*
|
|
26
|
+
* 如果不启用,则会回退到基于 `transition` 的过渡效果,对低性能的机器比较友好,但是效果会比较单一
|
|
27
|
+
*/
|
|
28
|
+
enableSpring?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* 设置是否启用歌词行的模糊效果,默认为 `true`
|
|
31
|
+
*/
|
|
32
|
+
enableBlur?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* 设置当前播放歌词,要注意传入后这个数组内的信息不得修改,否则会发生错误
|
|
35
|
+
*/
|
|
36
|
+
lyricLines?: LyricLine[];
|
|
37
|
+
/**
|
|
38
|
+
* 设置当前播放进度,单位为毫秒且**必须是整数**,此时将会更新内部的歌词进度信息
|
|
39
|
+
* 内部会根据调用间隔和播放进度自动决定如何滚动和显示歌词,所以这个的调用频率越快越准确越好
|
|
40
|
+
*/
|
|
41
|
+
currentTime?: number;
|
|
42
|
+
/**
|
|
43
|
+
* 设置所有歌词行在横坐标上的弹簧属性,包括重量、弹力和阻力。
|
|
44
|
+
*
|
|
45
|
+
* @param params 需要设置的弹簧属性,提供的属性将会覆盖原来的属性,未提供的属性将会保持原样
|
|
46
|
+
*/
|
|
47
|
+
linePosXSpringParams?: Partial<spring.SpringParams>;
|
|
48
|
+
/**
|
|
49
|
+
* 设置所有歌词行在纵坐标上的弹簧属性,包括重量、弹力和阻力。
|
|
50
|
+
*
|
|
51
|
+
* @param params 需要设置的弹簧属性,提供的属性将会覆盖原来的属性,未提供的属性将会保持原样
|
|
52
|
+
*/
|
|
53
|
+
linePosYSpringParams?: Partial<spring.SpringParams>;
|
|
54
|
+
/**
|
|
55
|
+
* 设置所有歌词行在缩放大小上的弹簧属性,包括重量、弹力和阻力。
|
|
56
|
+
*
|
|
57
|
+
* @param params 需要设置的弹簧属性,提供的属性将会覆盖原来的属性,未提供的属性将会保持原样
|
|
58
|
+
*/
|
|
59
|
+
lineScaleSpringParams?: Partial<spring.SpringParams>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* 歌词播放组件的引用
|
|
63
|
+
*/
|
|
64
|
+
export interface LyricPlayerRef {
|
|
65
|
+
/**
|
|
66
|
+
* 歌词播放实例
|
|
67
|
+
*/
|
|
68
|
+
lyricPlayer?: CoreLyricPlayer;
|
|
69
|
+
/**
|
|
70
|
+
* 将歌词播放实例的元素包裹起来的 DIV 元素实例
|
|
71
|
+
*/
|
|
72
|
+
wrapperEl: HTMLDivElement | null;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* 歌词播放组件,本框架的核心组件
|
|
76
|
+
*
|
|
77
|
+
* 尽可能贴切 Apple Music for iPad 的歌词效果设计,且做了力所能及的优化措施
|
|
78
|
+
*/
|
|
79
|
+
export declare const LyricPlayer: import("react").ForwardRefExoticComponent<Pick<HTMLProps<HTMLDivElement> & LyricPlayerProps, "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "cite" | "classID" | "cols" | "colSpan" | "content" | "controls" | "coords" | "crossOrigin" | "data" | "dateTime" | "default" | "defer" | "disabled" | "download" | "encType" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "label" | "list" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "name" | "noValidate" | "open" | "optimum" | "pattern" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "size" | "sizes" | "span" | "src" | "srcDoc" | "srcLang" | "srcSet" | "start" | "step" | "summary" | "target" | "type" | "useMap" | "value" | "width" | "wmode" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | keyof LyricPlayerProps> & import("react").RefAttributes<LyricPlayerRef>>;
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@applemusic-like-lyrics/react",
|
|
3
|
+
"packageManager": "yarn@3.6.1",
|
|
4
|
+
"version": "0.0.2",
|
|
5
|
+
"repository": {
|
|
6
|
+
"url": "https://github.com/Steve-xmh/applemusic-like-lyrics.git",
|
|
7
|
+
"directory": "packages/react",
|
|
8
|
+
"type": "git"
|
|
9
|
+
},
|
|
10
|
+
"license": "GPL-3.0",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build:docs": "typedoc --plugin typedoc-plugin-markdown --out docs src/index.ts",
|
|
16
|
+
"build": "vite build",
|
|
17
|
+
"fmt": "rome format --write ./src",
|
|
18
|
+
"dev": "vite dev"
|
|
19
|
+
},
|
|
20
|
+
"main": "./dist/amll-react.cjs",
|
|
21
|
+
"module": "./dist/amll-react.mjs",
|
|
22
|
+
"typings": "./dist/index.d.ts",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"import": "./dist/amll-react.mjs",
|
|
26
|
+
"require": "./dist/amll-react.cjs"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@vitejs/plugin-react": "^4.0.3",
|
|
31
|
+
"react-dom": "^18.2.0",
|
|
32
|
+
"rome": "^12.1.3",
|
|
33
|
+
"typedoc": "^0.24.8",
|
|
34
|
+
"typedoc-plugin-markdown": "^3.15.3",
|
|
35
|
+
"vite": "^4.4.6",
|
|
36
|
+
"vite-plugin-dts": "^3.3.1"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@applemusic-like-lyrics/core": "^0.0.2",
|
|
40
|
+
"react": "^18.2.0"
|
|
41
|
+
}
|
|
42
|
+
}
|