twist-aplayer 1.0.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/LICENSE.md ADDED
@@ -0,0 +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
21
+ SOFTWARE
package/README.md ADDED
@@ -0,0 +1,115 @@
1
+ # twist-aplayer
2
+
3
+ <p align="center">
4
+ <img src="./screenshot/aplayer.svg" alt="ADPlayer" width="100">
5
+ </p>
6
+ <h1 align="center">Twist APlayer</h1>
7
+
8
+ > a shadcn ui theme aplayer for your React application.
9
+
10
+ ![image](./screenshot/aplayer-light.png)
11
+ ![image](./screenshot/aplayer-dark.png)
12
+
13
+ ## Features
14
+ Twist Aplayer supports:
15
+ - Mini mode
16
+ - Playlist - Lyrics
17
+ - Light or dark theme switch
18
+ - Custom theme color with component-level variables
19
+
20
+ ## Usage
21
+
22
+ ```bash
23
+ npm i twist-aplayer
24
+ ```
25
+
26
+ Import TwistAPlayer component from twist-aplayer package, and import stylesheet.
27
+
28
+ ```tsx
29
+ import { TwistAPlayer } from 'twist-aplayer';
30
+ import 'twist-aplayer/dist/index.css';
31
+
32
+ render(
33
+ <APlayer
34
+ audio={{
35
+ name: 'ヘリオス',
36
+ artist: 'Helios',
37
+ url: 'https://music.163.com/#/song?id=1919555788&userid=122967305',
38
+ }}
39
+ autoPlay
40
+ />
41
+ );
42
+ ```
43
+
44
+ ### Interface
45
+
46
+ ```ts
47
+ export interface APlayerProps {
48
+ /**
49
+ * @description audio info, should be an object or object array
50
+ */
51
+ audio: AudioInfo | readonly AudioInfo[];
52
+ /**
53
+ * Initial volume
54
+ * @description default volume
55
+ * @default 0.7
56
+ */
57
+ volume?: number;
58
+
59
+ /**
60
+ * @description values: 'normal', 'fixed'
61
+ * @default "normal"
62
+ */
63
+ appearance?: 'normal' | 'fixed';
64
+
65
+ /**
66
+ * @description values: 'all' | 'one' | 'none'
67
+ * @default "all"
68
+ */
69
+ initialLoop?: PlaylistLoop;
70
+
71
+ /**
72
+ * @description values: 'list' | 'random'
73
+ * @default "list"
74
+ */
75
+ initialOrder?: PlaylistOrder;
76
+
77
+ /**
78
+ * @description audio autoplay
79
+ * @default false
80
+ */
81
+ autoPlay?: boolean;
82
+
83
+ /**
84
+ * @description list max height
85
+ * @default 250
86
+ */
87
+ listMaxHeight?: number;
88
+ /**
89
+ * @description enable mini mode
90
+ * @default false
91
+ */
92
+ mini?: boolean;
93
+ /**
94
+ * @default prevent to play multiple player at the same time, pause other players when this player start play
95
+ * @default true
96
+ */
97
+ mutex?: boolean;
98
+ /**
99
+ * @description indicate whether list should folded at first
100
+ * @default false
101
+ */
102
+ listFolded?: boolean;
103
+ /**
104
+ * @description player theme, values: light, dark
105
+ * @default light
106
+ */
107
+ theme?: 'light' | 'dark'
108
+ }
109
+ ```
110
+
111
+ ## Credits
112
+
113
+ The implementation of this project is inspired by the following prior art project:
114
+ - [aplayer-react](https://github.com/SevenOutman/aplayer-react)
115
+ - [aplayer](https://github.com/DIYgod/APlayer)