react-modern-audio-player 1.0.0 → 1.1.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 +28 -22
- package/dist/index.cjs +68 -158
- package/dist/index.css +1 -1
- package/dist/index.es.js +61 -144
- package/dist/types/components/AudioPlayer/Context/StateContext/element.d.ts +1 -0
- package/dist/types/components/AudioPlayer/Context/StateContext/placement.d.ts +1 -1
- package/dist/types/components/Dropdown/Dropdown.d.ts +1 -0
- package/package.json +4 -8
package/dist/index.es.js
CHANGED
|
@@ -8222,7 +8222,8 @@ const AudioPlayerProvider = ({
|
|
|
8222
8222
|
volume: 1
|
|
8223
8223
|
},
|
|
8224
8224
|
activeUI: {
|
|
8225
|
-
playButton: true
|
|
8225
|
+
playButton: true,
|
|
8226
|
+
volumeSlider: true
|
|
8226
8227
|
},
|
|
8227
8228
|
playListPlacement: "bottom",
|
|
8228
8229
|
interfacePlacement: {
|
|
@@ -8242,141 +8243,43 @@ const AudioPlayerProvider = ({
|
|
|
8242
8243
|
var vars = "";
|
|
8243
8244
|
const GlobalStyle = createGlobalStyle`
|
|
8244
8245
|
|
|
8245
|
-
|
|
8246
|
-
|
|
8247
|
-
|
|
8248
|
-
|
|
8249
|
-
|
|
8250
|
-
|
|
8251
|
-
iframe,
|
|
8252
|
-
h1,
|
|
8253
|
-
h2,
|
|
8254
|
-
h3,
|
|
8255
|
-
h4,
|
|
8256
|
-
h5,
|
|
8257
|
-
h6,
|
|
8258
|
-
p,
|
|
8259
|
-
blockquote,
|
|
8260
|
-
pre,
|
|
8261
|
-
a,
|
|
8262
|
-
abbr,
|
|
8263
|
-
acronym,
|
|
8264
|
-
address,
|
|
8265
|
-
big,
|
|
8266
|
-
cite,
|
|
8267
|
-
code,
|
|
8268
|
-
del,
|
|
8269
|
-
dfn,
|
|
8270
|
-
em,
|
|
8271
|
-
img,
|
|
8272
|
-
ins,
|
|
8273
|
-
kbd,
|
|
8274
|
-
q,
|
|
8275
|
-
s,
|
|
8276
|
-
samp,
|
|
8277
|
-
small,
|
|
8278
|
-
strike,
|
|
8279
|
-
strong,
|
|
8280
|
-
sub,
|
|
8281
|
-
sup,
|
|
8282
|
-
tt,
|
|
8283
|
-
var,
|
|
8284
|
-
b,
|
|
8285
|
-
u,
|
|
8286
|
-
i,
|
|
8287
|
-
center,
|
|
8288
|
-
dl,
|
|
8289
|
-
dt,
|
|
8290
|
-
dd,
|
|
8291
|
-
ol,
|
|
8292
|
-
ul,
|
|
8293
|
-
li,
|
|
8294
|
-
fieldset,
|
|
8295
|
-
form,
|
|
8296
|
-
label,
|
|
8297
|
-
legend,
|
|
8298
|
-
table,
|
|
8299
|
-
caption,
|
|
8300
|
-
tbody,
|
|
8301
|
-
tfoot,
|
|
8302
|
-
thead,
|
|
8303
|
-
tr,
|
|
8304
|
-
th,
|
|
8305
|
-
td,
|
|
8306
|
-
article,
|
|
8307
|
-
aside,
|
|
8308
|
-
canvas,
|
|
8309
|
-
details,
|
|
8310
|
-
embed,
|
|
8311
|
-
figure,
|
|
8312
|
-
figcaption,
|
|
8313
|
-
footer,
|
|
8314
|
-
header,
|
|
8315
|
-
hgroup,
|
|
8316
|
-
menu,
|
|
8317
|
-
nav,
|
|
8318
|
-
output,
|
|
8319
|
-
ruby,
|
|
8320
|
-
section,
|
|
8321
|
-
summary,
|
|
8322
|
-
time,
|
|
8323
|
-
mark,
|
|
8324
|
-
audio,
|
|
8325
|
-
button,
|
|
8326
|
-
video {
|
|
8327
|
-
margin: 0;
|
|
8328
|
-
padding: 0;
|
|
8329
|
-
font: inherit;
|
|
8330
|
-
font-size: 100%;
|
|
8331
|
-
vertical-align: baseline;
|
|
8332
|
-
border: 0;
|
|
8333
|
-
}
|
|
8334
|
-
/* HTML5 display-role reset for older browsers */
|
|
8335
|
-
article,
|
|
8336
|
-
aside,
|
|
8337
|
-
details,
|
|
8338
|
-
figcaption,
|
|
8339
|
-
figure,
|
|
8340
|
-
footer,
|
|
8341
|
-
header,
|
|
8342
|
-
hgroup,
|
|
8343
|
-
menu,
|
|
8344
|
-
nav,
|
|
8345
|
-
section {
|
|
8346
|
-
display: block;
|
|
8347
|
-
}
|
|
8348
|
-
body {
|
|
8349
|
-
line-height: 1;
|
|
8350
|
-
}
|
|
8351
|
-
ol,
|
|
8352
|
-
ul {
|
|
8353
|
-
list-style: none;
|
|
8354
|
-
}
|
|
8355
|
-
blockquote,
|
|
8356
|
-
q {
|
|
8357
|
-
quotes: none;
|
|
8358
|
-
}
|
|
8359
|
-
blockquote:before,
|
|
8360
|
-
blockquote:after,
|
|
8361
|
-
q:before,
|
|
8362
|
-
q:after {
|
|
8363
|
-
content: '';
|
|
8364
|
-
content: none;
|
|
8365
|
-
}
|
|
8366
|
-
table {
|
|
8367
|
-
border-collapse: collapse;
|
|
8368
|
-
border-spacing: 0;
|
|
8369
|
-
}
|
|
8246
|
+
.rm-audio-player-provider {
|
|
8247
|
+
* {
|
|
8248
|
+
box-sizing: border-box;
|
|
8249
|
+
font: inherit;
|
|
8250
|
+
font-size: 100%;
|
|
8251
|
+
}
|
|
8370
8252
|
|
|
8371
|
-
|
|
8253
|
+
ol,
|
|
8254
|
+
ul {
|
|
8255
|
+
list-style: none;
|
|
8256
|
+
margin: 0;
|
|
8257
|
+
padding: 0;
|
|
8258
|
+
}
|
|
8259
|
+
blockquote,
|
|
8260
|
+
q {
|
|
8261
|
+
quotes: none;
|
|
8262
|
+
}
|
|
8263
|
+
blockquote:before,
|
|
8264
|
+
blockquote:after,
|
|
8265
|
+
q:before,
|
|
8266
|
+
q:after {
|
|
8267
|
+
content: '';
|
|
8268
|
+
content: none;
|
|
8269
|
+
}
|
|
8270
|
+
table {
|
|
8271
|
+
border-collapse: collapse;
|
|
8272
|
+
border-spacing: 0;
|
|
8273
|
+
}
|
|
8274
|
+
button {
|
|
8275
|
+
margin: 0;
|
|
8276
|
+
padding: 0;
|
|
8372
8277
|
background: transparent;
|
|
8373
8278
|
cursor: pointer;
|
|
8374
|
-
|
|
8375
|
-
|
|
8376
|
-
|
|
8377
|
-
|
|
8378
|
-
}
|
|
8379
|
-
`;
|
|
8279
|
+
vertical-align: baseline;
|
|
8280
|
+
border: 0;
|
|
8281
|
+
}
|
|
8282
|
+
}`;
|
|
8380
8283
|
function $parcel$export$1(e, n2, v, s) {
|
|
8381
8284
|
Object.defineProperty(e, n2, { get: v, set: s, enumerable: true, configurable: true });
|
|
8382
8285
|
}
|
|
@@ -13076,8 +12979,7 @@ function TbVolume(props) {
|
|
|
13076
12979
|
const RepeatTypeBtn = () => {
|
|
13077
12980
|
const {
|
|
13078
12981
|
curAudioState,
|
|
13079
|
-
customIcons
|
|
13080
|
-
activeUI
|
|
12982
|
+
customIcons
|
|
13081
12983
|
} = useNonNullableContext(audioPlayerStateContext);
|
|
13082
12984
|
const audioPlayerDispatch = useNonNullableContext(audioPlayerDispatchContext);
|
|
13083
12985
|
const onClick = useCallback(() => {
|
|
@@ -13702,7 +13604,8 @@ const SortableListItem = (props) => {
|
|
|
13702
13604
|
});
|
|
13703
13605
|
};
|
|
13704
13606
|
const SortableListItemContainer = styled.li`
|
|
13705
|
-
border: 2px solid transparent;
|
|
13607
|
+
border-top: 2px solid transparent;
|
|
13608
|
+
border-bottom: 2px solid transparent;
|
|
13706
13609
|
transition: all 0.3s ease-in-out;
|
|
13707
13610
|
|
|
13708
13611
|
& * {
|
|
@@ -14361,6 +14264,7 @@ const Dropdown = ({
|
|
|
14361
14264
|
children,
|
|
14362
14265
|
isOpen: isOpenProp,
|
|
14363
14266
|
placement = "bottom",
|
|
14267
|
+
disabled = false,
|
|
14364
14268
|
onOpenChange
|
|
14365
14269
|
}) => {
|
|
14366
14270
|
const dropdownRef = useRef(null);
|
|
@@ -14391,7 +14295,7 @@ const Dropdown = ({
|
|
|
14391
14295
|
onOpenChange
|
|
14392
14296
|
},
|
|
14393
14297
|
children: /* @__PURE__ */ jsxs(Fragment, {
|
|
14394
|
-
children: [trigger, content]
|
|
14298
|
+
children: [trigger, !disabled && content]
|
|
14395
14299
|
})
|
|
14396
14300
|
})
|
|
14397
14301
|
});
|
|
@@ -14468,7 +14372,7 @@ const DropdownContent = ({
|
|
|
14468
14372
|
onExited,
|
|
14469
14373
|
onEntered,
|
|
14470
14374
|
children: Content
|
|
14471
|
-
}) : Content;
|
|
14375
|
+
}) : isOpen ? Content : null;
|
|
14472
14376
|
};
|
|
14473
14377
|
const DropdownContentContainer = styled.div`
|
|
14474
14378
|
${({
|
|
@@ -14496,6 +14400,11 @@ Dropdown.Content = DropdownContent;
|
|
|
14496
14400
|
Dropdown.Trigger = DropdownTrigger;
|
|
14497
14401
|
const Volume = () => {
|
|
14498
14402
|
const triggerRef = useRef(null);
|
|
14403
|
+
const {
|
|
14404
|
+
activeUI: {
|
|
14405
|
+
volumeSlider
|
|
14406
|
+
}
|
|
14407
|
+
} = useNonNullableContext(audioPlayerStateContext);
|
|
14499
14408
|
const [volumeSliderPlacement, setVolumeSliderPlacement] = useState("bottom");
|
|
14500
14409
|
useEffect(() => {
|
|
14501
14410
|
if (triggerRef.current) {
|
|
@@ -14511,6 +14420,7 @@ const Volume = () => {
|
|
|
14511
14420
|
return /* @__PURE__ */ jsxs(Dropdown, {
|
|
14512
14421
|
placement: volumeSliderPlacement,
|
|
14513
14422
|
triggerType: "hover",
|
|
14423
|
+
disabled: !volumeSlider,
|
|
14514
14424
|
children: [/* @__PURE__ */ jsx(Dropdown.Trigger, {
|
|
14515
14425
|
children: /* @__PURE__ */ jsx(VolumeTriggerBtn, {
|
|
14516
14426
|
ref: triggerRef
|
|
@@ -14601,10 +14511,10 @@ const TrackInfoContainer = styled.div`
|
|
|
14601
14511
|
overflow: hidden;
|
|
14602
14512
|
}
|
|
14603
14513
|
.title {
|
|
14604
|
-
font-size:
|
|
14514
|
+
font-size: 16px;
|
|
14605
14515
|
}
|
|
14606
14516
|
.writer {
|
|
14607
|
-
font-size:
|
|
14517
|
+
font-size: 12px;
|
|
14608
14518
|
}
|
|
14609
14519
|
`;
|
|
14610
14520
|
const TrackInfo = () => {
|
|
@@ -14685,8 +14595,8 @@ const TrackTimeContainer = styled.div`
|
|
|
14685
14595
|
align-items: center;
|
|
14686
14596
|
justify-content: center;
|
|
14687
14597
|
min-height: 16px;
|
|
14688
|
-
font-family: monospace;
|
|
14689
|
-
font-size:
|
|
14598
|
+
font-family: monospace !important;
|
|
14599
|
+
font-size: 16px !important;
|
|
14690
14600
|
`;
|
|
14691
14601
|
const TrackTimeCurrentContainer = styled(TrackTimeContainer)`
|
|
14692
14602
|
${({
|
|
@@ -14811,9 +14721,16 @@ const generateGridTemplateValues = (activeUi, placement) => {
|
|
|
14811
14721
|
return { gridAreas, gridColumns };
|
|
14812
14722
|
};
|
|
14813
14723
|
const InterfaceContainer = styled.div`
|
|
14724
|
+
.interface-grid {
|
|
14725
|
+
background: var(--rm-audio-player-interface-container);
|
|
14726
|
+
}
|
|
14814
14727
|
.interface-grid {
|
|
14815
14728
|
padding: 0.5rem 10px;
|
|
14816
14729
|
}
|
|
14730
|
+
.sortable-play-list {
|
|
14731
|
+
background: var(--rm-audio-player-sortable-list);
|
|
14732
|
+
box-shadow: -5px 2px 4px 0px rgb(0 0 0 / 4%) inset;
|
|
14733
|
+
}
|
|
14817
14734
|
`;
|
|
14818
14735
|
const Interface = () => {
|
|
14819
14736
|
const {
|
|
@@ -14915,9 +14832,9 @@ const AudioPlayerWithProvider = ({
|
|
|
14915
14832
|
return /* @__PURE__ */ jsx(AudioPlayerProvider, {
|
|
14916
14833
|
children: /* @__PURE__ */ jsxs(SpectrumProvider, {
|
|
14917
14834
|
rootContainerProps,
|
|
14918
|
-
children: [/* @__PURE__ */ jsx(
|
|
14835
|
+
children: [/* @__PURE__ */ jsx(AudioPlayer, {
|
|
14919
14836
|
...audioPlayProps
|
|
14920
|
-
})]
|
|
14837
|
+
}), /* @__PURE__ */ jsx(GlobalStyle, {})]
|
|
14921
14838
|
})
|
|
14922
14839
|
});
|
|
14923
14840
|
};
|
|
@@ -3,7 +3,7 @@ import { ActiveUI } from "./element";
|
|
|
3
3
|
export declare type PlayListPlacement = "bottom" | "top";
|
|
4
4
|
export declare type PlayerPlacement = "bottom" | "top" | "bottom-left" | "bottom-right" | "top-left" | "top-right";
|
|
5
5
|
export declare const interfacePlacementMaxLength = 10;
|
|
6
|
-
export declare type InterfacePlacementKey = Exclude<keyof ActiveUI, "all" | "prevNnext" | "trackTime"> | "trackTimeCurrent" | "trackTimeDuration";
|
|
6
|
+
export declare type InterfacePlacementKey = Exclude<keyof ActiveUI, "all" | "prevNnext" | "trackTime" | "volumeSlider"> | "trackTimeCurrent" | "trackTimeDuration";
|
|
7
7
|
export declare type InterfaceGridTemplateArea = Partial<Record<InterfacePlacementKey, `row${NumbersToUnionNum<typeof interfacePlacementMaxLength>}-${NumbersToUnionNum<typeof interfacePlacementMaxLength>}`>>;
|
|
8
8
|
export declare type InterfaceGridItemArea = Partial<Record<InterfacePlacementKey, string>>;
|
|
9
9
|
export declare type InterfacePlacement = {
|
|
@@ -7,6 +7,7 @@ export interface DropdownProps extends Omit<Partial<DropdownContext>, "setIsOpen
|
|
|
7
7
|
triggerType?: "click" | "hover";
|
|
8
8
|
outboundClickActive?: boolean;
|
|
9
9
|
placement?: DropdownContext["placement"];
|
|
10
|
+
disabled?: boolean;
|
|
10
11
|
}
|
|
11
12
|
declare const Dropdown: FC<PropsWithChildren<DropdownProps>>;
|
|
12
13
|
declare type DropdownComponent = typeof Dropdown & {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-modern-audio-player",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"homepage": "https://github.com/slash9494/react-modern-audio-player/",
|
|
5
5
|
"module": "dist/index.es.js",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -9,10 +9,6 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"dist"
|
|
11
11
|
],
|
|
12
|
-
"exports": {
|
|
13
|
-
".": {
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
12
|
"repository": {
|
|
17
13
|
"type": "git",
|
|
18
14
|
"url": "git+https://github.com/slash9494/react-modern-audio-player.git"
|
|
@@ -20,8 +16,7 @@
|
|
|
20
16
|
"scripts": {
|
|
21
17
|
"dev": "vite --host",
|
|
22
18
|
"build": "rm -rf dist && tsc && vite build",
|
|
23
|
-
"preview": "vite preview"
|
|
24
|
-
"publish": "rm -rf dist && tsc && vite build"
|
|
19
|
+
"preview": "vite preview"
|
|
25
20
|
},
|
|
26
21
|
"peerDependencies": {
|
|
27
22
|
"react": ">=16.8.0",
|
|
@@ -48,5 +43,6 @@
|
|
|
48
43
|
"vite": "^2.9.0",
|
|
49
44
|
"vite-plugin-dts": "^1.1.0",
|
|
50
45
|
"vite-plugin-libcss": "^1.0.5"
|
|
51
|
-
}
|
|
46
|
+
},
|
|
47
|
+
"keywords": ["audio", "player", "react", "react-modern-audio-player"]
|
|
52
48
|
}
|