twist-aplayer 1.2.1 → 1.3.1

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 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
- ![image](https://assets.razzh.cn/aplayer/aplayer-light.png)
11
-
12
- ![image](https://assets.razzh.cn/aplayer/aplayer-dark.png)
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 APlayerProps {
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
+ ![image](https://assets.razzh.cn/aplayer/aplayer-light.png)
11
+
12
+ ![image](https://assets.razzh.cn/aplayer/aplayer-dark.png)
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,9 +1,47 @@
1
1
  import { JSX as JSX_2 } from 'react/jsx-runtime';
2
2
 
3
+ export declare interface ArtistInfo {
4
+ name?: string;
5
+ url?: string;
6
+ }
7
+
8
+ export declare interface AudioInfo {
9
+ name?: string;
10
+ artist?: string | ArtistInfo;
11
+ url: string;
12
+ cover?: string;
13
+ lrc?: string;
14
+ theme?: string;
15
+ type?: 'auto' | 'hls' | 'normal';
16
+ }
17
+
18
+ /**
19
+ * @type all
20
+ * @description List loop, when the last songs is ended the first songs will played
21
+ *
22
+ * @type one
23
+ * @description Single song loop
24
+ *
25
+ * @type none
26
+ * @description Not loop, will not play after the last songs ended
27
+ */
28
+ declare type PlaylistLoop = 'all' | 'one' | 'none';
29
+
30
+ /**
31
+ * @type list
32
+ * @description Play sequentially, in the original order of the song list.
33
+ *
34
+ * @type random
35
+ * @description Play randomly, shuffle the song order and then play.
36
+ */
37
+ declare type PlaylistOrder = 'list' | 'random';
38
+
39
+ export declare function TwistAPlayer({ audio, appearance, volume, initialLoop, initialOrder, autoPlay, listMaxHeight, mini: _mini, mutex, listFolded, theme, border, }: TwistAPlayerProps): JSX_2.Element;
40
+
3
41
  /**
4
42
  * @see https://aplayer.js.org/#/home?id=options
5
43
  */
6
- export declare interface APlayerProps {
44
+ export declare interface TwistAPlayerProps {
7
45
  /**
8
46
  * @description audio info, should be an object or object array
9
47
  */
@@ -66,25 +104,4 @@ export declare interface APlayerProps {
66
104
  border?: boolean;
67
105
  }
68
106
 
69
- export declare interface ArtistInfo {
70
- name?: string;
71
- url?: string;
72
- }
73
-
74
- export declare interface AudioInfo {
75
- name?: string;
76
- artist?: string | ArtistInfo;
77
- url: string;
78
- cover?: string;
79
- lrc?: string;
80
- theme?: string;
81
- type?: 'auto' | 'hls' | 'normal';
82
- }
83
-
84
- declare type PlaylistLoop = 'all' | 'one' | 'none';
85
-
86
- declare type PlaylistOrder = 'list' | 'random';
87
-
88
- export declare function TwistAPlayer({ audio, appearance, volume, initialLoop, initialOrder, autoPlay, listMaxHeight, mini: _mini, mutex, listFolded, theme, border, }: APlayerProps): JSX_2.Element;
89
-
90
107
  export { }