react-modern-audio-player 0.0.3 → 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/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: "rs-audio-player-provider",
8025
+ UNSAFE_className: "rm-audio-player-provider",
8027
8026
  ...placementState,
8028
8027
  ...rootContainerProps,
8029
8028
  children
@@ -8524,7 +8523,7 @@ const Basic = () => {
8524
8523
  });
8525
8524
  }, [audioRef.current, audioPlayerDispatch]);
8526
8525
  return /* @__PURE__ */ jsx("audio", {
8527
- id: "rs-audio-player-audio",
8526
+ id: "rm-audio-player-audio",
8528
8527
  autoPlay: curAudioState.isPlaying,
8529
8528
  ref: audioRef,
8530
8529
  src: curPlayedAudioData.src,
@@ -8537,7 +8536,7 @@ const useVariableColor = (variableColors) => {
8537
8536
  useLayoutEffect(() => {
8538
8537
  const parsedColors = Object.entries(variableColors).reduce((acc, [key, varName]) => ({
8539
8538
  ...acc,
8540
- [key]: window.getComputedStyle(document.getElementsByClassName("rs-audio-player-provider")[0]).getPropertyValue(`${varName}`)
8539
+ [key]: window.getComputedStyle(document.getElementsByClassName("rm-audio-player-provider")[0]).getPropertyValue(`${varName}`)
8541
8540
  }), {});
8542
8541
  colorsRef.current = parsedColors;
8543
8542
  }, [variableColors]);
@@ -12830,8 +12829,8 @@ const WaveSurferAudio = () => {
12830
12829
  elementRefs
12831
12830
  } = useNonNullableContext(audioPlayerStateContext);
12832
12831
  const colorsRef = useVariableColor({
12833
- progressColor: "--rs-audio-player-waveform-bar",
12834
- waveColor: "--rs-audio-player-waveform-background"
12832
+ progressColor: "--rm-audio-player-waveform-bar",
12833
+ waveColor: "--rm-audio-player-waveform-background"
12835
12834
  });
12836
12835
  useEffect(() => {
12837
12836
  if ((elementRefs == null ? void 0 : elementRefs.waveformInst) || !colorsRef.current)
@@ -12839,13 +12838,13 @@ const WaveSurferAudio = () => {
12839
12838
  const waveSurfer = WaveSurfer.create({
12840
12839
  barWidth: 1,
12841
12840
  cursorWidth: 2,
12842
- container: "#rs-waveform",
12841
+ container: "#rm-waveform",
12843
12842
  backend: "WebAudio",
12844
12843
  height: 80,
12845
12844
  progressColor: `${colorsRef.current.progressColor}`,
12846
12845
  responsive: true,
12847
12846
  waveColor: `${colorsRef.current.waveColor}`,
12848
- cursorColor: "var(--rs-audio-player-waveform-cursor)"
12847
+ cursorColor: "var(--rm-audio-player-waveform-cursor)"
12849
12848
  });
12850
12849
  audioPlayerDispatch({
12851
12850
  type: "SET_ELEMENT_REFS",
@@ -12981,11 +12980,9 @@ const StyledPlayBtn = styled(StyledBtn)`
12981
12980
  width: 35px;
12982
12981
  `;
12983
12982
  const PlayBtn = () => {
12984
- var _a2;
12985
12983
  const {
12986
12984
  curAudioState,
12987
- customIcons,
12988
- activeUI
12985
+ customIcons
12989
12986
  } = useNonNullableContext(audioPlayerStateContext);
12990
12987
  const audioPlayerDispatch = useNonNullableContext(audioPlayerDispatchContext);
12991
12988
  const onClick = () => audioPlayerDispatch({
@@ -13002,11 +12999,11 @@ const PlayBtn = () => {
13002
12999
  customIcon: customIcons == null ? void 0 : customIcons.play
13003
13000
  });
13004
13001
  }, [curAudioState.isPlaying, customIcons == null ? void 0 : customIcons.pause, customIcons == null ? void 0 : customIcons.play]);
13005
- return ((_a2 = activeUI.playButton) != null ? _a2 : activeUI.all) ? /* @__PURE__ */ jsx(StyledPlayBtn, {
13002
+ return /* @__PURE__ */ jsx(StyledPlayBtn, {
13006
13003
  onClick,
13007
13004
  className: "play-button",
13008
13005
  children: PlayIcon
13009
- }) : null;
13006
+ });
13010
13007
  };
13011
13008
  function ImPrevious(props) {
13012
13009
  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 +13012,11 @@ function ImNext(props) {
13015
13012
  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
13013
  }
13017
13014
  const PrevNnextBtn = ({
13018
- type
13015
+ type,
13016
+ visible
13019
13017
  }) => {
13020
- var _a2;
13021
13018
  const {
13022
- customIcons,
13023
- activeUI
13019
+ customIcons
13024
13020
  } = useNonNullableContext(audioPlayerStateContext);
13025
13021
  const audioPlayerDispatch = useNonNullableContext(audioPlayerDispatchContext);
13026
13022
  const onClickBtn = () => {
@@ -13050,7 +13046,7 @@ const PrevNnextBtn = ({
13050
13046
  }
13051
13047
  return null;
13052
13048
  }, [customIcons == null ? void 0 : customIcons.next, customIcons == null ? void 0 : customIcons.prev, type]);
13053
- return ((_a2 = activeUI.prevNnext) != null ? _a2 : activeUI.all) ? /* @__PURE__ */ jsx(StyledBtn, {
13049
+ return visible ? /* @__PURE__ */ jsx(StyledBtn, {
13054
13050
  onClick: onClickBtn,
13055
13051
  className: "prev-n-next-button",
13056
13052
  children: PrevNnextIcon
@@ -13078,7 +13074,6 @@ function TbVolume(props) {
13078
13074
  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
13075
  }
13080
13076
  const RepeatTypeBtn = () => {
13081
- var _a2;
13082
13077
  const {
13083
13078
  curAudioState,
13084
13079
  customIcons,
@@ -13137,11 +13132,11 @@ const RepeatTypeBtn = () => {
13137
13132
  });
13138
13133
  }
13139
13134
  }, [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 ((_a2 = activeUI.repeatType) != null ? _a2 : activeUI.all) ? /* @__PURE__ */ jsx(StyledBtn, {
13135
+ return /* @__PURE__ */ jsx(StyledBtn, {
13141
13136
  onClick,
13142
13137
  className: "repeat-button",
13143
13138
  children: RepeatIcon
13144
- }) : null;
13139
+ });
13145
13140
  };
13146
13141
  const PlayListTriggerBtn = ({
13147
13142
  isOpen
@@ -13153,7 +13148,7 @@ const PlayListTriggerBtn = ({
13153
13148
  children: /* @__PURE__ */ jsx(Icon, {
13154
13149
  render: /* @__PURE__ */ jsx(MdPlaylistPlay, {
13155
13150
  size: "100%",
13156
- color: isOpen ? "var(--rs-audio-player-sortable-list-button-active)" : void 0
13151
+ color: isOpen ? "var(--rm-audio-player-sortable-list-button-active)" : void 0
13157
13152
  }),
13158
13153
  customIcon: customIcons == null ? void 0 : customIcons.playList
13159
13154
  })
@@ -13816,7 +13811,7 @@ const ListItemContainer = styled.div`
13816
13811
  align-items: center;
13817
13812
  padding: 10px 20px;
13818
13813
  &.curPlayed {
13819
- background: var(--rs-audio-player-selected-list-item-background);
13814
+ background: var(--rm-audio-player-selected-list-item-background);
13820
13815
  }
13821
13816
  .list-item-contents-wrapper {
13822
13817
  width: 100%;
@@ -13945,12 +13940,8 @@ const PlayListContainer = styled.div`
13945
13940
  }
13946
13941
  `;
13947
13942
  const SortablePlayList = () => {
13948
- var _a2;
13949
- const {
13950
- activeUI
13951
- } = useNonNullableContext(audioPlayerStateContext);
13952
13943
  const [isOpen, setIsOpen] = useState(false);
13953
- return ((_a2 = activeUI.playList) != null ? _a2 : activeUI.all) ? /* @__PURE__ */ jsxs(Drawer, {
13944
+ return /* @__PURE__ */ jsxs(Drawer, {
13954
13945
  onOpenChange: setIsOpen,
13955
13946
  children: [/* @__PURE__ */ jsx(Drawer.Trigger, {
13956
13947
  children: /* @__PURE__ */ jsx(PlayListTriggerBtn, {
@@ -13962,7 +13953,7 @@ const SortablePlayList = () => {
13962
13953
  setIsOpen
13963
13954
  })
13964
13955
  })]
13965
- }) : null;
13956
+ });
13966
13957
  };
13967
13958
  const useBarProgress = () => {
13968
13959
  const { elementRefs } = useNonNullableContext(audioPlayerStateContext);
@@ -14011,14 +14002,14 @@ const BarProgress = () => {
14011
14002
  className: "bar-progress-wrapper",
14012
14003
  ...eventProps,
14013
14004
  children: [/* @__PURE__ */ jsx("div", {
14014
- className: "rs-player-progress-bar",
14005
+ className: "rm-player-progress-bar",
14015
14006
  ref: progressBarRef,
14016
14007
  children: /* @__PURE__ */ jsx("div", {
14017
- className: "rs-player-progress",
14008
+ className: "rm-player-progress",
14018
14009
  ref: progressValueRef
14019
14010
  })
14020
14011
  }), /* @__PURE__ */ jsx("div", {
14021
- className: "rs-player-progress-handle",
14012
+ className: "rm-player-progress-handle",
14022
14013
  ref: progressHandleRef
14023
14014
  })]
14024
14015
  });
@@ -14031,31 +14022,31 @@ const BarProgressWrapper = styled.div`
14031
14022
  cursor: pointer;
14032
14023
  position: relative;
14033
14024
  align-items: center;
14034
- .rs-player-progress-bar {
14025
+ .rm-player-progress-bar {
14035
14026
  position: relative;
14036
14027
  width: 100%;
14037
14028
  height: 100%;
14038
14029
  overflow: hidden;
14039
- background-color: var(--rs-audio-player-progress-bar-background);
14030
+ background-color: var(--rm-audio-player-progress-bar-background);
14040
14031
  }
14041
- .rs-player-progress {
14032
+ .rm-player-progress {
14042
14033
  position: absolute;
14043
14034
  left: 0;
14044
14035
  width: 100%;
14045
14036
  height: 100%;
14046
- background-color: var(--rs-audio-player-progress-bar);
14037
+ background-color: var(--rm-audio-player-progress-bar);
14047
14038
  transform-origin: 0 0;
14048
14039
  transform: scaleX(0);
14049
14040
  }
14050
14041
  &:hover {
14051
- .rs-player-progress-handle {
14042
+ .rm-player-progress-handle {
14052
14043
  opacity: 1;
14053
14044
  }
14054
14045
  }
14055
- .rs-player-progress-handle {
14046
+ .rm-player-progress-handle {
14056
14047
  position: absolute;
14057
14048
  left: -4px;
14058
- background-color: var(--rs-audio-player-progress-bar);
14049
+ background-color: var(--rm-audio-player-progress-bar);
14059
14050
  border-radius: 100%;
14060
14051
  height: 8px;
14061
14052
  width: 8px;
@@ -14066,7 +14057,7 @@ const BarProgressWrapper = styled.div`
14066
14057
  const WaveformWrapper = styled.div`
14067
14058
  display: flex;
14068
14059
  width: 100%;
14069
- #rs-waveform {
14060
+ #rm-waveform {
14070
14061
  width: 100%;
14071
14062
  wave {
14072
14063
  cursor: pointer !important;
@@ -14077,7 +14068,7 @@ const WaveformProgress = () => {
14077
14068
  return /* @__PURE__ */ jsx(WaveformWrapper, {
14078
14069
  className: "waveform-wrapper",
14079
14070
  children: /* @__PURE__ */ jsx("div", {
14080
- id: "rs-waveform"
14071
+ id: "rm-waveform"
14081
14072
  })
14082
14073
  });
14083
14074
  };
@@ -14089,25 +14080,28 @@ const Progress = () => {
14089
14080
  const {
14090
14081
  activeUI
14091
14082
  } = useNonNullableContext(audioPlayerStateContext);
14092
- const active = activeUI.progress !== void 0 ? !!activeUI.progress : activeUI.all;
14093
14083
  const CurProgress = useMemo(() => {
14094
14084
  if (activeUI.progress === "waveform")
14095
14085
  return /* @__PURE__ */ jsx(WaveformProgress, {});
14096
14086
  return /* @__PURE__ */ jsx(BarProgress, {});
14097
14087
  }, [activeUI.progress]);
14098
- return active ? /* @__PURE__ */ jsx(ProgressContainer, {
14088
+ return /* @__PURE__ */ jsx(ProgressContainer, {
14099
14089
  className: "progress-container",
14100
14090
  children: CurProgress
14101
- }) : null;
14091
+ });
14102
14092
  };
14103
14093
  const Grid = $994c48bfb00b620b$export$ef2184bd89960b14;
14104
- const GridItem = forwardRef((viewProps, ref) => {
14094
+ const GridItem = forwardRef(({
14095
+ children,
14096
+ visible = true,
14097
+ ...viewProps
14098
+ }, ref) => {
14105
14099
  return /* @__PURE__ */ jsx($b9606c0c41d55371$export$27a5bd065ad55220, {
14106
14100
  justifySelf: "center",
14107
- padding: "0 5px",
14101
+ padding: visible ? "0 5px" : void 0,
14108
14102
  ref,
14109
14103
  ...viewProps,
14110
- children: viewProps.children
14104
+ children: visible && children
14111
14105
  });
14112
14106
  });
14113
14107
  GridItem.displayName = "GridItem";
@@ -14165,7 +14159,7 @@ const VolumeSliderContainer = styled.div`
14165
14159
  contentPlacement,
14166
14160
  volumeValue
14167
14161
  }) => css`
14168
- --rs-audio-player-volume-value: ${volumeValue}%;
14162
+ --rm-audio-player-volume-value: ${volumeValue}%;
14169
14163
  position: relative;
14170
14164
  height: 119px;
14171
14165
  width: 32px;
@@ -14178,8 +14172,8 @@ const VolumeSliderContainer = styled.div`
14178
14172
 
14179
14173
  .volume-panel-wrapper {
14180
14174
  width: 30px;
14181
- background-color: var(--rs-audio-player-volume-panel-background);
14182
- border: 1px solid var(--rs-audio-player-volume-panel-border);
14175
+ background-color: var(--rm-audio-player-volume-panel-background);
14176
+ border: 1px solid var(--rm-audio-player-volume-panel-border);
14183
14177
  border-radius: 5px;
14184
14178
  height: 118px;
14185
14179
  box-shadow: 0 2px 4px rgb(0 0 0 /10%);
@@ -14194,8 +14188,8 @@ const VolumeSliderContainer = styled.div`
14194
14188
  bottom: -10px;
14195
14189
  left: 7.9px;
14196
14190
  border-color: transparent transparent
14197
- var(--rs-audio-player-volume-panel-border)
14198
- var(--rs-audio-player-volume-panel-border);
14191
+ var(--rm-audio-player-volume-panel-border)
14192
+ var(--rm-audio-player-volume-panel-border);
14199
14193
  border-style: solid;
14200
14194
  border-width: 5px;
14201
14195
  box-shadow: -3px 3px 4px rgb(0 0 0 / 10%);
@@ -14215,8 +14209,8 @@ const VolumeSliderContainer = styled.div`
14215
14209
  bottom: -8px;
14216
14210
  left: 9px;
14217
14211
  border-color: transparent transparent
14218
- var(--rs-audio-player-volume-panel-background)
14219
- var(--rs-audio-player-volume-panel-background);
14212
+ var(--rm-audio-player-volume-panel-background)
14213
+ var(--rm-audio-player-volume-panel-background);
14220
14214
  border-style: solid;
14221
14215
  border-width: 4px;
14222
14216
  z-index: 1;
@@ -14242,7 +14236,7 @@ const VolumeSliderContainer = styled.div`
14242
14236
  height: 2px;
14243
14237
  width: 92px;
14244
14238
  -webkit-appearance: none;
14245
- background-color: var(--rs-audio-player-volume-background);
14239
+ background-color: var(--rm-audio-player-volume-background);
14246
14240
  outline-color: transparent;
14247
14241
  transform-origin: 75px 75px;
14248
14242
  transform: rotate(-90deg);
@@ -14258,7 +14252,7 @@ const VolumeSliderContainer = styled.div`
14258
14252
  height: 16px;
14259
14253
  border-radius: 12px;
14260
14254
  overflow: visible;
14261
- background: var(--rs-audio-player-volume-thumb);
14255
+ background: var(--rm-audio-player-volume-thumb);
14262
14256
  }
14263
14257
 
14264
14258
  &::-moz-range-thumb {
@@ -14266,7 +14260,7 @@ const VolumeSliderContainer = styled.div`
14266
14260
  height: 16px;
14267
14261
  border-radius: 12px;
14268
14262
  overflow: visible;
14269
- background: var(--rs-audio-player-volume-thumb);
14263
+ background: var(--rm-audio-player-volume-thumb);
14270
14264
  border: none;
14271
14265
  }
14272
14266
  &::-moz-range-track {
@@ -14284,9 +14278,9 @@ const VolumeSliderContainer = styled.div`
14284
14278
  background-size: 100% 3px;
14285
14279
  background-image: linear-gradient(
14286
14280
  90deg,
14287
- var(--rs-audio-player-volume-fill) var(--rs-audio-player-volume-value),
14288
- var(--rs-audio-player-volume-track)
14289
- var(--rs-audio-player-volume-value)
14281
+ var(--rm-audio-player-volume-fill) var(--rm-audio-player-volume-value),
14282
+ var(--rm-audio-player-volume-track)
14283
+ var(--rm-audio-player-volume-value)
14290
14284
  );
14291
14285
  }
14292
14286
 
@@ -14305,9 +14299,9 @@ const VolumeSliderContainer = styled.div`
14305
14299
  background-size: 100% 3px;
14306
14300
  background-image: linear-gradient(
14307
14301
  90deg,
14308
- var(--rs-audio-player-volume-fill) var(--rs-audio-player-volume-value),
14309
- var(--rs-audio-player-volume-track)
14310
- var(--rs-audio-player-volume-value)
14302
+ var(--rm-audio-player-volume-fill) var(--rm-audio-player-volume-value),
14303
+ var(--rm-audio-player-volume-track)
14304
+ var(--rm-audio-player-volume-value)
14311
14305
  );
14312
14306
  }
14313
14307
  }
@@ -14501,10 +14495,6 @@ const DropdownTrigger = ({
14501
14495
  Dropdown.Content = DropdownContent;
14502
14496
  Dropdown.Trigger = DropdownTrigger;
14503
14497
  const Volume = () => {
14504
- var _a2;
14505
- const {
14506
- activeUI
14507
- } = useNonNullableContext(audioPlayerStateContext);
14508
14498
  const triggerRef = useRef(null);
14509
14499
  const [volumeSliderPlacement, setVolumeSliderPlacement] = useState("bottom");
14510
14500
  useEffect(() => {
@@ -14518,7 +14508,7 @@ const Volume = () => {
14518
14508
  setVolumeSliderPlacement(placementValidation());
14519
14509
  }
14520
14510
  }, [triggerRef.current]);
14521
- return ((_a2 = activeUI.volume) != null ? _a2 : activeUI.all) ? /* @__PURE__ */ jsxs(Dropdown, {
14511
+ return /* @__PURE__ */ jsxs(Dropdown, {
14522
14512
  placement: volumeSliderPlacement,
14523
14513
  triggerType: "hover",
14524
14514
  children: [/* @__PURE__ */ jsx(Dropdown.Trigger, {
@@ -14530,38 +14520,46 @@ const Volume = () => {
14530
14520
  placement: volumeSliderPlacement
14531
14521
  })
14532
14522
  })]
14533
- }) : null;
14523
+ });
14534
14524
  };
14535
14525
  const Controller = () => {
14536
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
14526
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
14537
14527
  const {
14538
- interfacePlacement
14528
+ interfacePlacement,
14529
+ activeUI
14539
14530
  } = useNonNullableContext(audioPlayerStateContext);
14540
14531
  return /* @__PURE__ */ jsxs(Fragment, {
14541
14532
  children: [/* @__PURE__ */ jsx(Grid.Item, {
14542
14533
  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
14534
  width: "100%",
14535
+ visible: Boolean(activeUI.progress !== void 0 ? activeUI.progress : activeUI.all),
14544
14536
  children: /* @__PURE__ */ jsx(Progress, {})
14545
14537
  }), /* @__PURE__ */ jsx(Grid.Item, {
14546
14538
  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,
14539
+ visible: Boolean((_e = activeUI.repeatType) != null ? _e : activeUI.all),
14547
14540
  children: /* @__PURE__ */ jsx(RepeatTypeBtn, {})
14548
14541
  }), /* @__PURE__ */ jsx(Grid.Item, {
14549
- gridArea: ((_e = interfacePlacement == null ? void 0 : interfacePlacement.itemCustomArea) == null ? void 0 : _e.playButton) || ((_f = interfacePlacement == null ? void 0 : interfacePlacement.templateArea) == null ? void 0 : _f.playButton) || defaultInterfacePlacement.templateArea.playButton,
14542
+ 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,
14543
+ visible: Boolean((_h = activeUI.playButton) != null ? _h : activeUI.all),
14550
14544
  children: /* @__PURE__ */ jsxs($884c64d19340d345$export$f51f4c4ede09e011, {
14551
14545
  UNSAFE_className: "btn-wrapper",
14552
14546
  alignItems: "center",
14553
14547
  gap: "10px",
14554
14548
  children: [/* @__PURE__ */ jsx(PrevNnextBtn, {
14555
- type: "prev"
14549
+ type: "prev",
14550
+ visible: Boolean((_i = activeUI.prevNnext) != null ? _i : activeUI.all)
14556
14551
  }), /* @__PURE__ */ jsx(PlayBtn, {}), /* @__PURE__ */ jsx(PrevNnextBtn, {
14557
- type: "next"
14552
+ type: "next",
14553
+ visible: Boolean((_j = activeUI.prevNnext) != null ? _j : activeUI.all)
14558
14554
  })]
14559
14555
  })
14560
14556
  }), /* @__PURE__ */ jsx(Grid.Item, {
14561
- gridArea: ((_g = interfacePlacement == null ? void 0 : interfacePlacement.itemCustomArea) == null ? void 0 : _g.volume) || ((_h = interfacePlacement == null ? void 0 : interfacePlacement.templateArea) == null ? void 0 : _h.volume) || defaultInterfacePlacement.templateArea.volume,
14557
+ 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,
14558
+ visible: Boolean((_m = activeUI.volume) != null ? _m : activeUI.all),
14562
14559
  children: /* @__PURE__ */ jsx(Volume, {})
14563
14560
  }), /* @__PURE__ */ jsx(Grid.Item, {
14564
- gridArea: ((_i = interfacePlacement == null ? void 0 : interfacePlacement.itemCustomArea) == null ? void 0 : _i.playList) || ((_j = interfacePlacement == null ? void 0 : interfacePlacement.templateArea) == null ? void 0 : _j.playList) || defaultInterfacePlacement.templateArea.playList,
14561
+ 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,
14562
+ visible: Boolean((_p = activeUI.playList) != null ? _p : activeUI.all),
14565
14563
  children: /* @__PURE__ */ jsx(SortablePlayList, {})
14566
14564
  })]
14567
14565
  });
@@ -14579,19 +14577,18 @@ const ArtworkContainer = styled.div`
14579
14577
  const Artwork = () => {
14580
14578
  var _a2;
14581
14579
  const {
14582
- activeUI,
14583
14580
  playList,
14584
14581
  curIdx,
14585
14582
  coverImgsCss
14586
14583
  } = useNonNullableContext(audioPlayerStateContext);
14587
- return playList[curIdx] && ((_a2 = activeUI.artwork) != null ? _a2 : activeUI.all) ? /* @__PURE__ */ jsx(ArtworkContainer, {
14584
+ return /* @__PURE__ */ jsx(ArtworkContainer, {
14588
14585
  className: "artwork-container",
14589
14586
  children: /* @__PURE__ */ jsx("img", {
14590
- src: playList[curIdx].img,
14587
+ src: (_a2 = playList[curIdx]) == null ? void 0 : _a2.img,
14591
14588
  alt: "",
14592
14589
  style: coverImgsCss == null ? void 0 : coverImgsCss.artwork
14593
14590
  })
14594
- }) : null;
14591
+ });
14595
14592
  };
14596
14593
  const TrackInfoContainer = styled.div`
14597
14594
  display: grid;
@@ -14611,28 +14608,25 @@ const TrackInfoContainer = styled.div`
14611
14608
  }
14612
14609
  `;
14613
14610
  const TrackInfo = () => {
14614
- var _a2;
14615
14611
  const {
14616
- activeUI,
14617
14612
  playList,
14618
14613
  curIdx
14619
14614
  } = useNonNullableContext(audioPlayerStateContext);
14620
14615
  const curPlayData = playList[curIdx];
14621
- return curPlayData && ((_a2 = activeUI.trackInfo) != null ? _a2 : activeUI.all) ? /* @__PURE__ */ jsx(TrackInfoContainer, {
14616
+ return /* @__PURE__ */ jsx(TrackInfoContainer, {
14622
14617
  className: "track-info-container",
14623
- children: curPlayData.customTrackInfo ? curPlayData.customTrackInfo : /* @__PURE__ */ jsxs(Fragment, {
14624
- children: [curPlayData.name && /* @__PURE__ */ jsx("span", {
14618
+ children: (curPlayData == null ? void 0 : curPlayData.customTrackInfo) ? curPlayData.customTrackInfo : /* @__PURE__ */ jsxs(Fragment, {
14619
+ children: [(curPlayData == null ? void 0 : curPlayData.name) && /* @__PURE__ */ jsx("span", {
14625
14620
  className: "title",
14626
14621
  children: curPlayData.name
14627
- }), curPlayData.writer && /* @__PURE__ */ jsx("span", {
14622
+ }), (curPlayData == null ? void 0 : curPlayData.writer) && /* @__PURE__ */ jsx("span", {
14628
14623
  className: "writer",
14629
14624
  children: curPlayData.writer
14630
14625
  })]
14631
14626
  })
14632
- }) : null;
14627
+ });
14633
14628
  };
14634
14629
  const TrackTimeCurrent = () => {
14635
- var _a2;
14636
14630
  const trackCurTimeRef = useRef(null);
14637
14631
  const {
14638
14632
  activeUI
@@ -14649,7 +14643,7 @@ const TrackTimeCurrent = () => {
14649
14643
  });
14650
14644
  }
14651
14645
  }, [trackCurTimeRef.current, audioPlayerDispatch]);
14652
- return ((_a2 = activeUI.trackTime) != null ? _a2 : activeUI.all) ? /* @__PURE__ */ jsx(TrackTimeCurrentContainer, {
14646
+ return /* @__PURE__ */ jsx(TrackTimeCurrentContainer, {
14653
14647
  type: activeUI.trackTime,
14654
14648
  className: "track-time-current-container",
14655
14649
  children: /* @__PURE__ */ jsx("span", {
@@ -14657,10 +14651,9 @@ const TrackTimeCurrent = () => {
14657
14651
  className: "track-current-time",
14658
14652
  children: "00:00"
14659
14653
  })
14660
- }) : null;
14654
+ });
14661
14655
  };
14662
14656
  const TrackTimeDuration = () => {
14663
- var _a2;
14664
14657
  const trackDurationRef = useRef(null);
14665
14658
  const {
14666
14659
  activeUI
@@ -14677,7 +14670,7 @@ const TrackTimeDuration = () => {
14677
14670
  });
14678
14671
  }
14679
14672
  }, [trackDurationRef.current, audioPlayerDispatch]);
14680
- return ((_a2 = activeUI.trackTime) != null ? _a2 : activeUI.all) ? /* @__PURE__ */ jsx(TrackTimeDurationContainer, {
14673
+ return /* @__PURE__ */ jsx(TrackTimeDurationContainer, {
14681
14674
  type: activeUI.trackTime,
14682
14675
  className: "track-time-duration-container",
14683
14676
  children: /* @__PURE__ */ jsx("span", {
@@ -14685,7 +14678,7 @@ const TrackTimeDuration = () => {
14685
14678
  className: "track-duration",
14686
14679
  children: "00:00"
14687
14680
  })
14688
- }) : null;
14681
+ });
14689
14682
  };
14690
14683
  const TrackTimeContainer = styled.div`
14691
14684
  display: flex;
@@ -14702,7 +14695,7 @@ const TrackTimeCurrentContainer = styled(TrackTimeContainer)`
14702
14695
  .track-current-time {
14703
14696
  font-weight: 700;
14704
14697
  letter-spacing: -0.1rem;
14705
- color: var(--rs-audio-player-track-current-time);
14698
+ color: var(--rm-audio-player-track-current-time);
14706
14699
  margin-right: ${type !== "separation-mode" && "-10px"};
14707
14700
  }
14708
14701
  `}
@@ -14713,7 +14706,7 @@ const TrackTimeDurationContainer = styled(TrackTimeContainer)`
14713
14706
  }) => css`
14714
14707
  .track-duration {
14715
14708
  display: flex;
14716
- color: var(--rs-audio-player-track-duration);
14709
+ color: var(--rm-audio-player-track-duration);
14717
14710
  letter-spacing: -0.1rem;
14718
14711
  }
14719
14712
  ${type !== "separation-mode" && css`
@@ -14725,69 +14718,89 @@ const TrackTimeDurationContainer = styled(TrackTimeContainer)`
14725
14718
  `}
14726
14719
  `;
14727
14720
  const Information = () => {
14728
- var _a2, _b, _c, _d, _e, _f, _g, _h;
14721
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
14729
14722
  const {
14730
- interfacePlacement
14723
+ interfacePlacement,
14724
+ playList,
14725
+ curIdx,
14726
+ activeUI
14731
14727
  } = useNonNullableContext(audioPlayerStateContext);
14728
+ 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
14729
  return /* @__PURE__ */ jsxs(Fragment, {
14733
14730
  children: [/* @__PURE__ */ jsx(Grid.Item, {
14734
- gridArea: ((_a2 = interfacePlacement == null ? void 0 : interfacePlacement.itemCustomArea) == null ? void 0 : _a2.artwork) || ((_b = interfacePlacement == null ? void 0 : interfacePlacement.templateArea) == null ? void 0 : _b.artwork) || defaultInterfacePlacement.templateArea.artwork,
14731
+ 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,
14732
+ visible: Boolean(((_i = playList[curIdx]) == null ? void 0 : _i.img) && ((_j = activeUI.artwork) != null ? _j : activeUI.all)),
14735
14733
  children: /* @__PURE__ */ jsx(Artwork, {})
14736
14734
  }), /* @__PURE__ */ jsx(Grid.Item, {
14737
- gridArea: ((_c = interfacePlacement == null ? void 0 : interfacePlacement.itemCustomArea) == null ? void 0 : _c.trackInfo) || ((_d = interfacePlacement == null ? void 0 : interfacePlacement.templateArea) == null ? void 0 : _d.trackInfo) || defaultInterfacePlacement.templateArea.trackInfo,
14738
- justifySelf: "center",
14735
+ 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,
14736
+ visible: trackInfoActive,
14739
14737
  children: /* @__PURE__ */ jsx(TrackInfo, {})
14740
14738
  }), /* @__PURE__ */ jsx(Grid.Item, {
14741
- gridArea: ((_e = interfacePlacement == null ? void 0 : interfacePlacement.itemCustomArea) == null ? void 0 : _e.trackTimeCurrent) || ((_f = interfacePlacement == null ? void 0 : interfacePlacement.templateArea) == null ? void 0 : _f.trackTimeCurrent) || defaultInterfacePlacement.templateArea.trackTimeCurrent,
14742
- justifySelf: "center",
14739
+ 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,
14740
+ visible: Boolean((_o = activeUI.trackTime) != null ? _o : activeUI.all),
14743
14741
  children: /* @__PURE__ */ jsx(TrackTimeCurrent, {})
14744
14742
  }), /* @__PURE__ */ jsx(Grid.Item, {
14745
- gridArea: ((_g = interfacePlacement == null ? void 0 : interfacePlacement.itemCustomArea) == null ? void 0 : _g.trackTimeDuration) || ((_h = interfacePlacement == null ? void 0 : interfacePlacement.templateArea) == null ? void 0 : _h.trackTimeDuration) || defaultInterfacePlacement.templateArea.trackTimeDuration,
14746
- justifySelf: "center",
14743
+ 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,
14744
+ visible: Boolean((_r = activeUI.trackTime) != null ? _r : activeUI.all),
14747
14745
  children: /* @__PURE__ */ jsx(TrackTimeDuration, {})
14748
14746
  })]
14749
14747
  });
14750
14748
  };
14751
14749
  const generateGridTemplateValues = (activeUi, placement) => {
14752
- let maxRowLength = 1;
14753
- let maxColLength = 1;
14754
- const placementValueArr = Object.values(placement || {}).map((value) => value.split("row")[1]);
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
- }
14750
+ const activeUIArr = activeUi.all ? Object.keys(defaultInterfacePlacement.templateArea).filter((key) => {
14751
+ if ((key === "trackTimeCurrent" || key === "trackTimeDuration") && activeUi.trackTime === false) {
14752
+ return false;
14763
14753
  }
14764
- if (activeUi.all) {
14765
- maxColLength = interfacePlacementMaxLength - 1;
14766
- return;
14754
+ if (activeUi[key] !== void 0) {
14755
+ return activeUi[key];
14756
+ }
14757
+ return true;
14758
+ }) : Object.entries(activeUi).filter(([, value]) => value).map(([key]) => key);
14759
+ const renameTrackTime = () => {
14760
+ if (activeUIArr.find((key) => key === "trackTime")) {
14761
+ activeUIArr.splice(activeUIArr.indexOf("trackTime"), 1);
14762
+ activeUIArr.push("trackTimeCurrent");
14763
+ activeUIArr.push("trackTimeDuration");
14764
+ }
14765
+ };
14766
+ renameTrackTime();
14767
+ const newInterfacePlacement = {
14768
+ ...defaultInterfacePlacement.templateArea,
14769
+ ...placement
14770
+ };
14771
+ const placementArr = Object.entries(newInterfacePlacement).map(([key, value]) => {
14772
+ const [row, col] = value.split("-");
14773
+ return {
14774
+ key,
14775
+ row: Number(row.split("row")[1]),
14776
+ col: Number(col)
14777
+ };
14778
+ }).filter(({ key }) => activeUIArr.includes(key)).sort((a, b) => a.col - b.col);
14779
+ let maxRow = 1;
14780
+ const getMaxRow = () => {
14781
+ for (let i = 0; i < placementArr.length; i++) {
14782
+ maxRow = Math.max(maxRow, placementArr[i].row);
14767
14783
  }
14768
- maxColLength = Object.values(activeUi).filter((boolean) => Boolean(boolean)).length;
14769
- return;
14770
14784
  };
14771
- getMaxLength();
14772
- const gridAreas = new Array(maxRowLength).fill("").map((_, rowIdx) => {
14785
+ getMaxRow();
14786
+ const gridAreas = new Array(maxRow).fill("").map((_, rowIdx) => {
14773
14787
  let cols = "";
14774
- for (let i = 0; i < maxColLength; i++) {
14775
- cols += ` row${rowIdx + 1}-${i + 1}`;
14788
+ for (let i = 0; i < placementArr.length; i++) {
14789
+ cols += ` row${rowIdx + 1}-${placementArr[i].col}`;
14776
14790
  if (i === 0) {
14777
14791
  cols = cols.trim();
14778
14792
  }
14779
14793
  }
14780
14794
  return cols;
14781
14795
  });
14782
- const gridColumns = new Array(maxRowLength).fill("").map((_, rowIdx) => {
14796
+ const gridColumns = new Array(maxRow).fill("").map((_, rowIdx) => {
14783
14797
  const maxWidth = window ? window.innerWidth - 100 : 1500;
14784
- const [, progressCol] = ((placement == null ? void 0 : placement.progress) || defaultInterfacePlacement.templateArea.progress).replace("row", "").split("-");
14785
14798
  let cols = "";
14786
- for (let i = 0; i < maxColLength; i++) {
14799
+ for (let i = 0; i < placementArr.length; i++) {
14787
14800
  if (i === 0) {
14788
14801
  cols = cols.trim();
14789
14802
  }
14790
- if (rowIdx === 0 && i + 1 === +progressCol) {
14803
+ if (rowIdx === 0 && placementArr[i].key === "progress") {
14791
14804
  cols += ` 1fr`;
14792
14805
  continue;
14793
14806
  }
@@ -14890,8 +14903,8 @@ const AudioPlayer = ({
14890
14903
  }
14891
14904
  }, [customIcons, audioPlayerDispatch]);
14892
14905
  return /* @__PURE__ */ jsxs($b9606c0c41d55371$export$27a5bd065ad55220, {
14893
- id: "rs-audio-player",
14894
- UNSAFE_className: "rs-audio-player-container",
14906
+ id: "rm-audio-player",
14907
+ UNSAFE_className: "rm-audio-player-container",
14895
14908
  children: [/* @__PURE__ */ jsx(Audio, {}), /* @__PURE__ */ jsx(Interface, {})]
14896
14909
  });
14897
14910
  };