react-modern-audio-player 1.2.4 → 1.2.5
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 +13 -5
- package/dist/index.es.js +175 -108
- package/dist/types/components/AudioPlayer/index.d.ts +2 -1
- package/dist/types/hooks/useGridTemplate.d.ts +2 -0
- package/dist/types/index.d.ts +4 -1
- package/dist/types/utils/getRandomNumber.d.ts +1 -0
- package/package.json +1 -1
- package/dist/types/utils/generateGridTemplateValues.d.ts +0 -5
package/README.md
CHANGED
|
@@ -84,6 +84,7 @@ interface AudioPlayerProps {
|
|
|
84
84
|
interface?: InterfacePlacement;
|
|
85
85
|
volumeSlider?: VolumeSliderPlacement;
|
|
86
86
|
};
|
|
87
|
+
rootContainerProps?: RootContainerProps
|
|
87
88
|
}
|
|
88
89
|
```
|
|
89
90
|
|
|
@@ -95,6 +96,7 @@ Prop | Type | Default
|
|
|
95
96
|
`customIcons` | [CustomIcons](#customicons) | undefined
|
|
96
97
|
`coverImgsCss` | [CoverImgsCss](#coverimgscss) | undefined
|
|
97
98
|
`placement` | [Placement](#placement) | playListPlacement : "bottom" </br>interfacePlacement :[DefaultInterfacePlacement](#default-interface-placement)
|
|
99
|
+
`rootContainerProps` | [RootContainerProps](#rootcontainerprops) | theme: spectrum-theme-default<br/>width: 100% <br/>position: 'static'<br/>UNSAFE_className: rm-audio-player-provider
|
|
98
100
|
|
|
99
101
|
## PlayList
|
|
100
102
|
|
|
@@ -111,7 +113,7 @@ type AudioData = {
|
|
|
111
113
|
};
|
|
112
114
|
```
|
|
113
115
|
|
|
114
|
-
##
|
|
116
|
+
## AudioInitialState
|
|
115
117
|
|
|
116
118
|
```tsx
|
|
117
119
|
type AudioInitialState = Omit<
|
|
@@ -127,7 +129,7 @@ type AudioInitialState = Omit<
|
|
|
127
129
|
};
|
|
128
130
|
```
|
|
129
131
|
|
|
130
|
-
##
|
|
132
|
+
## ActiveUI
|
|
131
133
|
|
|
132
134
|
```tsx
|
|
133
135
|
type ActiveUI = {
|
|
@@ -147,7 +149,7 @@ type ProgressUI = "waveform" | "bar" | false;
|
|
|
147
149
|
type PlayListUI = "sortable" | "unSortable" | false;
|
|
148
150
|
```
|
|
149
151
|
|
|
150
|
-
##
|
|
152
|
+
## CustomIcons
|
|
151
153
|
|
|
152
154
|
```tsx
|
|
153
155
|
type CustomIcons = {
|
|
@@ -166,7 +168,7 @@ type CustomIcons = {
|
|
|
166
168
|
};
|
|
167
169
|
```
|
|
168
170
|
|
|
169
|
-
##
|
|
171
|
+
## CoverImgsCss
|
|
170
172
|
|
|
171
173
|
```tsx
|
|
172
174
|
interface CoverImgsCss {
|
|
@@ -175,7 +177,7 @@ interface CoverImgsCss {
|
|
|
175
177
|
}
|
|
176
178
|
```
|
|
177
179
|
|
|
178
|
-
##
|
|
180
|
+
## Placement
|
|
179
181
|
|
|
180
182
|
```tsx
|
|
181
183
|
type PlayerPlacement =
|
|
@@ -229,6 +231,12 @@ const defaultInterfacePlacement = {
|
|
|
229
231
|
};
|
|
230
232
|
```
|
|
231
233
|
|
|
234
|
+
## RootContainerProps
|
|
235
|
+
> it is same with spectrum provider props
|
|
236
|
+
> </br>
|
|
237
|
+
> https://react-spectrum.adobe.com/react-spectrum/Provider.html#themes
|
|
238
|
+
|
|
239
|
+
|
|
232
240
|
# Override Style
|
|
233
241
|
|
|
234
242
|
### Theme mode ( dark-mode )
|
package/dist/index.es.js
CHANGED
|
@@ -1083,6 +1083,7 @@ const useNonNullableContext = (context) => {
|
|
|
1083
1083
|
throw new Error(`${context} is not provided or null`);
|
|
1084
1084
|
return state;
|
|
1085
1085
|
};
|
|
1086
|
+
const interfacePlacementMaxLength = 10;
|
|
1086
1087
|
const defaultInterfacePlacement = {
|
|
1087
1088
|
templateArea: {
|
|
1088
1089
|
artwork: "row1-1",
|
|
@@ -1189,6 +1190,9 @@ const SpectrumProvider = ({
|
|
|
1189
1190
|
});
|
|
1190
1191
|
};
|
|
1191
1192
|
const audioPlayerDispatchContext = createContext(null);
|
|
1193
|
+
const getRandomNumber = (min, max) => {
|
|
1194
|
+
return Math.round(Math.random() * (max - min) + min);
|
|
1195
|
+
};
|
|
1192
1196
|
const getTimeWithPadStart = (time) => {
|
|
1193
1197
|
const minutes = `${Math.floor(time / 60)}`.padStart(2, "0");
|
|
1194
1198
|
const seconds = `${Math.floor(time % 60)}`.padStart(2, "0");
|
|
@@ -1222,6 +1226,13 @@ const resetAudioValues = (elementRefs, duration, restart) => {
|
|
|
1222
1226
|
}
|
|
1223
1227
|
}
|
|
1224
1228
|
};
|
|
1229
|
+
const getRandomIdx = (curIdx, minNumber, maxNumber) => {
|
|
1230
|
+
let nextIdx = getRandomNumber(minNumber, maxNumber);
|
|
1231
|
+
while (nextIdx === curIdx) {
|
|
1232
|
+
nextIdx = getRandomNumber(minNumber, maxNumber);
|
|
1233
|
+
}
|
|
1234
|
+
return nextIdx;
|
|
1235
|
+
};
|
|
1225
1236
|
const audioPlayerReducer = (state, action) => {
|
|
1226
1237
|
var _a, _b, _c, _d;
|
|
1227
1238
|
switch (action.type) {
|
|
@@ -1233,17 +1244,15 @@ const audioPlayerReducer = (state, action) => {
|
|
|
1233
1244
|
};
|
|
1234
1245
|
}
|
|
1235
1246
|
if (state.curAudioState.repeatType === "SHUFFLE") {
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
getShuffledPlayIdx();
|
|
1242
|
-
}
|
|
1247
|
+
const randomIdx = getRandomIdx(
|
|
1248
|
+
state.curIdx,
|
|
1249
|
+
0,
|
|
1250
|
+
state.playList.length - 1
|
|
1251
|
+
);
|
|
1243
1252
|
return {
|
|
1244
1253
|
...state,
|
|
1245
|
-
curPlayId: state.playList[
|
|
1246
|
-
curIdx:
|
|
1254
|
+
curPlayId: state.playList[randomIdx].id,
|
|
1255
|
+
curIdx: randomIdx
|
|
1247
1256
|
};
|
|
1248
1257
|
}
|
|
1249
1258
|
const infiniteLoopNextIdx = (state.curIdx + 1) % state.playList.length;
|
|
@@ -1259,13 +1268,15 @@ const audioPlayerReducer = (state, action) => {
|
|
|
1259
1268
|
return state;
|
|
1260
1269
|
}
|
|
1261
1270
|
if (state.curAudioState.repeatType === "SHUFFLE") {
|
|
1262
|
-
const
|
|
1263
|
-
|
|
1271
|
+
const randomIdx = getRandomIdx(
|
|
1272
|
+
state.curIdx,
|
|
1273
|
+
0,
|
|
1274
|
+
state.playList.length - 1
|
|
1264
1275
|
);
|
|
1265
1276
|
return {
|
|
1266
1277
|
...state,
|
|
1267
|
-
curPlayId: state.playList[
|
|
1268
|
-
curIdx:
|
|
1278
|
+
curPlayId: state.playList[randomIdx].id,
|
|
1279
|
+
curIdx: randomIdx
|
|
1269
1280
|
};
|
|
1270
1281
|
}
|
|
1271
1282
|
const infiniteLoopPrevIdx = (state.curIdx - 1 + state.playList.length) % state.playList.length;
|
|
@@ -7057,12 +7068,18 @@ const useBarProgress = () => {
|
|
|
7057
7068
|
},
|
|
7058
7069
|
[elementRefs == null ? void 0 : elementRefs.audioEl]
|
|
7059
7070
|
);
|
|
7071
|
+
const setSelectStartActive = useCallback(
|
|
7072
|
+
(state) => document.onselectstart = () => state,
|
|
7073
|
+
[]
|
|
7074
|
+
);
|
|
7060
7075
|
return {
|
|
7061
7076
|
onMouseDown: () => setTimeChangeActive(true),
|
|
7062
7077
|
onMouseUp: () => setTimeChangeActive(false),
|
|
7063
7078
|
onMouseLeave: () => setTimeChangeActive(false),
|
|
7064
7079
|
onMouseMove: isTimeChangeActive ? onMoveAudioTime : void 0,
|
|
7065
|
-
onClick: onMoveAudioTime
|
|
7080
|
+
onClick: onMoveAudioTime,
|
|
7081
|
+
onMouseOver: () => setSelectStartActive(false),
|
|
7082
|
+
onMouseOut: () => isTimeChangeActive && setSelectStartActive(true)
|
|
7066
7083
|
};
|
|
7067
7084
|
};
|
|
7068
7085
|
const BarProgress = ({
|
|
@@ -7119,11 +7136,6 @@ const BarProgressWrapper = styled.div`
|
|
|
7119
7136
|
transform-origin: 0 0;
|
|
7120
7137
|
transform: scaleX(0);
|
|
7121
7138
|
}
|
|
7122
|
-
&:hover {
|
|
7123
|
-
.rm-player-progress-handle {
|
|
7124
|
-
opacity: 1;
|
|
7125
|
-
}
|
|
7126
|
-
}
|
|
7127
7139
|
.rm-player-progress-handle {
|
|
7128
7140
|
position: absolute;
|
|
7129
7141
|
left: -4px;
|
|
@@ -7134,6 +7146,11 @@ const BarProgressWrapper = styled.div`
|
|
|
7134
7146
|
opacity: 0;
|
|
7135
7147
|
transition: opacity 0.2s ease-in-out;
|
|
7136
7148
|
}
|
|
7149
|
+
&:hover {
|
|
7150
|
+
.rm-player-progress-handle {
|
|
7151
|
+
opacity: 1;
|
|
7152
|
+
}
|
|
7153
|
+
}
|
|
7137
7154
|
`;
|
|
7138
7155
|
const WaveformWrapper = styled.div`
|
|
7139
7156
|
display: flex;
|
|
@@ -7170,15 +7187,11 @@ const WaveformProgress = ({
|
|
|
7170
7187
|
})
|
|
7171
7188
|
}) : null;
|
|
7172
7189
|
};
|
|
7173
|
-
const ProgressContainer = styled.div`
|
|
7174
|
-
min-width: 200px;
|
|
7175
|
-
padding: 0 10px;
|
|
7176
|
-
`;
|
|
7177
7190
|
const Progress = () => {
|
|
7178
7191
|
const {
|
|
7179
7192
|
activeUI
|
|
7180
7193
|
} = useNonNullableContext(audioPlayerStateContext);
|
|
7181
|
-
return /* @__PURE__ */ jsxs(
|
|
7194
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
7182
7195
|
className: "progress-container",
|
|
7183
7196
|
children: [/* @__PURE__ */ jsx(WaveformProgress, {
|
|
7184
7197
|
isActive: activeUI.progress === "waveform"
|
|
@@ -7488,18 +7501,18 @@ const Dropdown = ({
|
|
|
7488
7501
|
setIsOpen(isOpenProp);
|
|
7489
7502
|
}
|
|
7490
7503
|
}, [isOpenProp]);
|
|
7491
|
-
return /* @__PURE__ */ jsx(
|
|
7492
|
-
|
|
7493
|
-
|
|
7494
|
-
|
|
7495
|
-
|
|
7496
|
-
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
|
|
7502
|
-
|
|
7504
|
+
return /* @__PURE__ */ jsx(dropdownContext.Provider, {
|
|
7505
|
+
value: {
|
|
7506
|
+
dropdownRef,
|
|
7507
|
+
placement,
|
|
7508
|
+
isOpen,
|
|
7509
|
+
setIsOpen,
|
|
7510
|
+
onOpenChange
|
|
7511
|
+
},
|
|
7512
|
+
children: /* @__PURE__ */ jsx(DropdownContainer, {
|
|
7513
|
+
className: "dropdown-container",
|
|
7514
|
+
ref: dropdownRef,
|
|
7515
|
+
...dropdownEventProps,
|
|
7503
7516
|
children: /* @__PURE__ */ jsxs(Fragment, {
|
|
7504
7517
|
children: [trigger, !disabled && content]
|
|
7505
7518
|
})
|
|
@@ -7561,7 +7574,7 @@ const DropdownContent = ({
|
|
|
7561
7574
|
height: dropdownRef.current.offsetHeight
|
|
7562
7575
|
});
|
|
7563
7576
|
}
|
|
7564
|
-
}, [dropdownRef
|
|
7577
|
+
}, [dropdownRef]);
|
|
7565
7578
|
const Content = useMemo(() => dropdownSize ? /* @__PURE__ */ jsx(DropdownContentContainer, {
|
|
7566
7579
|
...dropdownContentProps,
|
|
7567
7580
|
dropdownSize,
|
|
@@ -7632,8 +7645,7 @@ const Volume = () => {
|
|
|
7632
7645
|
const triggerRef = useRef(null);
|
|
7633
7646
|
const {
|
|
7634
7647
|
activeUI: {
|
|
7635
|
-
volumeSlider: volumeSliderEl
|
|
7636
|
-
all: allEl
|
|
7648
|
+
volumeSlider: volumeSliderEl
|
|
7637
7649
|
},
|
|
7638
7650
|
volumeSliderPlacement: contextVolumePlacement
|
|
7639
7651
|
} = useNonNullableContext(audioPlayerStateContext);
|
|
@@ -7644,7 +7656,7 @@ const Volume = () => {
|
|
|
7644
7656
|
return /* @__PURE__ */ jsxs(Dropdown, {
|
|
7645
7657
|
placement: contextVolumePlacement || volumeSliderPlacement,
|
|
7646
7658
|
triggerType: "hover",
|
|
7647
|
-
disabled: !(volumeSliderEl != null ? volumeSliderEl :
|
|
7659
|
+
disabled: !(volumeSliderEl != null ? volumeSliderEl : true),
|
|
7648
7660
|
children: [/* @__PURE__ */ jsx(Dropdown.Trigger, {
|
|
7649
7661
|
children: /* @__PURE__ */ jsx(VolumeTriggerBtn, {
|
|
7650
7662
|
ref: triggerRef
|
|
@@ -7896,69 +7908,127 @@ const Information = () => {
|
|
|
7896
7908
|
}), /* @__PURE__ */ jsx(TrackTime, {})]
|
|
7897
7909
|
});
|
|
7898
7910
|
};
|
|
7899
|
-
const
|
|
7900
|
-
const
|
|
7901
|
-
|
|
7902
|
-
|
|
7903
|
-
|
|
7904
|
-
|
|
7905
|
-
|
|
7906
|
-
|
|
7907
|
-
|
|
7908
|
-
|
|
7909
|
-
|
|
7910
|
-
|
|
7911
|
-
|
|
7912
|
-
|
|
7913
|
-
|
|
7914
|
-
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
|
|
7925
|
-
|
|
7926
|
-
|
|
7927
|
-
|
|
7928
|
-
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
|
|
7933
|
-
|
|
7934
|
-
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
|
|
7946
|
-
|
|
7947
|
-
|
|
7948
|
-
|
|
7949
|
-
|
|
7950
|
-
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
|
|
7911
|
+
const useGridTemplate = (activeUI, templateArea) => {
|
|
7912
|
+
const generateGridTemplateValues = useCallback(
|
|
7913
|
+
(activeUi, placement) => {
|
|
7914
|
+
const activeUIArr = activeUi.all ? Object.keys(defaultInterfacePlacement.templateArea).filter((key) => {
|
|
7915
|
+
if ((key === "trackTimeCurrent" || key === "trackTimeDuration") && activeUi.trackTime === false) {
|
|
7916
|
+
return false;
|
|
7917
|
+
}
|
|
7918
|
+
if (activeUi[key] !== void 0) {
|
|
7919
|
+
return activeUi[key];
|
|
7920
|
+
}
|
|
7921
|
+
return true;
|
|
7922
|
+
}) : Object.entries(activeUi).filter(([, value]) => value).map(([key]) => key);
|
|
7923
|
+
const renameTrackTime = () => {
|
|
7924
|
+
if (activeUIArr.find((key) => key === "trackTime")) {
|
|
7925
|
+
activeUIArr.splice(activeUIArr.indexOf("trackTime"), 1);
|
|
7926
|
+
activeUIArr.push("trackTimeCurrent");
|
|
7927
|
+
activeUIArr.push("trackTimeDuration");
|
|
7928
|
+
}
|
|
7929
|
+
};
|
|
7930
|
+
renameTrackTime();
|
|
7931
|
+
const newInterfacePlacement = {
|
|
7932
|
+
...defaultInterfacePlacement.templateArea,
|
|
7933
|
+
...placement
|
|
7934
|
+
};
|
|
7935
|
+
let maxRow = 1;
|
|
7936
|
+
const colsCntRecord = {};
|
|
7937
|
+
const placementArr = Object.entries(newInterfacePlacement).map(([key, value]) => {
|
|
7938
|
+
const [row, col] = value.split("-");
|
|
7939
|
+
return {
|
|
7940
|
+
key,
|
|
7941
|
+
row: Number(row.split("row")[1]),
|
|
7942
|
+
col: Number(col)
|
|
7943
|
+
};
|
|
7944
|
+
}).filter(({ key, row }) => {
|
|
7945
|
+
if (activeUIArr.includes(key)) {
|
|
7946
|
+
maxRow = Math.max(maxRow, row);
|
|
7947
|
+
colsCntRecord[row] = colsCntRecord[row] ? colsCntRecord[row] + 1 : 1;
|
|
7948
|
+
return true;
|
|
7949
|
+
}
|
|
7950
|
+
return false;
|
|
7951
|
+
}).sort((a, b) => a.col - b.col);
|
|
7952
|
+
const maxCol = Math.max(...Object.values(colsCntRecord));
|
|
7953
|
+
let progressColIdx;
|
|
7954
|
+
const gridAreas2 = new Array(maxRow).fill("").map((_, rowIdx) => {
|
|
7955
|
+
var _a, _b, _c;
|
|
7956
|
+
let cols = "";
|
|
7957
|
+
let isWithProgress = false;
|
|
7958
|
+
const curRowPlacementArr = placementArr.filter(({ key, row }) => {
|
|
7959
|
+
if (row === rowIdx + 1) {
|
|
7960
|
+
if (key === "progress") {
|
|
7961
|
+
isWithProgress = true;
|
|
7962
|
+
}
|
|
7963
|
+
return true;
|
|
7964
|
+
}
|
|
7965
|
+
return false;
|
|
7966
|
+
});
|
|
7967
|
+
if (isWithProgress) {
|
|
7968
|
+
const progressCnt = maxCol - (curRowPlacementArr.length - 1);
|
|
7969
|
+
for (let i = 0; i < maxCol - (progressCnt - 1); i++) {
|
|
7970
|
+
if (((_a = curRowPlacementArr[i]) == null ? void 0 : _a.key) === "progress") {
|
|
7971
|
+
cols += ` row${rowIdx + 1}-${curRowPlacementArr[i].col} `.repeat(
|
|
7972
|
+
progressCnt
|
|
7973
|
+
);
|
|
7974
|
+
progressColIdx = Math.ceil(progressCnt / 2) + i - 1;
|
|
7975
|
+
} else {
|
|
7976
|
+
cols += ` row${rowIdx + 1}-${curRowPlacementArr[i] ? curRowPlacementArr[i].col : i + 1}`;
|
|
7977
|
+
}
|
|
7978
|
+
}
|
|
7979
|
+
} else {
|
|
7980
|
+
let extraColCnt = maxCol - curRowPlacementArr.length;
|
|
7981
|
+
let curRowIdx = 0;
|
|
7982
|
+
for (let i = 0; i < maxCol; i++) {
|
|
7983
|
+
if (!extraColCnt && ((_b = curRowPlacementArr[curRowIdx]) == null ? void 0 : _b.col) > i + 1) {
|
|
7984
|
+
curRowIdx++;
|
|
7985
|
+
cols += ` row${rowIdx + 1}-${((_c = curRowPlacementArr[curRowIdx]) == null ? void 0 : _c.col) ? curRowPlacementArr[curRowIdx].col : i + 1}`;
|
|
7986
|
+
} else {
|
|
7987
|
+
extraColCnt--;
|
|
7988
|
+
cols += ` row${rowIdx + 1}-${i + 1}`;
|
|
7989
|
+
}
|
|
7990
|
+
}
|
|
7991
|
+
}
|
|
7992
|
+
return cols.trimStart();
|
|
7993
|
+
});
|
|
7994
|
+
const maxWidth = window ? window.innerWidth - 100 : 1500;
|
|
7995
|
+
const gridColumns2 = new Array(maxRow).fill("").map((_, rowIdx) => {
|
|
7996
|
+
let cols = "";
|
|
7997
|
+
for (let i = 0; i < maxCol; i++) {
|
|
7998
|
+
if (progressColIdx === i && rowIdx === 0) {
|
|
7999
|
+
cols += ` 1fr`;
|
|
8000
|
+
continue;
|
|
8001
|
+
}
|
|
8002
|
+
cols += ` fit-content(${maxWidth}px)`;
|
|
8003
|
+
}
|
|
8004
|
+
return cols.trimStart();
|
|
8005
|
+
});
|
|
8006
|
+
return { gridAreas: gridAreas2, gridColumns: gridColumns2 };
|
|
8007
|
+
},
|
|
8008
|
+
[]
|
|
8009
|
+
);
|
|
8010
|
+
const [curActiveUI, setCurActiveUI] = useState(activeUI);
|
|
8011
|
+
const [curTemplateArea, setCurTemplateArea] = useState(templateArea);
|
|
8012
|
+
const [curTemplateAreaValues, setCurTemplateAreaValues] = useState();
|
|
8013
|
+
if (!curTemplateAreaValues) {
|
|
8014
|
+
const { gridAreas: gridAreas2, gridColumns: gridColumns2 } = generateGridTemplateValues(
|
|
8015
|
+
curActiveUI,
|
|
8016
|
+
curTemplateArea
|
|
8017
|
+
);
|
|
8018
|
+
setCurTemplateAreaValues({ gridAreas: gridAreas2, gridColumns: gridColumns2 });
|
|
8019
|
+
return [gridAreas2, gridColumns2];
|
|
8020
|
+
}
|
|
8021
|
+
if (curActiveUI !== activeUI || curTemplateArea !== templateArea) {
|
|
8022
|
+
setCurActiveUI(activeUI);
|
|
8023
|
+
setCurTemplateArea(templateArea);
|
|
8024
|
+
const { gridAreas: gridAreas2, gridColumns: gridColumns2 } = generateGridTemplateValues(
|
|
8025
|
+
activeUI,
|
|
8026
|
+
templateArea
|
|
8027
|
+
);
|
|
8028
|
+
setCurTemplateAreaValues({ gridAreas: gridAreas2, gridColumns: gridColumns2 });
|
|
8029
|
+
}
|
|
8030
|
+
const { gridAreas, gridColumns } = curTemplateAreaValues;
|
|
8031
|
+
return [gridAreas, gridColumns];
|
|
7962
8032
|
};
|
|
7963
8033
|
const InterfaceContainer = styled.div`
|
|
7964
8034
|
.interface-grid {
|
|
@@ -7978,10 +8048,7 @@ const Interface = () => {
|
|
|
7978
8048
|
activeUI,
|
|
7979
8049
|
playListPlacement
|
|
7980
8050
|
} = useNonNullableContext(audioPlayerStateContext);
|
|
7981
|
-
const
|
|
7982
|
-
gridAreas,
|
|
7983
|
-
gridColumns
|
|
7984
|
-
} = generateGridTemplateValues(activeUI, interfacePlacement == null ? void 0 : interfacePlacement.templateArea);
|
|
8051
|
+
const [gridAreas, gridColumns] = useGridTemplate(activeUI, interfacePlacement == null ? void 0 : interfacePlacement.templateArea);
|
|
7985
8052
|
return /* @__PURE__ */ jsxs(InterfaceContainer, {
|
|
7986
8053
|
className: "interface-container",
|
|
7987
8054
|
children: [playListPlacement === "top" && /* @__PURE__ */ jsx("div", {
|
|
@@ -8080,4 +8147,4 @@ const AudioPlayerWithProvider = ({
|
|
|
8080
8147
|
})
|
|
8081
8148
|
});
|
|
8082
8149
|
};
|
|
8083
|
-
export { AudioPlayerWithProvider, AudioPlayerWithProvider as default };
|
|
8150
|
+
export { AudioPlayer, AudioPlayerWithProvider, SpectrumProvider, audioPlayerDispatchContext, audioPlayerReducer, audioPlayerStateContext, AudioPlayerWithProvider as default, defaultInterfacePlacement, interfacePlacementMaxLength };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SpectrumProviderProps } from '../Provider';
|
|
2
2
|
import { FC } from "react";
|
|
3
3
|
import { AudioPlayerProps } from "./Player";
|
|
4
|
-
export declare
|
|
4
|
+
export declare type RMAudioPlayerProps = AudioPlayerProps & SpectrumProviderProps;
|
|
5
|
+
export declare const AudioPlayerWithProvider: FC<RMAudioPlayerProps>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
export * from "./components/AudioPlayer";
|
|
2
1
|
import { AudioPlayerWithProvider as AudioPlayer } from "./components/AudioPlayer";
|
|
3
2
|
export default AudioPlayer;
|
|
3
|
+
export * from "./components/AudioPlayer";
|
|
4
|
+
export * from "./components/AudioPlayer/Context";
|
|
5
|
+
export * from "./components/AudioPlayer/Player";
|
|
6
|
+
export * from "./components/Provider/SpectrumProvider";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getRandomNumber: (min: number, max: number) => number;
|
package/package.json
CHANGED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { ActiveUI, InterfacePlacement } from '../components/AudioPlayer/Context/StateContext';
|
|
2
|
-
export declare const generateGridTemplateValues: (activeUi: ActiveUI, placement?: InterfacePlacement["templateArea"]) => {
|
|
3
|
-
gridAreas: string[];
|
|
4
|
-
gridColumns: string[];
|
|
5
|
-
};
|