twist-aplayer 1.4.6 → 1.4.8
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/LICENSE.md +20 -20
- package/README.md +139 -139
- package/dist/index.d.ts +2 -2
- package/dist/index.js +13 -21
- package/dist/index.min.css +1 -1
- package/dist/index.mjs +1081 -1430
- package/dist/twist-aplayer.umd.js +13 -21
- package/package.json +80 -80
package/LICENSE.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright © 2025-present razzh (https://github.com/razzh7)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright © 2025-present razzh (https://github.com/razzh7)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE
|
package/README.md
CHANGED
|
@@ -1,139 +1,139 @@
|
|
|
1
|
-
# twist-aplayer
|
|
2
|
-
|
|
3
|
-
<p align="center">
|
|
4
|
-
<img src="https://assets.razzh.cn/aplayer/aplayer.svg" alt="twist aplayer" width="100">
|
|
5
|
-
</p>
|
|
6
|
-
<h1 align="center">Twist APlayer</h1>
|
|
7
|
-
|
|
8
|
-
> A shadcn ui theme aplayer for your React application.
|
|
9
|
-
|
|
10
|
-

|
|
11
|
-
|
|
12
|
-

|
|
13
|
-
|
|
14
|
-
## Features
|
|
15
|
-
|
|
16
|
-
Twist Aplayer supports:
|
|
17
|
-
- Mini mode
|
|
18
|
-
- Playlist - Lyrics
|
|
19
|
-
- Light or dark theme switch
|
|
20
|
-
- Custom theme color with component-level variables
|
|
21
|
-
- SSR compatibility
|
|
22
|
-
- Accessible friendly
|
|
23
|
-
|
|
24
|
-
Twist Aplayer icons powered by [twist-icons](https://github.com/twist-space/twist-icons) !
|
|
25
|
-
|
|
26
|
-
## Usage
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
npm i twist-aplayer
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
Import TwistAPlayer component from twist-aplayer package, and import stylesheet.
|
|
33
|
-
|
|
34
|
-
```tsx
|
|
35
|
-
import { TwistAPlayer } from 'twist-aplayer';
|
|
36
|
-
import 'twist-aplayer/dist/index.min.css';
|
|
37
|
-
|
|
38
|
-
render(
|
|
39
|
-
<TwistAPlayer
|
|
40
|
-
audio={{
|
|
41
|
-
name: 'ヘリオス',
|
|
42
|
-
artist: 'Helios',
|
|
43
|
-
url: 'https://music.163.com/#/song?id=1919555788&userid=122967305',
|
|
44
|
-
}}
|
|
45
|
-
theme="dark"
|
|
46
|
-
/>
|
|
47
|
-
);
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### Interface
|
|
51
|
-
|
|
52
|
-
```ts
|
|
53
|
-
export interface AudioInfo {
|
|
54
|
-
name?: string;
|
|
55
|
-
artist?: string | ArtistInfo;
|
|
56
|
-
url: string;
|
|
57
|
-
cover?: string;
|
|
58
|
-
lrc?: string;
|
|
59
|
-
theme?: string;
|
|
60
|
-
type?: 'auto' | 'hls' | 'normal';
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface ArtistInfo {
|
|
64
|
-
name?: string;
|
|
65
|
-
url?: string;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export interface TwistAPlayerProps {
|
|
69
|
-
/**
|
|
70
|
-
* @description audio info, should be an object or object array
|
|
71
|
-
*/
|
|
72
|
-
audio: AudioInfo | readonly AudioInfo[];
|
|
73
|
-
/**
|
|
74
|
-
* Initial volume
|
|
75
|
-
* @description default volume
|
|
76
|
-
* @default 0.7
|
|
77
|
-
*/
|
|
78
|
-
volume?: number;
|
|
79
|
-
/**
|
|
80
|
-
* @description values: 'normal', 'fixed'
|
|
81
|
-
* @default "normal"
|
|
82
|
-
*/
|
|
83
|
-
appearance?: 'normal' | 'fixed';
|
|
84
|
-
/**
|
|
85
|
-
* @description values: 'all' | 'one' | 'none'
|
|
86
|
-
* @default "all"
|
|
87
|
-
*/
|
|
88
|
-
initialLoop?: PlaylistLoop;
|
|
89
|
-
/**
|
|
90
|
-
* @description values: 'list' | 'random'
|
|
91
|
-
* @default "list"
|
|
92
|
-
*/
|
|
93
|
-
initialOrder?: PlaylistOrder;
|
|
94
|
-
/**
|
|
95
|
-
* @description audio autoplay
|
|
96
|
-
* @default false
|
|
97
|
-
*/
|
|
98
|
-
autoPlay?: boolean;
|
|
99
|
-
/**
|
|
100
|
-
* @description list max height
|
|
101
|
-
* @default 250
|
|
102
|
-
*/
|
|
103
|
-
listMaxHeight?: number;
|
|
104
|
-
/**
|
|
105
|
-
* @description enable mini mode
|
|
106
|
-
* @default false
|
|
107
|
-
*/
|
|
108
|
-
mini?: boolean;
|
|
109
|
-
/**
|
|
110
|
-
* @default prevent to play multiple player at the same time, pause other players when this player start play
|
|
111
|
-
* @default true
|
|
112
|
-
*/
|
|
113
|
-
mutex?: boolean;
|
|
114
|
-
/**
|
|
115
|
-
* @description indicate whether list should folded at first
|
|
116
|
-
* @default false
|
|
117
|
-
*/
|
|
118
|
-
listFolded?: boolean;
|
|
119
|
-
/**
|
|
120
|
-
* @description player theme, values: light, dark
|
|
121
|
-
* @default light
|
|
122
|
-
*/
|
|
123
|
-
theme?: 'light' | 'dark';
|
|
124
|
-
/**
|
|
125
|
-
* @description user border, it can accent border if use dark mode.
|
|
126
|
-
* @default false
|
|
127
|
-
*/
|
|
128
|
-
border?: boolean;
|
|
129
|
-
}
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
## How to make LRC?
|
|
133
|
-
I recommand [LRC generator site](https://www.lrcgenerator.com/), it can easy to make LRC!
|
|
134
|
-
|
|
135
|
-
## Credits
|
|
136
|
-
|
|
137
|
-
The implementation of this project is inspired by the following prior art project:
|
|
138
|
-
- [aplayer-react](https://github.com/SevenOutman/aplayer-react)
|
|
139
|
-
- [aplayer](https://github.com/DIYgod/APlayer)
|
|
1
|
+
# twist-aplayer
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://assets.razzh.cn/aplayer/aplayer.svg" alt="twist aplayer" width="100">
|
|
5
|
+
</p>
|
|
6
|
+
<h1 align="center">Twist APlayer</h1>
|
|
7
|
+
|
|
8
|
+
> A shadcn ui theme aplayer for your React application.
|
|
9
|
+
|
|
10
|
+

|
|
11
|
+
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
|
|
16
|
+
Twist Aplayer supports:
|
|
17
|
+
- Mini mode
|
|
18
|
+
- Playlist - Lyrics
|
|
19
|
+
- Light or dark theme switch
|
|
20
|
+
- Custom theme color with component-level variables
|
|
21
|
+
- SSR compatibility
|
|
22
|
+
- Accessible friendly
|
|
23
|
+
|
|
24
|
+
Twist Aplayer icons powered by [twist-icons](https://github.com/twist-space/twist-icons) !
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm i twist-aplayer
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Import TwistAPlayer component from twist-aplayer package, and import stylesheet.
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import { TwistAPlayer } from 'twist-aplayer';
|
|
36
|
+
import 'twist-aplayer/dist/index.min.css';
|
|
37
|
+
|
|
38
|
+
render(
|
|
39
|
+
<TwistAPlayer
|
|
40
|
+
audio={{
|
|
41
|
+
name: 'ヘリオス',
|
|
42
|
+
artist: 'Helios',
|
|
43
|
+
url: 'https://music.163.com/#/song?id=1919555788&userid=122967305',
|
|
44
|
+
}}
|
|
45
|
+
theme="dark"
|
|
46
|
+
/>
|
|
47
|
+
);
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Interface
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
export interface AudioInfo {
|
|
54
|
+
name?: string;
|
|
55
|
+
artist?: string | ArtistInfo;
|
|
56
|
+
url: string;
|
|
57
|
+
cover?: string;
|
|
58
|
+
lrc?: string;
|
|
59
|
+
theme?: string;
|
|
60
|
+
type?: 'auto' | 'hls' | 'normal';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface ArtistInfo {
|
|
64
|
+
name?: string;
|
|
65
|
+
url?: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface TwistAPlayerProps {
|
|
69
|
+
/**
|
|
70
|
+
* @description audio info, should be an object or object array
|
|
71
|
+
*/
|
|
72
|
+
audio: AudioInfo | readonly AudioInfo[];
|
|
73
|
+
/**
|
|
74
|
+
* Initial volume
|
|
75
|
+
* @description default volume
|
|
76
|
+
* @default 0.7
|
|
77
|
+
*/
|
|
78
|
+
volume?: number;
|
|
79
|
+
/**
|
|
80
|
+
* @description values: 'normal', 'fixed'
|
|
81
|
+
* @default "normal"
|
|
82
|
+
*/
|
|
83
|
+
appearance?: 'normal' | 'fixed';
|
|
84
|
+
/**
|
|
85
|
+
* @description values: 'all' | 'one' | 'none'
|
|
86
|
+
* @default "all"
|
|
87
|
+
*/
|
|
88
|
+
initialLoop?: PlaylistLoop;
|
|
89
|
+
/**
|
|
90
|
+
* @description values: 'list' | 'random'
|
|
91
|
+
* @default "list"
|
|
92
|
+
*/
|
|
93
|
+
initialOrder?: PlaylistOrder;
|
|
94
|
+
/**
|
|
95
|
+
* @description audio autoplay
|
|
96
|
+
* @default false
|
|
97
|
+
*/
|
|
98
|
+
autoPlay?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* @description list max height
|
|
101
|
+
* @default 250
|
|
102
|
+
*/
|
|
103
|
+
listMaxHeight?: number;
|
|
104
|
+
/**
|
|
105
|
+
* @description enable mini mode
|
|
106
|
+
* @default false
|
|
107
|
+
*/
|
|
108
|
+
mini?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* @default prevent to play multiple player at the same time, pause other players when this player start play
|
|
111
|
+
* @default true
|
|
112
|
+
*/
|
|
113
|
+
mutex?: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* @description indicate whether list should folded at first
|
|
116
|
+
* @default false
|
|
117
|
+
*/
|
|
118
|
+
listFolded?: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* @description player theme, values: light, dark
|
|
121
|
+
* @default light
|
|
122
|
+
*/
|
|
123
|
+
theme?: 'light' | 'dark';
|
|
124
|
+
/**
|
|
125
|
+
* @description user border, it can accent border if use dark mode.
|
|
126
|
+
* @default false
|
|
127
|
+
*/
|
|
128
|
+
border?: boolean;
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## How to make LRC?
|
|
133
|
+
I recommand [LRC generator site](https://www.lrcgenerator.com/), it can easy to make LRC!
|
|
134
|
+
|
|
135
|
+
## Credits
|
|
136
|
+
|
|
137
|
+
The implementation of this project is inspired by the following prior art project:
|
|
138
|
+
- [aplayer-react](https://github.com/SevenOutman/aplayer-react)
|
|
139
|
+
- [aplayer](https://github.com/DIYgod/APlayer)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JSX
|
|
1
|
+
import { JSX } from 'react/jsx-runtime';
|
|
2
2
|
|
|
3
3
|
export declare interface ArtistInfo {
|
|
4
4
|
name?: string;
|
|
@@ -40,7 +40,7 @@ declare type PlaylistLoop = 'all' | 'one' | 'none';
|
|
|
40
40
|
*/
|
|
41
41
|
declare type PlaylistOrder = 'list' | 'random';
|
|
42
42
|
|
|
43
|
-
export declare function TwistAPlayer(props: TwistAPlayerProps):
|
|
43
|
+
export declare function TwistAPlayer(props: TwistAPlayerProps): JSX.Element;
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* @see https://aplayer.js.org/#/home?id=options
|