react-modern-audio-player 0.0.3 → 1.1.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 +21 -0
- package/README.md +296 -46
- package/dist/index.cjs +100 -190
- package/dist/index.css +1 -1
- package/dist/index.es.js +203 -273
- package/dist/types/components/AudioPlayer/Context/StateContext/element.d.ts +1 -0
- package/dist/types/components/AudioPlayer/Context/StateContext/placement.d.ts +1 -2
- package/dist/types/components/AudioPlayer/Interface/Controller/Button/PrevNnextBtn.d.ts +1 -0
- package/dist/types/components/Dropdown/Dropdown.d.ts +1 -0
- package/dist/types/components/Grid/Item.d.ts +7 -2
- package/dist/types/utils/generateGridTemplateValues.d.ts +1 -1
- package/package.json +4 -9
package/dist/index.es.js
CHANGED
|
@@ -7923,7 +7923,6 @@ const useNonNullableContext = (context) => {
|
|
|
7923
7923
|
throw new Error(`Cannot find ${context}Provider`);
|
|
7924
7924
|
return state;
|
|
7925
7925
|
};
|
|
7926
|
-
const interfacePlacementMaxLength = 10;
|
|
7927
7926
|
const defaultInterfacePlacement = {
|
|
7928
7927
|
templateArea: {
|
|
7929
7928
|
artwork: "row1-1",
|
|
@@ -8023,7 +8022,7 @@ const SpectrumProvider = ({
|
|
|
8023
8022
|
theme: $bf24a13e98395dd3$export$bca14c5b3b88a9c9,
|
|
8024
8023
|
width: "100%",
|
|
8025
8024
|
position: contextPlayerPlacement && "fixed",
|
|
8026
|
-
UNSAFE_className: "
|
|
8025
|
+
UNSAFE_className: "rm-audio-player-provider",
|
|
8027
8026
|
...placementState,
|
|
8028
8027
|
...rootContainerProps,
|
|
8029
8028
|
children
|
|
@@ -8223,7 +8222,8 @@ const AudioPlayerProvider = ({
|
|
|
8223
8222
|
volume: 1
|
|
8224
8223
|
},
|
|
8225
8224
|
activeUI: {
|
|
8226
|
-
playButton: true
|
|
8225
|
+
playButton: true,
|
|
8226
|
+
volumeSlider: true
|
|
8227
8227
|
},
|
|
8228
8228
|
playListPlacement: "bottom",
|
|
8229
8229
|
interfacePlacement: {
|
|
@@ -8243,141 +8243,43 @@ const AudioPlayerProvider = ({
|
|
|
8243
8243
|
var vars = "";
|
|
8244
8244
|
const GlobalStyle = createGlobalStyle`
|
|
8245
8245
|
|
|
8246
|
-
|
|
8247
|
-
|
|
8248
|
-
|
|
8249
|
-
|
|
8250
|
-
|
|
8251
|
-
|
|
8252
|
-
iframe,
|
|
8253
|
-
h1,
|
|
8254
|
-
h2,
|
|
8255
|
-
h3,
|
|
8256
|
-
h4,
|
|
8257
|
-
h5,
|
|
8258
|
-
h6,
|
|
8259
|
-
p,
|
|
8260
|
-
blockquote,
|
|
8261
|
-
pre,
|
|
8262
|
-
a,
|
|
8263
|
-
abbr,
|
|
8264
|
-
acronym,
|
|
8265
|
-
address,
|
|
8266
|
-
big,
|
|
8267
|
-
cite,
|
|
8268
|
-
code,
|
|
8269
|
-
del,
|
|
8270
|
-
dfn,
|
|
8271
|
-
em,
|
|
8272
|
-
img,
|
|
8273
|
-
ins,
|
|
8274
|
-
kbd,
|
|
8275
|
-
q,
|
|
8276
|
-
s,
|
|
8277
|
-
samp,
|
|
8278
|
-
small,
|
|
8279
|
-
strike,
|
|
8280
|
-
strong,
|
|
8281
|
-
sub,
|
|
8282
|
-
sup,
|
|
8283
|
-
tt,
|
|
8284
|
-
var,
|
|
8285
|
-
b,
|
|
8286
|
-
u,
|
|
8287
|
-
i,
|
|
8288
|
-
center,
|
|
8289
|
-
dl,
|
|
8290
|
-
dt,
|
|
8291
|
-
dd,
|
|
8292
|
-
ol,
|
|
8293
|
-
ul,
|
|
8294
|
-
li,
|
|
8295
|
-
fieldset,
|
|
8296
|
-
form,
|
|
8297
|
-
label,
|
|
8298
|
-
legend,
|
|
8299
|
-
table,
|
|
8300
|
-
caption,
|
|
8301
|
-
tbody,
|
|
8302
|
-
tfoot,
|
|
8303
|
-
thead,
|
|
8304
|
-
tr,
|
|
8305
|
-
th,
|
|
8306
|
-
td,
|
|
8307
|
-
article,
|
|
8308
|
-
aside,
|
|
8309
|
-
canvas,
|
|
8310
|
-
details,
|
|
8311
|
-
embed,
|
|
8312
|
-
figure,
|
|
8313
|
-
figcaption,
|
|
8314
|
-
footer,
|
|
8315
|
-
header,
|
|
8316
|
-
hgroup,
|
|
8317
|
-
menu,
|
|
8318
|
-
nav,
|
|
8319
|
-
output,
|
|
8320
|
-
ruby,
|
|
8321
|
-
section,
|
|
8322
|
-
summary,
|
|
8323
|
-
time,
|
|
8324
|
-
mark,
|
|
8325
|
-
audio,
|
|
8326
|
-
button,
|
|
8327
|
-
video {
|
|
8328
|
-
margin: 0;
|
|
8329
|
-
padding: 0;
|
|
8330
|
-
font: inherit;
|
|
8331
|
-
font-size: 100%;
|
|
8332
|
-
vertical-align: baseline;
|
|
8333
|
-
border: 0;
|
|
8334
|
-
}
|
|
8335
|
-
/* HTML5 display-role reset for older browsers */
|
|
8336
|
-
article,
|
|
8337
|
-
aside,
|
|
8338
|
-
details,
|
|
8339
|
-
figcaption,
|
|
8340
|
-
figure,
|
|
8341
|
-
footer,
|
|
8342
|
-
header,
|
|
8343
|
-
hgroup,
|
|
8344
|
-
menu,
|
|
8345
|
-
nav,
|
|
8346
|
-
section {
|
|
8347
|
-
display: block;
|
|
8348
|
-
}
|
|
8349
|
-
body {
|
|
8350
|
-
line-height: 1;
|
|
8351
|
-
}
|
|
8352
|
-
ol,
|
|
8353
|
-
ul {
|
|
8354
|
-
list-style: none;
|
|
8355
|
-
}
|
|
8356
|
-
blockquote,
|
|
8357
|
-
q {
|
|
8358
|
-
quotes: none;
|
|
8359
|
-
}
|
|
8360
|
-
blockquote:before,
|
|
8361
|
-
blockquote:after,
|
|
8362
|
-
q:before,
|
|
8363
|
-
q:after {
|
|
8364
|
-
content: '';
|
|
8365
|
-
content: none;
|
|
8366
|
-
}
|
|
8367
|
-
table {
|
|
8368
|
-
border-collapse: collapse;
|
|
8369
|
-
border-spacing: 0;
|
|
8370
|
-
}
|
|
8246
|
+
.rm-audio-player-provider {
|
|
8247
|
+
* {
|
|
8248
|
+
box-sizing: border-box;
|
|
8249
|
+
font: inherit;
|
|
8250
|
+
font-size: 100%;
|
|
8251
|
+
}
|
|
8371
8252
|
|
|
8372
|
-
|
|
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;
|
|
8373
8277
|
background: transparent;
|
|
8374
8278
|
cursor: pointer;
|
|
8375
|
-
|
|
8376
|
-
|
|
8377
|
-
|
|
8378
|
-
|
|
8379
|
-
}
|
|
8380
|
-
`;
|
|
8279
|
+
vertical-align: baseline;
|
|
8280
|
+
border: 0;
|
|
8281
|
+
}
|
|
8282
|
+
}`;
|
|
8381
8283
|
function $parcel$export$1(e, n2, v, s) {
|
|
8382
8284
|
Object.defineProperty(e, n2, { get: v, set: s, enumerable: true, configurable: true });
|
|
8383
8285
|
}
|
|
@@ -8524,7 +8426,7 @@ const Basic = () => {
|
|
|
8524
8426
|
});
|
|
8525
8427
|
}, [audioRef.current, audioPlayerDispatch]);
|
|
8526
8428
|
return /* @__PURE__ */ jsx("audio", {
|
|
8527
|
-
id: "
|
|
8429
|
+
id: "rm-audio-player-audio",
|
|
8528
8430
|
autoPlay: curAudioState.isPlaying,
|
|
8529
8431
|
ref: audioRef,
|
|
8530
8432
|
src: curPlayedAudioData.src,
|
|
@@ -8537,7 +8439,7 @@ const useVariableColor = (variableColors) => {
|
|
|
8537
8439
|
useLayoutEffect(() => {
|
|
8538
8440
|
const parsedColors = Object.entries(variableColors).reduce((acc, [key, varName]) => ({
|
|
8539
8441
|
...acc,
|
|
8540
|
-
[key]: window.getComputedStyle(document.getElementsByClassName("
|
|
8442
|
+
[key]: window.getComputedStyle(document.getElementsByClassName("rm-audio-player-provider")[0]).getPropertyValue(`${varName}`)
|
|
8541
8443
|
}), {});
|
|
8542
8444
|
colorsRef.current = parsedColors;
|
|
8543
8445
|
}, [variableColors]);
|
|
@@ -12830,8 +12732,8 @@ const WaveSurferAudio = () => {
|
|
|
12830
12732
|
elementRefs
|
|
12831
12733
|
} = useNonNullableContext(audioPlayerStateContext);
|
|
12832
12734
|
const colorsRef = useVariableColor({
|
|
12833
|
-
progressColor: "--
|
|
12834
|
-
waveColor: "--
|
|
12735
|
+
progressColor: "--rm-audio-player-waveform-bar",
|
|
12736
|
+
waveColor: "--rm-audio-player-waveform-background"
|
|
12835
12737
|
});
|
|
12836
12738
|
useEffect(() => {
|
|
12837
12739
|
if ((elementRefs == null ? void 0 : elementRefs.waveformInst) || !colorsRef.current)
|
|
@@ -12839,13 +12741,13 @@ const WaveSurferAudio = () => {
|
|
|
12839
12741
|
const waveSurfer = WaveSurfer.create({
|
|
12840
12742
|
barWidth: 1,
|
|
12841
12743
|
cursorWidth: 2,
|
|
12842
|
-
container: "#
|
|
12744
|
+
container: "#rm-waveform",
|
|
12843
12745
|
backend: "WebAudio",
|
|
12844
12746
|
height: 80,
|
|
12845
12747
|
progressColor: `${colorsRef.current.progressColor}`,
|
|
12846
12748
|
responsive: true,
|
|
12847
12749
|
waveColor: `${colorsRef.current.waveColor}`,
|
|
12848
|
-
cursorColor: "var(--
|
|
12750
|
+
cursorColor: "var(--rm-audio-player-waveform-cursor)"
|
|
12849
12751
|
});
|
|
12850
12752
|
audioPlayerDispatch({
|
|
12851
12753
|
type: "SET_ELEMENT_REFS",
|
|
@@ -12981,11 +12883,9 @@ const StyledPlayBtn = styled(StyledBtn)`
|
|
|
12981
12883
|
width: 35px;
|
|
12982
12884
|
`;
|
|
12983
12885
|
const PlayBtn = () => {
|
|
12984
|
-
var _a2;
|
|
12985
12886
|
const {
|
|
12986
12887
|
curAudioState,
|
|
12987
|
-
customIcons
|
|
12988
|
-
activeUI
|
|
12888
|
+
customIcons
|
|
12989
12889
|
} = useNonNullableContext(audioPlayerStateContext);
|
|
12990
12890
|
const audioPlayerDispatch = useNonNullableContext(audioPlayerDispatchContext);
|
|
12991
12891
|
const onClick = () => audioPlayerDispatch({
|
|
@@ -13002,11 +12902,11 @@ const PlayBtn = () => {
|
|
|
13002
12902
|
customIcon: customIcons == null ? void 0 : customIcons.play
|
|
13003
12903
|
});
|
|
13004
12904
|
}, [curAudioState.isPlaying, customIcons == null ? void 0 : customIcons.pause, customIcons == null ? void 0 : customIcons.play]);
|
|
13005
|
-
return
|
|
12905
|
+
return /* @__PURE__ */ jsx(StyledPlayBtn, {
|
|
13006
12906
|
onClick,
|
|
13007
12907
|
className: "play-button",
|
|
13008
12908
|
children: PlayIcon
|
|
13009
|
-
})
|
|
12909
|
+
});
|
|
13010
12910
|
};
|
|
13011
12911
|
function ImPrevious(props) {
|
|
13012
12912
|
return GenIcon({ "tag": "svg", "attr": { "version": "1.1", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "d": "M8 0c-4.418 0-8 3.582-8 8s3.582 8 8 8 8-3.582 8-8-3.582-8-8-8zM8 14.5c-3.59 0-6.5-2.91-6.5-6.5s2.91-6.5 6.5-6.5 6.5 2.91 6.5 6.5-2.91 6.5-6.5 6.5z" } }, { "tag": "path", "attr": { "d": "M7 8l4-3v6z" } }, { "tag": "path", "attr": { "d": "M5 5h2v6h-2v-6z" } }] })(props);
|
|
@@ -13015,12 +12915,11 @@ function ImNext(props) {
|
|
|
13015
12915
|
return GenIcon({ "tag": "svg", "attr": { "version": "1.1", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "d": "M8 0c4.418 0 8 3.582 8 8s-3.582 8-8 8-8-3.582-8-8 3.582-8 8-8zM8 14.5c3.59 0 6.5-2.91 6.5-6.5s-2.91-6.5-6.5-6.5-6.5 2.91-6.5 6.5 2.91 6.5 6.5 6.5z" } }, { "tag": "path", "attr": { "d": "M9 8l-4-3v6z" } }, { "tag": "path", "attr": { "d": "M11 5h-2v6h2v-6z" } }] })(props);
|
|
13016
12916
|
}
|
|
13017
12917
|
const PrevNnextBtn = ({
|
|
13018
|
-
type
|
|
12918
|
+
type,
|
|
12919
|
+
visible
|
|
13019
12920
|
}) => {
|
|
13020
|
-
var _a2;
|
|
13021
12921
|
const {
|
|
13022
|
-
customIcons
|
|
13023
|
-
activeUI
|
|
12922
|
+
customIcons
|
|
13024
12923
|
} = useNonNullableContext(audioPlayerStateContext);
|
|
13025
12924
|
const audioPlayerDispatch = useNonNullableContext(audioPlayerDispatchContext);
|
|
13026
12925
|
const onClickBtn = () => {
|
|
@@ -13050,7 +12949,7 @@ const PrevNnextBtn = ({
|
|
|
13050
12949
|
}
|
|
13051
12950
|
return null;
|
|
13052
12951
|
}, [customIcons == null ? void 0 : customIcons.next, customIcons == null ? void 0 : customIcons.prev, type]);
|
|
13053
|
-
return
|
|
12952
|
+
return visible ? /* @__PURE__ */ jsx(StyledBtn, {
|
|
13054
12953
|
onClick: onClickBtn,
|
|
13055
12954
|
className: "prev-n-next-button",
|
|
13056
12955
|
children: PrevNnextIcon
|
|
@@ -13078,11 +12977,9 @@ function TbVolume(props) {
|
|
|
13078
12977
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "strokeWidth": "2", "stroke": "currentColor", "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "desc", "attr": {}, "child": [] }, { "tag": "path", "attr": { "stroke": "none", "d": "M0 0h24v24H0z", "fill": "none" } }, { "tag": "path", "attr": { "d": "M15 8a5 5 0 0 1 0 8" } }, { "tag": "path", "attr": { "d": "M17.7 5a9 9 0 0 1 0 14" } }, { "tag": "path", "attr": { "d": "M6 15h-2a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h2l3.5 -4.5a0.8 .8 0 0 1 1.5 .5v14a0.8 .8 0 0 1 -1.5 .5l-3.5 -4.5" } }] })(props);
|
|
13079
12978
|
}
|
|
13080
12979
|
const RepeatTypeBtn = () => {
|
|
13081
|
-
var _a2;
|
|
13082
12980
|
const {
|
|
13083
12981
|
curAudioState,
|
|
13084
|
-
customIcons
|
|
13085
|
-
activeUI
|
|
12982
|
+
customIcons
|
|
13086
12983
|
} = useNonNullableContext(audioPlayerStateContext);
|
|
13087
12984
|
const audioPlayerDispatch = useNonNullableContext(audioPlayerDispatchContext);
|
|
13088
12985
|
const onClick = useCallback(() => {
|
|
@@ -13137,11 +13034,11 @@ const RepeatTypeBtn = () => {
|
|
|
13137
13034
|
});
|
|
13138
13035
|
}
|
|
13139
13036
|
}, [curAudioState.repeatType, customIcons == null ? void 0 : customIcons.repeatAll, customIcons == null ? void 0 : customIcons.repeatNone, customIcons == null ? void 0 : customIcons.repeatOne, customIcons == null ? void 0 : customIcons.repeatShuffle]);
|
|
13140
|
-
return
|
|
13037
|
+
return /* @__PURE__ */ jsx(StyledBtn, {
|
|
13141
13038
|
onClick,
|
|
13142
13039
|
className: "repeat-button",
|
|
13143
13040
|
children: RepeatIcon
|
|
13144
|
-
})
|
|
13041
|
+
});
|
|
13145
13042
|
};
|
|
13146
13043
|
const PlayListTriggerBtn = ({
|
|
13147
13044
|
isOpen
|
|
@@ -13153,7 +13050,7 @@ const PlayListTriggerBtn = ({
|
|
|
13153
13050
|
children: /* @__PURE__ */ jsx(Icon, {
|
|
13154
13051
|
render: /* @__PURE__ */ jsx(MdPlaylistPlay, {
|
|
13155
13052
|
size: "100%",
|
|
13156
|
-
color: isOpen ? "var(--
|
|
13053
|
+
color: isOpen ? "var(--rm-audio-player-sortable-list-button-active)" : void 0
|
|
13157
13054
|
}),
|
|
13158
13055
|
customIcon: customIcons == null ? void 0 : customIcons.playList
|
|
13159
13056
|
})
|
|
@@ -13707,7 +13604,8 @@ const SortableListItem = (props) => {
|
|
|
13707
13604
|
});
|
|
13708
13605
|
};
|
|
13709
13606
|
const SortableListItemContainer = styled.li`
|
|
13710
|
-
border: 2px solid transparent;
|
|
13607
|
+
border-top: 2px solid transparent;
|
|
13608
|
+
border-bottom: 2px solid transparent;
|
|
13711
13609
|
transition: all 0.3s ease-in-out;
|
|
13712
13610
|
|
|
13713
13611
|
& * {
|
|
@@ -13816,7 +13714,7 @@ const ListItemContainer = styled.div`
|
|
|
13816
13714
|
align-items: center;
|
|
13817
13715
|
padding: 10px 20px;
|
|
13818
13716
|
&.curPlayed {
|
|
13819
|
-
background: var(--
|
|
13717
|
+
background: var(--rm-audio-player-selected-list-item-background);
|
|
13820
13718
|
}
|
|
13821
13719
|
.list-item-contents-wrapper {
|
|
13822
13720
|
width: 100%;
|
|
@@ -13945,12 +13843,8 @@ const PlayListContainer = styled.div`
|
|
|
13945
13843
|
}
|
|
13946
13844
|
`;
|
|
13947
13845
|
const SortablePlayList = () => {
|
|
13948
|
-
var _a2;
|
|
13949
|
-
const {
|
|
13950
|
-
activeUI
|
|
13951
|
-
} = useNonNullableContext(audioPlayerStateContext);
|
|
13952
13846
|
const [isOpen, setIsOpen] = useState(false);
|
|
13953
|
-
return
|
|
13847
|
+
return /* @__PURE__ */ jsxs(Drawer, {
|
|
13954
13848
|
onOpenChange: setIsOpen,
|
|
13955
13849
|
children: [/* @__PURE__ */ jsx(Drawer.Trigger, {
|
|
13956
13850
|
children: /* @__PURE__ */ jsx(PlayListTriggerBtn, {
|
|
@@ -13962,7 +13856,7 @@ const SortablePlayList = () => {
|
|
|
13962
13856
|
setIsOpen
|
|
13963
13857
|
})
|
|
13964
13858
|
})]
|
|
13965
|
-
})
|
|
13859
|
+
});
|
|
13966
13860
|
};
|
|
13967
13861
|
const useBarProgress = () => {
|
|
13968
13862
|
const { elementRefs } = useNonNullableContext(audioPlayerStateContext);
|
|
@@ -14011,14 +13905,14 @@ const BarProgress = () => {
|
|
|
14011
13905
|
className: "bar-progress-wrapper",
|
|
14012
13906
|
...eventProps,
|
|
14013
13907
|
children: [/* @__PURE__ */ jsx("div", {
|
|
14014
|
-
className: "
|
|
13908
|
+
className: "rm-player-progress-bar",
|
|
14015
13909
|
ref: progressBarRef,
|
|
14016
13910
|
children: /* @__PURE__ */ jsx("div", {
|
|
14017
|
-
className: "
|
|
13911
|
+
className: "rm-player-progress",
|
|
14018
13912
|
ref: progressValueRef
|
|
14019
13913
|
})
|
|
14020
13914
|
}), /* @__PURE__ */ jsx("div", {
|
|
14021
|
-
className: "
|
|
13915
|
+
className: "rm-player-progress-handle",
|
|
14022
13916
|
ref: progressHandleRef
|
|
14023
13917
|
})]
|
|
14024
13918
|
});
|
|
@@ -14031,31 +13925,31 @@ const BarProgressWrapper = styled.div`
|
|
|
14031
13925
|
cursor: pointer;
|
|
14032
13926
|
position: relative;
|
|
14033
13927
|
align-items: center;
|
|
14034
|
-
.
|
|
13928
|
+
.rm-player-progress-bar {
|
|
14035
13929
|
position: relative;
|
|
14036
13930
|
width: 100%;
|
|
14037
13931
|
height: 100%;
|
|
14038
13932
|
overflow: hidden;
|
|
14039
|
-
background-color: var(--
|
|
13933
|
+
background-color: var(--rm-audio-player-progress-bar-background);
|
|
14040
13934
|
}
|
|
14041
|
-
.
|
|
13935
|
+
.rm-player-progress {
|
|
14042
13936
|
position: absolute;
|
|
14043
13937
|
left: 0;
|
|
14044
13938
|
width: 100%;
|
|
14045
13939
|
height: 100%;
|
|
14046
|
-
background-color: var(--
|
|
13940
|
+
background-color: var(--rm-audio-player-progress-bar);
|
|
14047
13941
|
transform-origin: 0 0;
|
|
14048
13942
|
transform: scaleX(0);
|
|
14049
13943
|
}
|
|
14050
13944
|
&:hover {
|
|
14051
|
-
.
|
|
13945
|
+
.rm-player-progress-handle {
|
|
14052
13946
|
opacity: 1;
|
|
14053
13947
|
}
|
|
14054
13948
|
}
|
|
14055
|
-
.
|
|
13949
|
+
.rm-player-progress-handle {
|
|
14056
13950
|
position: absolute;
|
|
14057
13951
|
left: -4px;
|
|
14058
|
-
background-color: var(--
|
|
13952
|
+
background-color: var(--rm-audio-player-progress-bar);
|
|
14059
13953
|
border-radius: 100%;
|
|
14060
13954
|
height: 8px;
|
|
14061
13955
|
width: 8px;
|
|
@@ -14066,7 +13960,7 @@ const BarProgressWrapper = styled.div`
|
|
|
14066
13960
|
const WaveformWrapper = styled.div`
|
|
14067
13961
|
display: flex;
|
|
14068
13962
|
width: 100%;
|
|
14069
|
-
#
|
|
13963
|
+
#rm-waveform {
|
|
14070
13964
|
width: 100%;
|
|
14071
13965
|
wave {
|
|
14072
13966
|
cursor: pointer !important;
|
|
@@ -14077,7 +13971,7 @@ const WaveformProgress = () => {
|
|
|
14077
13971
|
return /* @__PURE__ */ jsx(WaveformWrapper, {
|
|
14078
13972
|
className: "waveform-wrapper",
|
|
14079
13973
|
children: /* @__PURE__ */ jsx("div", {
|
|
14080
|
-
id: "
|
|
13974
|
+
id: "rm-waveform"
|
|
14081
13975
|
})
|
|
14082
13976
|
});
|
|
14083
13977
|
};
|
|
@@ -14089,25 +13983,28 @@ const Progress = () => {
|
|
|
14089
13983
|
const {
|
|
14090
13984
|
activeUI
|
|
14091
13985
|
} = useNonNullableContext(audioPlayerStateContext);
|
|
14092
|
-
const active = activeUI.progress !== void 0 ? !!activeUI.progress : activeUI.all;
|
|
14093
13986
|
const CurProgress = useMemo(() => {
|
|
14094
13987
|
if (activeUI.progress === "waveform")
|
|
14095
13988
|
return /* @__PURE__ */ jsx(WaveformProgress, {});
|
|
14096
13989
|
return /* @__PURE__ */ jsx(BarProgress, {});
|
|
14097
13990
|
}, [activeUI.progress]);
|
|
14098
|
-
return
|
|
13991
|
+
return /* @__PURE__ */ jsx(ProgressContainer, {
|
|
14099
13992
|
className: "progress-container",
|
|
14100
13993
|
children: CurProgress
|
|
14101
|
-
})
|
|
13994
|
+
});
|
|
14102
13995
|
};
|
|
14103
13996
|
const Grid = $994c48bfb00b620b$export$ef2184bd89960b14;
|
|
14104
|
-
const GridItem = forwardRef((
|
|
13997
|
+
const GridItem = forwardRef(({
|
|
13998
|
+
children,
|
|
13999
|
+
visible = true,
|
|
14000
|
+
...viewProps
|
|
14001
|
+
}, ref) => {
|
|
14105
14002
|
return /* @__PURE__ */ jsx($b9606c0c41d55371$export$27a5bd065ad55220, {
|
|
14106
14003
|
justifySelf: "center",
|
|
14107
|
-
padding: "0 5px",
|
|
14004
|
+
padding: visible ? "0 5px" : void 0,
|
|
14108
14005
|
ref,
|
|
14109
14006
|
...viewProps,
|
|
14110
|
-
children:
|
|
14007
|
+
children: visible && children
|
|
14111
14008
|
});
|
|
14112
14009
|
});
|
|
14113
14010
|
GridItem.displayName = "GridItem";
|
|
@@ -14165,7 +14062,7 @@ const VolumeSliderContainer = styled.div`
|
|
|
14165
14062
|
contentPlacement,
|
|
14166
14063
|
volumeValue
|
|
14167
14064
|
}) => css`
|
|
14168
|
-
--
|
|
14065
|
+
--rm-audio-player-volume-value: ${volumeValue}%;
|
|
14169
14066
|
position: relative;
|
|
14170
14067
|
height: 119px;
|
|
14171
14068
|
width: 32px;
|
|
@@ -14178,8 +14075,8 @@ const VolumeSliderContainer = styled.div`
|
|
|
14178
14075
|
|
|
14179
14076
|
.volume-panel-wrapper {
|
|
14180
14077
|
width: 30px;
|
|
14181
|
-
background-color: var(--
|
|
14182
|
-
border: 1px solid var(--
|
|
14078
|
+
background-color: var(--rm-audio-player-volume-panel-background);
|
|
14079
|
+
border: 1px solid var(--rm-audio-player-volume-panel-border);
|
|
14183
14080
|
border-radius: 5px;
|
|
14184
14081
|
height: 118px;
|
|
14185
14082
|
box-shadow: 0 2px 4px rgb(0 0 0 /10%);
|
|
@@ -14194,8 +14091,8 @@ const VolumeSliderContainer = styled.div`
|
|
|
14194
14091
|
bottom: -10px;
|
|
14195
14092
|
left: 7.9px;
|
|
14196
14093
|
border-color: transparent transparent
|
|
14197
|
-
var(--
|
|
14198
|
-
var(--
|
|
14094
|
+
var(--rm-audio-player-volume-panel-border)
|
|
14095
|
+
var(--rm-audio-player-volume-panel-border);
|
|
14199
14096
|
border-style: solid;
|
|
14200
14097
|
border-width: 5px;
|
|
14201
14098
|
box-shadow: -3px 3px 4px rgb(0 0 0 / 10%);
|
|
@@ -14215,8 +14112,8 @@ const VolumeSliderContainer = styled.div`
|
|
|
14215
14112
|
bottom: -8px;
|
|
14216
14113
|
left: 9px;
|
|
14217
14114
|
border-color: transparent transparent
|
|
14218
|
-
var(--
|
|
14219
|
-
var(--
|
|
14115
|
+
var(--rm-audio-player-volume-panel-background)
|
|
14116
|
+
var(--rm-audio-player-volume-panel-background);
|
|
14220
14117
|
border-style: solid;
|
|
14221
14118
|
border-width: 4px;
|
|
14222
14119
|
z-index: 1;
|
|
@@ -14242,7 +14139,7 @@ const VolumeSliderContainer = styled.div`
|
|
|
14242
14139
|
height: 2px;
|
|
14243
14140
|
width: 92px;
|
|
14244
14141
|
-webkit-appearance: none;
|
|
14245
|
-
background-color: var(--
|
|
14142
|
+
background-color: var(--rm-audio-player-volume-background);
|
|
14246
14143
|
outline-color: transparent;
|
|
14247
14144
|
transform-origin: 75px 75px;
|
|
14248
14145
|
transform: rotate(-90deg);
|
|
@@ -14258,7 +14155,7 @@ const VolumeSliderContainer = styled.div`
|
|
|
14258
14155
|
height: 16px;
|
|
14259
14156
|
border-radius: 12px;
|
|
14260
14157
|
overflow: visible;
|
|
14261
|
-
background: var(--
|
|
14158
|
+
background: var(--rm-audio-player-volume-thumb);
|
|
14262
14159
|
}
|
|
14263
14160
|
|
|
14264
14161
|
&::-moz-range-thumb {
|
|
@@ -14266,7 +14163,7 @@ const VolumeSliderContainer = styled.div`
|
|
|
14266
14163
|
height: 16px;
|
|
14267
14164
|
border-radius: 12px;
|
|
14268
14165
|
overflow: visible;
|
|
14269
|
-
background: var(--
|
|
14166
|
+
background: var(--rm-audio-player-volume-thumb);
|
|
14270
14167
|
border: none;
|
|
14271
14168
|
}
|
|
14272
14169
|
&::-moz-range-track {
|
|
@@ -14284,9 +14181,9 @@ const VolumeSliderContainer = styled.div`
|
|
|
14284
14181
|
background-size: 100% 3px;
|
|
14285
14182
|
background-image: linear-gradient(
|
|
14286
14183
|
90deg,
|
|
14287
|
-
var(--
|
|
14288
|
-
var(--
|
|
14289
|
-
var(--
|
|
14184
|
+
var(--rm-audio-player-volume-fill) var(--rm-audio-player-volume-value),
|
|
14185
|
+
var(--rm-audio-player-volume-track)
|
|
14186
|
+
var(--rm-audio-player-volume-value)
|
|
14290
14187
|
);
|
|
14291
14188
|
}
|
|
14292
14189
|
|
|
@@ -14305,9 +14202,9 @@ const VolumeSliderContainer = styled.div`
|
|
|
14305
14202
|
background-size: 100% 3px;
|
|
14306
14203
|
background-image: linear-gradient(
|
|
14307
14204
|
90deg,
|
|
14308
|
-
var(--
|
|
14309
|
-
var(--
|
|
14310
|
-
var(--
|
|
14205
|
+
var(--rm-audio-player-volume-fill) var(--rm-audio-player-volume-value),
|
|
14206
|
+
var(--rm-audio-player-volume-track)
|
|
14207
|
+
var(--rm-audio-player-volume-value)
|
|
14311
14208
|
);
|
|
14312
14209
|
}
|
|
14313
14210
|
}
|
|
@@ -14367,6 +14264,7 @@ const Dropdown = ({
|
|
|
14367
14264
|
children,
|
|
14368
14265
|
isOpen: isOpenProp,
|
|
14369
14266
|
placement = "bottom",
|
|
14267
|
+
disabled = false,
|
|
14370
14268
|
onOpenChange
|
|
14371
14269
|
}) => {
|
|
14372
14270
|
const dropdownRef = useRef(null);
|
|
@@ -14397,7 +14295,7 @@ const Dropdown = ({
|
|
|
14397
14295
|
onOpenChange
|
|
14398
14296
|
},
|
|
14399
14297
|
children: /* @__PURE__ */ jsxs(Fragment, {
|
|
14400
|
-
children: [trigger, content]
|
|
14298
|
+
children: [trigger, !disabled && content]
|
|
14401
14299
|
})
|
|
14402
14300
|
})
|
|
14403
14301
|
});
|
|
@@ -14474,7 +14372,7 @@ const DropdownContent = ({
|
|
|
14474
14372
|
onExited,
|
|
14475
14373
|
onEntered,
|
|
14476
14374
|
children: Content
|
|
14477
|
-
}) : Content;
|
|
14375
|
+
}) : isOpen ? Content : null;
|
|
14478
14376
|
};
|
|
14479
14377
|
const DropdownContentContainer = styled.div`
|
|
14480
14378
|
${({
|
|
@@ -14501,11 +14399,12 @@ const DropdownTrigger = ({
|
|
|
14501
14399
|
Dropdown.Content = DropdownContent;
|
|
14502
14400
|
Dropdown.Trigger = DropdownTrigger;
|
|
14503
14401
|
const Volume = () => {
|
|
14504
|
-
|
|
14402
|
+
const triggerRef = useRef(null);
|
|
14505
14403
|
const {
|
|
14506
|
-
activeUI
|
|
14404
|
+
activeUI: {
|
|
14405
|
+
volumeSlider
|
|
14406
|
+
}
|
|
14507
14407
|
} = useNonNullableContext(audioPlayerStateContext);
|
|
14508
|
-
const triggerRef = useRef(null);
|
|
14509
14408
|
const [volumeSliderPlacement, setVolumeSliderPlacement] = useState("bottom");
|
|
14510
14409
|
useEffect(() => {
|
|
14511
14410
|
if (triggerRef.current) {
|
|
@@ -14518,9 +14417,10 @@ const Volume = () => {
|
|
|
14518
14417
|
setVolumeSliderPlacement(placementValidation());
|
|
14519
14418
|
}
|
|
14520
14419
|
}, [triggerRef.current]);
|
|
14521
|
-
return
|
|
14420
|
+
return /* @__PURE__ */ jsxs(Dropdown, {
|
|
14522
14421
|
placement: volumeSliderPlacement,
|
|
14523
14422
|
triggerType: "hover",
|
|
14423
|
+
disabled: volumeSlider,
|
|
14524
14424
|
children: [/* @__PURE__ */ jsx(Dropdown.Trigger, {
|
|
14525
14425
|
children: /* @__PURE__ */ jsx(VolumeTriggerBtn, {
|
|
14526
14426
|
ref: triggerRef
|
|
@@ -14530,38 +14430,46 @@ const Volume = () => {
|
|
|
14530
14430
|
placement: volumeSliderPlacement
|
|
14531
14431
|
})
|
|
14532
14432
|
})]
|
|
14533
|
-
})
|
|
14433
|
+
});
|
|
14534
14434
|
};
|
|
14535
14435
|
const Controller = () => {
|
|
14536
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
14436
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
14537
14437
|
const {
|
|
14538
|
-
interfacePlacement
|
|
14438
|
+
interfacePlacement,
|
|
14439
|
+
activeUI
|
|
14539
14440
|
} = useNonNullableContext(audioPlayerStateContext);
|
|
14540
14441
|
return /* @__PURE__ */ jsxs(Fragment, {
|
|
14541
14442
|
children: [/* @__PURE__ */ jsx(Grid.Item, {
|
|
14542
14443
|
gridArea: ((_a2 = interfacePlacement == null ? void 0 : interfacePlacement.itemCustomArea) == null ? void 0 : _a2.progress) || ((_b = interfacePlacement == null ? void 0 : interfacePlacement.templateArea) == null ? void 0 : _b.progress) || defaultInterfacePlacement.templateArea.progress,
|
|
14543
14444
|
width: "100%",
|
|
14445
|
+
visible: Boolean(activeUI.progress !== void 0 ? activeUI.progress : activeUI.all),
|
|
14544
14446
|
children: /* @__PURE__ */ jsx(Progress, {})
|
|
14545
14447
|
}), /* @__PURE__ */ jsx(Grid.Item, {
|
|
14546
14448
|
gridArea: ((_c = interfacePlacement == null ? void 0 : interfacePlacement.itemCustomArea) == null ? void 0 : _c.repeatType) || ((_d = interfacePlacement == null ? void 0 : interfacePlacement.templateArea) == null ? void 0 : _d.repeatType) || defaultInterfacePlacement.templateArea.repeatType,
|
|
14449
|
+
visible: Boolean((_e = activeUI.repeatType) != null ? _e : activeUI.all),
|
|
14547
14450
|
children: /* @__PURE__ */ jsx(RepeatTypeBtn, {})
|
|
14548
14451
|
}), /* @__PURE__ */ jsx(Grid.Item, {
|
|
14549
|
-
gridArea: ((
|
|
14452
|
+
gridArea: ((_f = interfacePlacement == null ? void 0 : interfacePlacement.itemCustomArea) == null ? void 0 : _f.playButton) || ((_g = interfacePlacement == null ? void 0 : interfacePlacement.templateArea) == null ? void 0 : _g.playButton) || defaultInterfacePlacement.templateArea.playButton,
|
|
14453
|
+
visible: Boolean((_h = activeUI.playButton) != null ? _h : activeUI.all),
|
|
14550
14454
|
children: /* @__PURE__ */ jsxs($884c64d19340d345$export$f51f4c4ede09e011, {
|
|
14551
14455
|
UNSAFE_className: "btn-wrapper",
|
|
14552
14456
|
alignItems: "center",
|
|
14553
14457
|
gap: "10px",
|
|
14554
14458
|
children: [/* @__PURE__ */ jsx(PrevNnextBtn, {
|
|
14555
|
-
type: "prev"
|
|
14459
|
+
type: "prev",
|
|
14460
|
+
visible: Boolean((_i = activeUI.prevNnext) != null ? _i : activeUI.all)
|
|
14556
14461
|
}), /* @__PURE__ */ jsx(PlayBtn, {}), /* @__PURE__ */ jsx(PrevNnextBtn, {
|
|
14557
|
-
type: "next"
|
|
14462
|
+
type: "next",
|
|
14463
|
+
visible: Boolean((_j = activeUI.prevNnext) != null ? _j : activeUI.all)
|
|
14558
14464
|
})]
|
|
14559
14465
|
})
|
|
14560
14466
|
}), /* @__PURE__ */ jsx(Grid.Item, {
|
|
14561
|
-
gridArea: ((
|
|
14467
|
+
gridArea: ((_k = interfacePlacement == null ? void 0 : interfacePlacement.itemCustomArea) == null ? void 0 : _k.volume) || ((_l = interfacePlacement == null ? void 0 : interfacePlacement.templateArea) == null ? void 0 : _l.volume) || defaultInterfacePlacement.templateArea.volume,
|
|
14468
|
+
visible: Boolean((_m = activeUI.volume) != null ? _m : activeUI.all),
|
|
14562
14469
|
children: /* @__PURE__ */ jsx(Volume, {})
|
|
14563
14470
|
}), /* @__PURE__ */ jsx(Grid.Item, {
|
|
14564
|
-
gridArea: ((
|
|
14471
|
+
gridArea: ((_n = interfacePlacement == null ? void 0 : interfacePlacement.itemCustomArea) == null ? void 0 : _n.playList) || ((_o = interfacePlacement == null ? void 0 : interfacePlacement.templateArea) == null ? void 0 : _o.playList) || defaultInterfacePlacement.templateArea.playList,
|
|
14472
|
+
visible: Boolean((_p = activeUI.playList) != null ? _p : activeUI.all),
|
|
14565
14473
|
children: /* @__PURE__ */ jsx(SortablePlayList, {})
|
|
14566
14474
|
})]
|
|
14567
14475
|
});
|
|
@@ -14579,19 +14487,18 @@ const ArtworkContainer = styled.div`
|
|
|
14579
14487
|
const Artwork = () => {
|
|
14580
14488
|
var _a2;
|
|
14581
14489
|
const {
|
|
14582
|
-
activeUI,
|
|
14583
14490
|
playList,
|
|
14584
14491
|
curIdx,
|
|
14585
14492
|
coverImgsCss
|
|
14586
14493
|
} = useNonNullableContext(audioPlayerStateContext);
|
|
14587
|
-
return
|
|
14494
|
+
return /* @__PURE__ */ jsx(ArtworkContainer, {
|
|
14588
14495
|
className: "artwork-container",
|
|
14589
14496
|
children: /* @__PURE__ */ jsx("img", {
|
|
14590
|
-
src: playList[curIdx].img,
|
|
14497
|
+
src: (_a2 = playList[curIdx]) == null ? void 0 : _a2.img,
|
|
14591
14498
|
alt: "",
|
|
14592
14499
|
style: coverImgsCss == null ? void 0 : coverImgsCss.artwork
|
|
14593
14500
|
})
|
|
14594
|
-
})
|
|
14501
|
+
});
|
|
14595
14502
|
};
|
|
14596
14503
|
const TrackInfoContainer = styled.div`
|
|
14597
14504
|
display: grid;
|
|
@@ -14604,35 +14511,32 @@ const TrackInfoContainer = styled.div`
|
|
|
14604
14511
|
overflow: hidden;
|
|
14605
14512
|
}
|
|
14606
14513
|
.title {
|
|
14607
|
-
font-size:
|
|
14514
|
+
font-size: 16px;
|
|
14608
14515
|
}
|
|
14609
14516
|
.writer {
|
|
14610
|
-
font-size:
|
|
14517
|
+
font-size: 12px;
|
|
14611
14518
|
}
|
|
14612
14519
|
`;
|
|
14613
14520
|
const TrackInfo = () => {
|
|
14614
|
-
var _a2;
|
|
14615
14521
|
const {
|
|
14616
|
-
activeUI,
|
|
14617
14522
|
playList,
|
|
14618
14523
|
curIdx
|
|
14619
14524
|
} = useNonNullableContext(audioPlayerStateContext);
|
|
14620
14525
|
const curPlayData = playList[curIdx];
|
|
14621
|
-
return
|
|
14526
|
+
return /* @__PURE__ */ jsx(TrackInfoContainer, {
|
|
14622
14527
|
className: "track-info-container",
|
|
14623
|
-
children: curPlayData.customTrackInfo ? curPlayData.customTrackInfo : /* @__PURE__ */ jsxs(Fragment, {
|
|
14624
|
-
children: [curPlayData.name && /* @__PURE__ */ jsx("span", {
|
|
14528
|
+
children: (curPlayData == null ? void 0 : curPlayData.customTrackInfo) ? curPlayData.customTrackInfo : /* @__PURE__ */ jsxs(Fragment, {
|
|
14529
|
+
children: [(curPlayData == null ? void 0 : curPlayData.name) && /* @__PURE__ */ jsx("span", {
|
|
14625
14530
|
className: "title",
|
|
14626
14531
|
children: curPlayData.name
|
|
14627
|
-
}), curPlayData.writer && /* @__PURE__ */ jsx("span", {
|
|
14532
|
+
}), (curPlayData == null ? void 0 : curPlayData.writer) && /* @__PURE__ */ jsx("span", {
|
|
14628
14533
|
className: "writer",
|
|
14629
14534
|
children: curPlayData.writer
|
|
14630
14535
|
})]
|
|
14631
14536
|
})
|
|
14632
|
-
})
|
|
14537
|
+
});
|
|
14633
14538
|
};
|
|
14634
14539
|
const TrackTimeCurrent = () => {
|
|
14635
|
-
var _a2;
|
|
14636
14540
|
const trackCurTimeRef = useRef(null);
|
|
14637
14541
|
const {
|
|
14638
14542
|
activeUI
|
|
@@ -14649,7 +14553,7 @@ const TrackTimeCurrent = () => {
|
|
|
14649
14553
|
});
|
|
14650
14554
|
}
|
|
14651
14555
|
}, [trackCurTimeRef.current, audioPlayerDispatch]);
|
|
14652
|
-
return
|
|
14556
|
+
return /* @__PURE__ */ jsx(TrackTimeCurrentContainer, {
|
|
14653
14557
|
type: activeUI.trackTime,
|
|
14654
14558
|
className: "track-time-current-container",
|
|
14655
14559
|
children: /* @__PURE__ */ jsx("span", {
|
|
@@ -14657,10 +14561,9 @@ const TrackTimeCurrent = () => {
|
|
|
14657
14561
|
className: "track-current-time",
|
|
14658
14562
|
children: "00:00"
|
|
14659
14563
|
})
|
|
14660
|
-
})
|
|
14564
|
+
});
|
|
14661
14565
|
};
|
|
14662
14566
|
const TrackTimeDuration = () => {
|
|
14663
|
-
var _a2;
|
|
14664
14567
|
const trackDurationRef = useRef(null);
|
|
14665
14568
|
const {
|
|
14666
14569
|
activeUI
|
|
@@ -14677,7 +14580,7 @@ const TrackTimeDuration = () => {
|
|
|
14677
14580
|
});
|
|
14678
14581
|
}
|
|
14679
14582
|
}, [trackDurationRef.current, audioPlayerDispatch]);
|
|
14680
|
-
return
|
|
14583
|
+
return /* @__PURE__ */ jsx(TrackTimeDurationContainer, {
|
|
14681
14584
|
type: activeUI.trackTime,
|
|
14682
14585
|
className: "track-time-duration-container",
|
|
14683
14586
|
children: /* @__PURE__ */ jsx("span", {
|
|
@@ -14685,15 +14588,15 @@ const TrackTimeDuration = () => {
|
|
|
14685
14588
|
className: "track-duration",
|
|
14686
14589
|
children: "00:00"
|
|
14687
14590
|
})
|
|
14688
|
-
})
|
|
14591
|
+
});
|
|
14689
14592
|
};
|
|
14690
14593
|
const TrackTimeContainer = styled.div`
|
|
14691
14594
|
display: flex;
|
|
14692
14595
|
align-items: center;
|
|
14693
14596
|
justify-content: center;
|
|
14694
14597
|
min-height: 16px;
|
|
14695
|
-
font-family: monospace;
|
|
14696
|
-
font-size:
|
|
14598
|
+
font-family: monospace !important;
|
|
14599
|
+
font-size: 16px !important;
|
|
14697
14600
|
`;
|
|
14698
14601
|
const TrackTimeCurrentContainer = styled(TrackTimeContainer)`
|
|
14699
14602
|
${({
|
|
@@ -14702,7 +14605,7 @@ const TrackTimeCurrentContainer = styled(TrackTimeContainer)`
|
|
|
14702
14605
|
.track-current-time {
|
|
14703
14606
|
font-weight: 700;
|
|
14704
14607
|
letter-spacing: -0.1rem;
|
|
14705
|
-
color: var(--
|
|
14608
|
+
color: var(--rm-audio-player-track-current-time);
|
|
14706
14609
|
margin-right: ${type !== "separation-mode" && "-10px"};
|
|
14707
14610
|
}
|
|
14708
14611
|
`}
|
|
@@ -14713,7 +14616,7 @@ const TrackTimeDurationContainer = styled(TrackTimeContainer)`
|
|
|
14713
14616
|
}) => css`
|
|
14714
14617
|
.track-duration {
|
|
14715
14618
|
display: flex;
|
|
14716
|
-
color: var(--
|
|
14619
|
+
color: var(--rm-audio-player-track-duration);
|
|
14717
14620
|
letter-spacing: -0.1rem;
|
|
14718
14621
|
}
|
|
14719
14622
|
${type !== "separation-mode" && css`
|
|
@@ -14725,69 +14628,89 @@ const TrackTimeDurationContainer = styled(TrackTimeContainer)`
|
|
|
14725
14628
|
`}
|
|
14726
14629
|
`;
|
|
14727
14630
|
const Information = () => {
|
|
14728
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
14631
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
14729
14632
|
const {
|
|
14730
|
-
interfacePlacement
|
|
14633
|
+
interfacePlacement,
|
|
14634
|
+
playList,
|
|
14635
|
+
curIdx,
|
|
14636
|
+
activeUI
|
|
14731
14637
|
} = useNonNullableContext(audioPlayerStateContext);
|
|
14638
|
+
const trackInfoActive = Boolean((_e = (_c = (_a2 = playList[curIdx]) == null ? void 0 : _a2.customTrackInfo) != null ? _c : (_b = playList[curIdx]) == null ? void 0 : _b.writer) != null ? _e : (_d = playList[curIdx]) == null ? void 0 : _d.name) && Boolean((_f = activeUI.trackInfo) != null ? _f : activeUI.all);
|
|
14732
14639
|
return /* @__PURE__ */ jsxs(Fragment, {
|
|
14733
14640
|
children: [/* @__PURE__ */ jsx(Grid.Item, {
|
|
14734
|
-
gridArea: ((
|
|
14641
|
+
gridArea: ((_g = interfacePlacement == null ? void 0 : interfacePlacement.itemCustomArea) == null ? void 0 : _g.artwork) || ((_h = interfacePlacement == null ? void 0 : interfacePlacement.templateArea) == null ? void 0 : _h.artwork) || defaultInterfacePlacement.templateArea.artwork,
|
|
14642
|
+
visible: Boolean(((_i = playList[curIdx]) == null ? void 0 : _i.img) && ((_j = activeUI.artwork) != null ? _j : activeUI.all)),
|
|
14735
14643
|
children: /* @__PURE__ */ jsx(Artwork, {})
|
|
14736
14644
|
}), /* @__PURE__ */ jsx(Grid.Item, {
|
|
14737
|
-
gridArea: ((
|
|
14738
|
-
|
|
14645
|
+
gridArea: ((_k = interfacePlacement == null ? void 0 : interfacePlacement.itemCustomArea) == null ? void 0 : _k.trackInfo) || ((_l = interfacePlacement == null ? void 0 : interfacePlacement.templateArea) == null ? void 0 : _l.trackInfo) || defaultInterfacePlacement.templateArea.trackInfo,
|
|
14646
|
+
visible: trackInfoActive,
|
|
14739
14647
|
children: /* @__PURE__ */ jsx(TrackInfo, {})
|
|
14740
14648
|
}), /* @__PURE__ */ jsx(Grid.Item, {
|
|
14741
|
-
gridArea: ((
|
|
14742
|
-
|
|
14649
|
+
gridArea: ((_m = interfacePlacement == null ? void 0 : interfacePlacement.itemCustomArea) == null ? void 0 : _m.trackTimeCurrent) || ((_n = interfacePlacement == null ? void 0 : interfacePlacement.templateArea) == null ? void 0 : _n.trackTimeCurrent) || defaultInterfacePlacement.templateArea.trackTimeCurrent,
|
|
14650
|
+
visible: Boolean((_o = activeUI.trackTime) != null ? _o : activeUI.all),
|
|
14743
14651
|
children: /* @__PURE__ */ jsx(TrackTimeCurrent, {})
|
|
14744
14652
|
}), /* @__PURE__ */ jsx(Grid.Item, {
|
|
14745
|
-
gridArea: ((
|
|
14746
|
-
|
|
14653
|
+
gridArea: ((_p = interfacePlacement == null ? void 0 : interfacePlacement.itemCustomArea) == null ? void 0 : _p.trackTimeDuration) || ((_q = interfacePlacement == null ? void 0 : interfacePlacement.templateArea) == null ? void 0 : _q.trackTimeDuration) || defaultInterfacePlacement.templateArea.trackTimeDuration,
|
|
14654
|
+
visible: Boolean((_r = activeUI.trackTime) != null ? _r : activeUI.all),
|
|
14747
14655
|
children: /* @__PURE__ */ jsx(TrackTimeDuration, {})
|
|
14748
14656
|
})]
|
|
14749
14657
|
});
|
|
14750
14658
|
};
|
|
14751
14659
|
const generateGridTemplateValues = (activeUi, placement) => {
|
|
14752
|
-
|
|
14753
|
-
|
|
14754
|
-
|
|
14755
|
-
const getMaxLength = () => {
|
|
14756
|
-
if (placementValueArr.length !== 0) {
|
|
14757
|
-
for (let i = 0; i < placementValueArr.length; i++) {
|
|
14758
|
-
const row = placementValueArr[i].split("-")[0];
|
|
14759
|
-
const col = placementValueArr[i].split("-")[1];
|
|
14760
|
-
maxRowLength = Math.max(maxRowLength, +row);
|
|
14761
|
-
maxColLength = Math.max(maxColLength, +col);
|
|
14762
|
-
}
|
|
14660
|
+
const activeUIArr = activeUi.all ? Object.keys(defaultInterfacePlacement.templateArea).filter((key) => {
|
|
14661
|
+
if ((key === "trackTimeCurrent" || key === "trackTimeDuration") && activeUi.trackTime === false) {
|
|
14662
|
+
return false;
|
|
14763
14663
|
}
|
|
14764
|
-
if (activeUi
|
|
14765
|
-
|
|
14766
|
-
|
|
14664
|
+
if (activeUi[key] !== void 0) {
|
|
14665
|
+
return activeUi[key];
|
|
14666
|
+
}
|
|
14667
|
+
return true;
|
|
14668
|
+
}) : Object.entries(activeUi).filter(([, value]) => value).map(([key]) => key);
|
|
14669
|
+
const renameTrackTime = () => {
|
|
14670
|
+
if (activeUIArr.find((key) => key === "trackTime")) {
|
|
14671
|
+
activeUIArr.splice(activeUIArr.indexOf("trackTime"), 1);
|
|
14672
|
+
activeUIArr.push("trackTimeCurrent");
|
|
14673
|
+
activeUIArr.push("trackTimeDuration");
|
|
14767
14674
|
}
|
|
14768
|
-
maxColLength = Object.values(activeUi).filter((boolean) => Boolean(boolean)).length;
|
|
14769
|
-
return;
|
|
14770
14675
|
};
|
|
14771
|
-
|
|
14772
|
-
const
|
|
14676
|
+
renameTrackTime();
|
|
14677
|
+
const newInterfacePlacement = {
|
|
14678
|
+
...defaultInterfacePlacement.templateArea,
|
|
14679
|
+
...placement
|
|
14680
|
+
};
|
|
14681
|
+
const placementArr = Object.entries(newInterfacePlacement).map(([key, value]) => {
|
|
14682
|
+
const [row, col] = value.split("-");
|
|
14683
|
+
return {
|
|
14684
|
+
key,
|
|
14685
|
+
row: Number(row.split("row")[1]),
|
|
14686
|
+
col: Number(col)
|
|
14687
|
+
};
|
|
14688
|
+
}).filter(({ key }) => activeUIArr.includes(key)).sort((a, b) => a.col - b.col);
|
|
14689
|
+
let maxRow = 1;
|
|
14690
|
+
const getMaxRow = () => {
|
|
14691
|
+
for (let i = 0; i < placementArr.length; i++) {
|
|
14692
|
+
maxRow = Math.max(maxRow, placementArr[i].row);
|
|
14693
|
+
}
|
|
14694
|
+
};
|
|
14695
|
+
getMaxRow();
|
|
14696
|
+
const gridAreas = new Array(maxRow).fill("").map((_, rowIdx) => {
|
|
14773
14697
|
let cols = "";
|
|
14774
|
-
for (let i = 0; i <
|
|
14775
|
-
cols += ` row${rowIdx + 1}-${i
|
|
14698
|
+
for (let i = 0; i < placementArr.length; i++) {
|
|
14699
|
+
cols += ` row${rowIdx + 1}-${placementArr[i].col}`;
|
|
14776
14700
|
if (i === 0) {
|
|
14777
14701
|
cols = cols.trim();
|
|
14778
14702
|
}
|
|
14779
14703
|
}
|
|
14780
14704
|
return cols;
|
|
14781
14705
|
});
|
|
14782
|
-
const gridColumns = new Array(
|
|
14706
|
+
const gridColumns = new Array(maxRow).fill("").map((_, rowIdx) => {
|
|
14783
14707
|
const maxWidth = window ? window.innerWidth - 100 : 1500;
|
|
14784
|
-
const [, progressCol] = ((placement == null ? void 0 : placement.progress) || defaultInterfacePlacement.templateArea.progress).replace("row", "").split("-");
|
|
14785
14708
|
let cols = "";
|
|
14786
|
-
for (let i = 0; i <
|
|
14709
|
+
for (let i = 0; i < placementArr.length; i++) {
|
|
14787
14710
|
if (i === 0) {
|
|
14788
14711
|
cols = cols.trim();
|
|
14789
14712
|
}
|
|
14790
|
-
if (rowIdx === 0 && i
|
|
14713
|
+
if (rowIdx === 0 && placementArr[i].key === "progress") {
|
|
14791
14714
|
cols += ` 1fr`;
|
|
14792
14715
|
continue;
|
|
14793
14716
|
}
|
|
@@ -14798,9 +14721,16 @@ const generateGridTemplateValues = (activeUi, placement) => {
|
|
|
14798
14721
|
return { gridAreas, gridColumns };
|
|
14799
14722
|
};
|
|
14800
14723
|
const InterfaceContainer = styled.div`
|
|
14724
|
+
.interface-grid {
|
|
14725
|
+
background: var(--rm-audio-player-interface-container);
|
|
14726
|
+
}
|
|
14801
14727
|
.interface-grid {
|
|
14802
14728
|
padding: 0.5rem 10px;
|
|
14803
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
|
+
}
|
|
14804
14734
|
`;
|
|
14805
14735
|
const Interface = () => {
|
|
14806
14736
|
const {
|
|
@@ -14890,8 +14820,8 @@ const AudioPlayer = ({
|
|
|
14890
14820
|
}
|
|
14891
14821
|
}, [customIcons, audioPlayerDispatch]);
|
|
14892
14822
|
return /* @__PURE__ */ jsxs($b9606c0c41d55371$export$27a5bd065ad55220, {
|
|
14893
|
-
id: "
|
|
14894
|
-
UNSAFE_className: "
|
|
14823
|
+
id: "rm-audio-player",
|
|
14824
|
+
UNSAFE_className: "rm-audio-player-container",
|
|
14895
14825
|
children: [/* @__PURE__ */ jsx(Audio, {}), /* @__PURE__ */ jsx(Interface, {})]
|
|
14896
14826
|
});
|
|
14897
14827
|
};
|
|
@@ -14902,9 +14832,9 @@ const AudioPlayerWithProvider = ({
|
|
|
14902
14832
|
return /* @__PURE__ */ jsx(AudioPlayerProvider, {
|
|
14903
14833
|
children: /* @__PURE__ */ jsxs(SpectrumProvider, {
|
|
14904
14834
|
rootContainerProps,
|
|
14905
|
-
children: [/* @__PURE__ */ jsx(
|
|
14835
|
+
children: [/* @__PURE__ */ jsx(AudioPlayer, {
|
|
14906
14836
|
...audioPlayProps
|
|
14907
|
-
})]
|
|
14837
|
+
}), /* @__PURE__ */ jsx(GlobalStyle, {})]
|
|
14908
14838
|
})
|
|
14909
14839
|
});
|
|
14910
14840
|
};
|