react-modern-audio-player 1.4.0-rc.2 → 2.0.0-beta.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/README.md +294 -100
- package/dist/index.css +1 -1
- package/dist/index.es.js +1914 -7975
- package/dist/types/api/index.d.ts +6 -0
- package/dist/types/api/useAudioPlayer.d.ts +27 -0
- package/dist/types/api/useAudioPlayerElement.d.ts +6 -0
- package/dist/types/api/useAudioPlayerPlayback.d.ts +9 -0
- package/dist/types/api/useAudioPlayerTime.d.ts +6 -0
- package/dist/types/api/useAudioPlayerTrack.d.ts +11 -0
- package/dist/types/api/useAudioPlayerVolume.d.ts +7 -0
- package/dist/types/components/AudioPlayer/Audio/index.d.ts +2 -2
- package/dist/types/components/AudioPlayer/Audio/useAudio.d.ts +1 -1
- package/dist/types/components/AudioPlayer/Container/AudioPlayerContainer.d.ts +5 -0
- package/dist/types/components/AudioPlayer/Container/index.d.ts +1 -0
- package/dist/types/components/AudioPlayer/Context/AudioAttrsContext.d.ts +15 -0
- package/dist/types/components/AudioPlayer/Context/PlaybackContext.d.ts +10 -0
- package/dist/types/components/AudioPlayer/Context/ResourceContext.d.ts +7 -0
- package/dist/types/components/AudioPlayer/Context/StateContext/audio.d.ts +18 -8
- package/dist/types/components/AudioPlayer/Context/StateContext/element.d.ts +8 -13
- package/dist/types/components/AudioPlayer/Context/StateContext/index.d.ts +9 -8
- package/dist/types/components/AudioPlayer/Context/StateContext/placement.d.ts +9 -9
- package/dist/types/components/AudioPlayer/Context/TimeContext.d.ts +6 -0
- package/dist/types/components/AudioPlayer/Context/TrackContext.d.ts +7 -0
- package/dist/types/components/AudioPlayer/Context/UIContext.d.ts +11 -0
- package/dist/types/components/AudioPlayer/Context/dispatchContext.d.ts +11 -7
- package/dist/types/components/AudioPlayer/Context/index.d.ts +10 -3
- package/dist/types/components/AudioPlayer/Context/providerProps.d.ts +14 -0
- package/dist/types/components/AudioPlayer/Context/reducer.d.ts +2 -2
- package/dist/types/components/AudioPlayer/Interface/Controller/Button/NextBtn.d.ts +6 -0
- package/dist/types/components/AudioPlayer/Interface/Controller/Button/PlayBtn.d.ts +1 -1
- package/dist/types/components/AudioPlayer/Interface/Controller/Button/PrevBtn.d.ts +6 -0
- package/dist/types/components/AudioPlayer/Interface/Controller/Button/RepeatTypeBtn.d.ts +1 -1
- package/dist/types/components/AudioPlayer/Interface/Controller/Button/VolumeTriggerBtn.d.ts +1 -1
- package/dist/types/components/AudioPlayer/Interface/Controller/Button/index.d.ts +5 -5
- package/dist/types/components/AudioPlayer/Interface/Controller/Drawer/SortablePlayList/Content/PlayListItem.d.ts +3 -3
- package/dist/types/components/AudioPlayer/Interface/Controller/Drawer/SortablePlayList/Content/index.d.ts +2 -6
- package/dist/types/components/AudioPlayer/Interface/Controller/Drawer/SortablePlayList/Content/usePlayList.d.ts +3 -4
- package/dist/types/components/AudioPlayer/Interface/Controller/Drawer/SortablePlayList/PlayListIcon.d.ts +2 -0
- package/dist/types/components/AudioPlayer/Interface/Controller/Drawer/SortablePlayList/index.d.ts +1 -1
- package/dist/types/components/AudioPlayer/Interface/Controller/Drawer/index.d.ts +1 -1
- package/dist/types/components/AudioPlayer/Interface/Controller/Icon.d.ts +3 -3
- package/dist/types/components/AudioPlayer/Interface/Controller/Input/Progress/BarProgress.d.ts +2 -4
- package/dist/types/components/AudioPlayer/Interface/Controller/Input/Progress/WaveformProgress.d.ts +1 -1
- package/dist/types/components/AudioPlayer/Interface/Controller/Input/Progress/index.d.ts +1 -1
- package/dist/types/components/AudioPlayer/Interface/Controller/Input/Progress/useProgress.d.ts +1 -1
- package/dist/types/components/AudioPlayer/Interface/Controller/Input/Progress/useProgressKeyDown.d.ts +2 -0
- package/dist/types/components/AudioPlayer/Interface/Controller/Input/index.d.ts +1 -1
- package/dist/types/components/AudioPlayer/Interface/Controller/Tooltip/Volume/Content.d.ts +2 -2
- package/dist/types/components/AudioPlayer/Interface/Controller/Tooltip/Volume/index.d.ts +1 -1
- package/dist/types/components/AudioPlayer/Interface/Controller/Tooltip/Volume/useVolume.d.ts +2 -2
- package/dist/types/components/AudioPlayer/Interface/Controller/Tooltip/index.d.ts +1 -1
- package/dist/types/components/AudioPlayer/Interface/Controller/index.d.ts +1 -1
- package/dist/types/components/AudioPlayer/Interface/CustomComponent/index.d.ts +2 -2
- package/dist/types/components/AudioPlayer/Interface/Information/Artwork.d.ts +1 -1
- package/dist/types/components/AudioPlayer/Interface/Information/TrackInfo.d.ts +1 -1
- package/dist/types/components/AudioPlayer/Interface/Information/TrackTime/Current.d.ts +2 -2
- package/dist/types/components/AudioPlayer/Interface/Information/TrackTime/Duration.d.ts +2 -2
- package/dist/types/components/AudioPlayer/Interface/Information/TrackTime/TrackTimeContainer.d.ts +6 -0
- package/dist/types/components/AudioPlayer/Interface/Information/TrackTime/Types.d.ts +1 -1
- package/dist/types/components/AudioPlayer/Interface/Information/TrackTime/index.d.ts +1 -1
- package/dist/types/components/AudioPlayer/Interface/Information/index.d.ts +1 -1
- package/dist/types/components/AudioPlayer/Interface/index.d.ts +1 -1
- package/dist/types/components/AudioPlayer/Player/index.d.ts +9 -14
- package/dist/types/components/AudioPlayer/Player/usePropsStateEffect.d.ts +1 -1
- package/dist/types/components/AudioPlayer/Provider/AudioPlayerStateProvider.d.ts +7 -0
- package/dist/types/components/AudioPlayer/Provider/index.d.ts +1 -0
- package/dist/types/components/AudioPlayer/index.d.ts +10 -11
- package/dist/types/components/Drawer/Drawer.d.ts +5 -6
- package/dist/types/components/Drawer/DrawerContent.d.ts +4 -3
- package/dist/types/components/Drawer/DrawerContext.d.ts +2 -1
- package/dist/types/components/Drawer/DrawerTrigger.d.ts +7 -2
- package/dist/types/components/Drawer/index.d.ts +2 -2
- package/dist/types/components/Dropdown/Dropdown.d.ts +6 -6
- package/dist/types/components/Dropdown/DropdownContent.d.ts +3 -3
- package/dist/types/components/Dropdown/DropdownContext.d.ts +2 -1
- package/dist/types/components/Dropdown/DropdownTrigger.d.ts +2 -2
- package/dist/types/components/Dropdown/index.d.ts +2 -2
- package/dist/types/components/Dropdown/useDropdown.d.ts +3 -3
- package/dist/types/components/Dropdown/useDropdownPlacementStyle.d.ts +3 -0
- package/dist/types/components/Grid/Grid.d.ts +12 -8
- package/dist/types/components/Grid/Item.d.ts +8 -5
- package/dist/types/components/Grid/index.d.ts +8 -1
- package/dist/types/components/SortableList/SortableList.d.ts +4 -4
- package/dist/types/components/SortableList/SortableListItem.d.ts +5 -5
- package/dist/types/components/SortableList/index.d.ts +5 -5
- package/dist/types/components/SortableList/useSortableListItem.d.ts +1 -1
- package/dist/types/components/icons/index.d.ts +16 -0
- package/dist/types/hooks/context/index.d.ts +7 -0
- package/dist/types/hooks/context/useAudioAttrsContext.d.ts +2 -0
- package/dist/types/hooks/{useNonNullableContext.d.ts → context/useNonNullableContext.d.ts} +1 -1
- package/dist/types/hooks/context/usePlaybackContext.d.ts +2 -0
- package/dist/types/hooks/context/useResourceContext.d.ts +2 -0
- package/dist/types/hooks/context/useTimeContext.d.ts +2 -0
- package/dist/types/hooks/context/useTrackContext.d.ts +2 -0
- package/dist/types/hooks/context/useUIContext.d.ts +1 -0
- package/dist/types/hooks/index.d.ts +5 -4
- package/dist/types/hooks/useClickOutside.d.ts +1 -1
- package/dist/types/hooks/useDidUpdateEffect.d.ts +16 -0
- package/dist/types/hooks/useRefsDispatch.d.ts +1 -1
- package/dist/types/hooks/useVariableColor.d.ts +2 -2
- package/dist/types/index.d.ts +7 -5
- package/dist/types/test/setup.d.ts +0 -0
- package/dist/types/{components → ui}/CssTransition.d.ts +1 -3
- package/dist/types/ui/StyledBtn.d.ts +1 -0
- package/dist/types/utils/clampVolume.d.ts +5 -0
- package/dist/types/utils/generateUnionNumType.d.ts +2 -2
- package/dist/types/utils/refs.d.ts +1 -0
- package/dist/types/utils/safeRatio.d.ts +5 -0
- package/dist/types/utils/ssr.d.ts +5 -0
- package/dist/wavesurfer-_j5aw4gZ.mjs +4471 -0
- package/package.json +32 -22
- package/dist/types/components/AudioPlayer/Interface/Controller/Button/PlayListTriggerBtn.d.ts +0 -5
- package/dist/types/components/AudioPlayer/Interface/Controller/Button/PrevNnextBtn.d.ts +0 -7
- package/dist/types/components/AudioPlayer/Interface/Controller/Button/StyledBtn.d.ts +0 -1
- package/dist/types/components/AudioPlayer/Interface/Information/TrackTime/Styles.d.ts +0 -6
- package/dist/types/components/Provider/AudioPlayerProvider.d.ts +0 -3
- package/dist/types/components/Provider/SpectrumProvider.d.ts +0 -7
- package/dist/types/components/Provider/index.d.ts +0 -2
- package/dist/types/styles/GlobalStyle.d.ts +0 -1
- package/dist/types/utils/resetAudioValues.d.ts +0 -2
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { RepeatType, AudioData } from '../components/AudioPlayer/Context/StateContext';
|
|
2
|
+
export interface AudioPlayerControls {
|
|
3
|
+
isPlaying: boolean;
|
|
4
|
+
volume: number;
|
|
5
|
+
currentTime: number;
|
|
6
|
+
duration: number;
|
|
7
|
+
repeatType: RepeatType;
|
|
8
|
+
muted: boolean;
|
|
9
|
+
currentTrack: AudioData | null;
|
|
10
|
+
currentIndex: number;
|
|
11
|
+
playList: ReadonlyArray<AudioData>;
|
|
12
|
+
play: () => void;
|
|
13
|
+
pause: () => void;
|
|
14
|
+
togglePlay: () => void;
|
|
15
|
+
next: () => void;
|
|
16
|
+
prev: () => void;
|
|
17
|
+
seek: (time: number) => void;
|
|
18
|
+
setVolume: (volume: number) => void;
|
|
19
|
+
toggleMute: () => void;
|
|
20
|
+
setTrack: (index: number) => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Convenience facade that composes all domain sub-hooks into a single flat
|
|
24
|
+
* object. Subscribes to every context slice — for fine-grained re-render
|
|
25
|
+
* control, import the individual sub-hooks instead.
|
|
26
|
+
*/
|
|
27
|
+
export declare const useAudioPlayer: () => AudioPlayerControls;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ElementRefs } from '../components/AudioPlayer/Context/StateContext';
|
|
2
|
+
export interface AudioPlayerElementControls {
|
|
3
|
+
audioEl: ElementRefs["audioEl"] | undefined;
|
|
4
|
+
waveformInst: ElementRefs["waveformInst"] | undefined;
|
|
5
|
+
}
|
|
6
|
+
export declare const useAudioPlayerElement: () => AudioPlayerElementControls;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RepeatType } from '../components/AudioPlayer/Context/StateContext';
|
|
2
|
+
export interface AudioPlayerPlaybackControls {
|
|
3
|
+
isPlaying: boolean;
|
|
4
|
+
repeatType: RepeatType;
|
|
5
|
+
play: () => void;
|
|
6
|
+
pause: () => void;
|
|
7
|
+
togglePlay: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const useAudioPlayerPlayback: () => AudioPlayerPlaybackControls;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AudioData } from '../components/AudioPlayer/Context/StateContext';
|
|
2
|
+
export interface AudioPlayerTrackControls {
|
|
3
|
+
currentPlayId: number;
|
|
4
|
+
currentIndex: number;
|
|
5
|
+
playList: ReadonlyArray<AudioData>;
|
|
6
|
+
currentTrack: AudioData | null;
|
|
7
|
+
setTrack: (index: number) => void;
|
|
8
|
+
next: () => void;
|
|
9
|
+
prev: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const useAudioPlayerTrack: () => AudioPlayerTrackControls;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { HTMLAttributes } from
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
2
|
export declare const useAudio: () => HTMLAttributes<HTMLAudioElement>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { default as React, HTMLAttributes } from 'react';
|
|
2
|
+
export interface AudioPlayerContainerProps {
|
|
3
|
+
rootContainerProps?: Omit<HTMLAttributes<HTMLDivElement>, "children">;
|
|
4
|
+
}
|
|
5
|
+
export declare const AudioPlayerContainer: React.NamedExoticComponent<React.PropsWithChildren<AudioPlayerContainerProps>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AudioPlayerContainer';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AudioNativeProps } from './StateContext';
|
|
2
|
+
/**
|
|
3
|
+
* Native HTML <audio> attributes that the consumer passes through
|
|
4
|
+
* `audioInitialState`. Held in its own context so the <Audio> element can
|
|
5
|
+
* spread them onto the underlying media element without forcing every
|
|
6
|
+
* playback consumer to re-render whenever a primitive playback field
|
|
7
|
+
* (isPlaying / volume / muted / repeatType / isLoadedMetaData) changes.
|
|
8
|
+
*
|
|
9
|
+
* Sourced directly from the `audioInitialState` prop, not from reducer
|
|
10
|
+
* state, so the value object is stable across per-tick `SET_AUDIO_STATE`
|
|
11
|
+
* dispatches and only changes when the consumer hands in a new
|
|
12
|
+
* `audioInitialState` reference.
|
|
13
|
+
*/
|
|
14
|
+
export type AudioAttrsContext = Omit<AudioNativeProps, "volume" | "muted" | "src">;
|
|
15
|
+
export declare const audioAttrsContext: import('react').Context<AudioAttrsContext | null>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RepeatType } from './StateContext';
|
|
2
|
+
export interface PlaybackContext {
|
|
3
|
+
isPlaying: boolean;
|
|
4
|
+
volume: number;
|
|
5
|
+
muted: boolean;
|
|
6
|
+
repeatType: RepeatType;
|
|
7
|
+
isLoadedMetaData: boolean | undefined;
|
|
8
|
+
audioResetKey: number;
|
|
9
|
+
}
|
|
10
|
+
export declare const playbackContext: import('react').Context<PlaybackContext | null>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CoverImgsCss, CustomIcons, ElementRefs } from './StateContext';
|
|
2
|
+
export interface ResourceContext {
|
|
3
|
+
elementRefs?: ElementRefs;
|
|
4
|
+
customIcons?: CustomIcons;
|
|
5
|
+
coverImgsCss?: CoverImgsCss;
|
|
6
|
+
}
|
|
7
|
+
export declare const resourceContext: import('react').Context<ResourceContext | null>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ReactNode } from
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type AudioNativeProps = Omit<React.AudioHTMLAttributes<HTMLAudioElement>, "autoPlay">;
|
|
3
|
+
export type RepeatType = "ALL" | "SHUFFLE" | "ONE" | "NONE";
|
|
4
|
+
export type AudioCustomProps = {
|
|
5
5
|
isLoadedMetaData?: boolean;
|
|
6
6
|
isPlaying?: boolean;
|
|
7
7
|
repeatType?: RepeatType;
|
|
@@ -9,13 +9,23 @@ export declare type AudioCustomProps = {
|
|
|
9
9
|
currentTime?: number;
|
|
10
10
|
duration?: number;
|
|
11
11
|
};
|
|
12
|
-
export declare
|
|
12
|
+
export declare const DEFAULT_AUDIO_STATE: {
|
|
13
|
+
readonly isPlaying: false;
|
|
14
|
+
readonly volume: 1;
|
|
15
|
+
readonly muted: false;
|
|
16
|
+
readonly repeatType: RepeatType;
|
|
17
|
+
readonly currentTime: 0;
|
|
18
|
+
readonly duration: 0;
|
|
19
|
+
};
|
|
20
|
+
export type AudioData = {
|
|
13
21
|
src: string;
|
|
14
22
|
id: number;
|
|
15
|
-
name?: string
|
|
16
|
-
writer?: string
|
|
23
|
+
name?: string;
|
|
24
|
+
writer?: string;
|
|
17
25
|
img?: string;
|
|
18
26
|
description?: string | ReactNode;
|
|
19
27
|
customTrackInfo?: string | ReactNode;
|
|
20
28
|
};
|
|
21
|
-
export
|
|
29
|
+
export type AudioState = AudioNativeProps & Omit<AudioCustomProps, "repeatType"> & {
|
|
30
|
+
repeatType: RepeatType;
|
|
31
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ReactNode } from
|
|
2
|
-
import { AudioData } from
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { AudioData } from './audio';
|
|
3
|
+
export type PlayList = Array<AudioData>;
|
|
4
|
+
export type ProgressUI = "waveform" | "bar" | false;
|
|
5
|
+
export type PlayListUI = "sortable" | "unSortable" | false;
|
|
6
|
+
export type ActiveUI = Partial<{
|
|
7
7
|
all: boolean;
|
|
8
8
|
playButton: boolean;
|
|
9
9
|
playList: PlayListUI;
|
|
@@ -16,7 +16,7 @@ export declare type ActiveUI = Partial<{
|
|
|
16
16
|
artwork: boolean;
|
|
17
17
|
progress: ProgressUI;
|
|
18
18
|
}>;
|
|
19
|
-
export
|
|
19
|
+
export type CustomIcons = Partial<{
|
|
20
20
|
play: ReactNode;
|
|
21
21
|
pause: ReactNode;
|
|
22
22
|
prev: ReactNode;
|
|
@@ -30,13 +30,8 @@ export declare type CustomIcons = Partial<{
|
|
|
30
30
|
volumeMuted: ReactNode;
|
|
31
31
|
playList: ReactNode;
|
|
32
32
|
}>;
|
|
33
|
-
export
|
|
33
|
+
export type ElementRefs = Partial<{
|
|
34
34
|
audioEl: HTMLAudioElement;
|
|
35
|
-
trackCurTimeEl: HTMLSpanElement;
|
|
36
|
-
trackDurationEl: HTMLSpanElement;
|
|
37
|
-
progressBarEl: HTMLDivElement;
|
|
38
|
-
progressValueEl: HTMLDivElement;
|
|
39
|
-
progressHandleEl: HTMLDivElement;
|
|
40
35
|
waveformInst: WaveSurfer;
|
|
41
36
|
}>;
|
|
42
37
|
export interface CoverImgsCss {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AudioState } from
|
|
2
|
-
import { ActiveUI, CoverImgsCss, ElementRefs, CustomIcons, PlayList } from
|
|
3
|
-
import { PlayListPlacement, InterfacePlacement, PlayerPlacement, VolumeSliderPlacement } from
|
|
1
|
+
import { AudioState } from './audio';
|
|
2
|
+
import { ActiveUI, CoverImgsCss, ElementRefs, CustomIcons, PlayList } from './element';
|
|
3
|
+
import { PlayListPlacement, InterfacePlacement, PlayerPlacement, VolumeSliderPlacement } from './placement';
|
|
4
4
|
export interface AudioPlayerStateContext {
|
|
5
5
|
playList: PlayList;
|
|
6
6
|
curPlayId: number;
|
|
@@ -14,11 +14,12 @@ export interface AudioPlayerStateContext {
|
|
|
14
14
|
elementRefs?: ElementRefs;
|
|
15
15
|
customIcons?: CustomIcons;
|
|
16
16
|
coverImgsCss?: CoverImgsCss;
|
|
17
|
+
audioResetKey: number;
|
|
18
|
+
seekRequestKey: number;
|
|
17
19
|
}
|
|
18
|
-
export
|
|
20
|
+
export type InitialStates = Partial<AudioState> & {
|
|
19
21
|
curPlayId: number;
|
|
20
22
|
};
|
|
21
|
-
export * from
|
|
22
|
-
export * from
|
|
23
|
-
export * from
|
|
24
|
-
export declare const audioPlayerStateContext: import("react").Context<AudioPlayerStateContext | null>;
|
|
23
|
+
export * from './audio';
|
|
24
|
+
export * from './element';
|
|
25
|
+
export * from './placement';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { DropdownContentPlacement } from '../../../Dropdown';
|
|
2
2
|
import { NumbersToUnionNum } from '../../../../utils/generateUnionNumType';
|
|
3
|
-
import { ActiveUI } from
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
3
|
+
import { ActiveUI } from './element';
|
|
4
|
+
export type VolumeSliderPlacement = DropdownContentPlacement;
|
|
5
|
+
export type PlayListPlacement = "bottom" | "top";
|
|
6
|
+
export type PlayerPlacement = "bottom" | "top" | "bottom-left" | "bottom-right" | "top-left" | "top-right" | "static";
|
|
7
7
|
export declare const defaultInterfacePlacementMaxLength = 10;
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
8
|
+
export type InterfacePlacementKey = Exclude<keyof ActiveUI, "all" | "prevNnext" | "trackTime" | "volumeSlider"> | "trackTimeCurrent" | "trackTimeDuration";
|
|
9
|
+
export type InterfaceGridTemplateArea<TMaxLength extends number = typeof defaultInterfacePlacementMaxLength> = Partial<Record<InterfacePlacementKey, `row${NumbersToUnionNum<TMaxLength>}-${NumbersToUnionNum<TMaxLength>}`>>;
|
|
10
|
+
export type InterfaceGridCustomComponentsArea<TMaxLength extends number> = Partial<Record<string, `row${NumbersToUnionNum<TMaxLength>}-${NumbersToUnionNum<TMaxLength>}`>>;
|
|
11
|
+
export type InterfaceGridItemArea = Partial<Record<InterfacePlacementKey, string>>;
|
|
12
|
+
export type InterfacePlacement<TMaxLength extends number = typeof defaultInterfacePlacementMaxLength> = {
|
|
13
13
|
templateArea?: InterfaceGridTemplateArea<TMaxLength>;
|
|
14
14
|
customComponentsArea?: InterfaceGridCustomComponentsArea<TMaxLength>;
|
|
15
15
|
itemCustomArea?: InterfaceGridItemArea;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ActiveUI, InterfacePlacement, PlayListPlacement, PlayerPlacement, VolumeSliderPlacement } from './StateContext';
|
|
2
|
+
export type ColorScheme = "light" | "dark";
|
|
3
|
+
export interface UIContext {
|
|
4
|
+
activeUI: ActiveUI;
|
|
5
|
+
playListPlacement: PlayListPlacement;
|
|
6
|
+
playerPlacement?: PlayerPlacement;
|
|
7
|
+
interfacePlacement?: InterfacePlacement;
|
|
8
|
+
volumeSliderPlacement?: VolumeSliderPlacement;
|
|
9
|
+
colorScheme?: ColorScheme;
|
|
10
|
+
}
|
|
11
|
+
export declare const uiContext: import('react').Context<UIContext | null>;
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import { Dispatch } from
|
|
2
|
-
import { RepeatType, PlayList, PlayListPlacement, PlayerPlacement, ActiveUI, ElementRefs, CustomIcons, InterfacePlacement, CoverImgsCss, VolumeSliderPlacement, defaultInterfacePlacementMaxLength, AudioState } from
|
|
3
|
-
export
|
|
1
|
+
import { Dispatch } from 'react';
|
|
2
|
+
import { RepeatType, PlayList, PlayListPlacement, PlayerPlacement, ActiveUI, ElementRefs, CustomIcons, InterfacePlacement, CoverImgsCss, VolumeSliderPlacement, defaultInterfacePlacementMaxLength, AudioState } from './StateContext';
|
|
3
|
+
export type AudioContextAction<TInterfacePlacementLength extends number = typeof defaultInterfacePlacementMaxLength> = {
|
|
4
4
|
type: "NEXT_AUDIO";
|
|
5
5
|
} | {
|
|
6
6
|
type: "PREV_AUDIO";
|
|
7
|
+
currentTime: number;
|
|
8
|
+
} | {
|
|
9
|
+
type: "SEEK";
|
|
10
|
+
time: number;
|
|
7
11
|
} | {
|
|
8
12
|
type: "UPDATE_PLAY_LIST";
|
|
9
13
|
playList: PlayList;
|
|
10
14
|
} | {
|
|
11
15
|
type: "SET_AUDIO_STATE";
|
|
12
|
-
audioState: AudioState
|
|
16
|
+
audioState: Partial<AudioState>;
|
|
13
17
|
} | {
|
|
14
18
|
type: "SET_INITIAL_STATES";
|
|
15
|
-
audioState: AudioState
|
|
19
|
+
audioState: Partial<AudioState>;
|
|
16
20
|
curPlayId: number;
|
|
17
21
|
} | {
|
|
18
22
|
type: "CHANGE_PLAYING_STATE";
|
|
@@ -49,5 +53,5 @@ export declare type AudioContextAction<TInterfacePlacementLength extends number
|
|
|
49
53
|
interfacePlacement?: InterfacePlacement<TInterfacePlacementLength>;
|
|
50
54
|
volumeSliderPlacement?: VolumeSliderPlacement;
|
|
51
55
|
};
|
|
52
|
-
export
|
|
53
|
-
export declare const audioPlayerDispatchContext: import(
|
|
56
|
+
export type AudioPlayerDispatchContext = Dispatch<AudioContextAction>;
|
|
57
|
+
export declare const audioPlayerDispatchContext: import('react').Context<AudioPlayerDispatchContext | null>;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from './StateContext';
|
|
2
|
+
export * from './dispatchContext';
|
|
3
|
+
export * from './reducer';
|
|
4
|
+
export * from './PlaybackContext';
|
|
5
|
+
export * from './AudioAttrsContext';
|
|
6
|
+
export * from './TrackContext';
|
|
7
|
+
export * from './UIContext';
|
|
8
|
+
export * from './ResourceContext';
|
|
9
|
+
export * from './TimeContext';
|
|
10
|
+
export * from './providerProps';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ActiveUI, CoverImgsCss, CustomIcons, InitialStates, InterfacePlacement, PlayList, PlayListPlacement, PlayerPlacement, VolumeSliderPlacement } from './StateContext';
|
|
2
|
+
export interface AudioPlayerStateProviderProps<TInterfacePlacementLength extends number> {
|
|
3
|
+
playList: PlayList;
|
|
4
|
+
audioInitialState?: InitialStates;
|
|
5
|
+
activeUI?: ActiveUI;
|
|
6
|
+
customIcons?: CustomIcons;
|
|
7
|
+
coverImgsCss?: CoverImgsCss;
|
|
8
|
+
placement?: {
|
|
9
|
+
player?: PlayerPlacement;
|
|
10
|
+
playList?: PlayListPlacement;
|
|
11
|
+
interface?: InterfacePlacement<TInterfacePlacementLength>;
|
|
12
|
+
volumeSlider?: VolumeSliderPlacement;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { AudioContextAction } from
|
|
2
|
-
import { AudioPlayerStateContext } from
|
|
1
|
+
import { AudioContextAction } from './dispatchContext';
|
|
2
|
+
import { AudioPlayerStateContext } from './StateContext';
|
|
3
3
|
export declare const audioPlayerReducer: (state: AudioPlayerStateContext, action: AudioContextAction) => AudioPlayerStateContext;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { FC } from
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
export declare const PlayBtn: FC;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { FC } from
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
export declare const RepeatTypeBtn: FC;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VolumeTriggerBtn: import(
|
|
1
|
+
export declare const VolumeTriggerBtn: import('react').MemoExoticComponent<import('react').ForwardRefExoticComponent<import('react').RefAttributes<HTMLButtonElement>>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
1
|
+
export * from './PlayBtn';
|
|
2
|
+
export * from './PrevBtn';
|
|
3
|
+
export * from './NextBtn';
|
|
4
|
+
export * from './RepeatTypeBtn';
|
|
5
|
+
export * from './VolumeTriggerBtn';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AudioData } from '
|
|
2
|
-
export declare const PlayListItem: ({
|
|
1
|
+
import { AudioData } from '../../../../../Context';
|
|
2
|
+
export declare const PlayListItem: import('react').NamedExoticComponent<{
|
|
3
3
|
data: AudioData;
|
|
4
|
-
}
|
|
4
|
+
}>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { AudioData } from '
|
|
2
|
-
import { CssTransitionProps } from '
|
|
1
|
+
import { AudioData } from '../../../../../Context';
|
|
2
|
+
import { CssTransitionProps } from '../../../../../../../ui/CssTransition';
|
|
3
3
|
import { UseSortableListItemProps } from '../../../../../../SortableList/useSortableListItem';
|
|
4
|
-
import { SortablePlayListProps } from ".";
|
|
5
4
|
interface UsePlayListReturn {
|
|
6
5
|
cssTransitionEventProps: Partial<CssTransitionProps>;
|
|
7
6
|
sortableItemEventProps: Omit<UseSortableListItemProps<AudioData>, "onDragStart" | "onClick" | "index" | "listData"> & {
|
|
@@ -10,6 +9,6 @@ interface UsePlayListReturn {
|
|
|
10
9
|
};
|
|
11
10
|
}
|
|
12
11
|
export declare const usePlayList: ({ setIsOpen, }: {
|
|
13
|
-
setIsOpen:
|
|
12
|
+
setIsOpen: (isOpen: boolean) => void;
|
|
14
13
|
}) => UsePlayListReturn;
|
|
15
14
|
export {};
|
package/dist/types/components/AudioPlayer/Interface/Controller/Drawer/SortablePlayList/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { FC } from
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
export declare const SortablePlayList: FC;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './SortablePlayList';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FC, ReactElement, ReactNode } from
|
|
2
|
-
import {
|
|
1
|
+
import { FC, ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { SvgIconProps } from '../../../icons';
|
|
3
3
|
interface _IconProps {
|
|
4
|
-
render: ReactElement<
|
|
4
|
+
render: ReactElement<SvgIconProps>;
|
|
5
5
|
customIcon?: ReactNode;
|
|
6
6
|
}
|
|
7
7
|
export declare const Icon: FC<_IconProps>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { FC } from
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
export declare const Progress: FC;
|
package/dist/types/components/AudioPlayer/Interface/Controller/Input/Progress/useProgress.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { HTMLAttributes } from
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
2
|
export declare const useProgress: () => HTMLAttributes<HTMLDivElement>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './Progress';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { VolumeSliderPlacement } from '
|
|
2
|
-
import { FC } from
|
|
1
|
+
import { VolumeSliderPlacement } from '../../../../Context/StateContext';
|
|
2
|
+
import { FC } from 'react';
|
|
3
3
|
export declare const VolumeSlider: FC<{
|
|
4
4
|
placement: VolumeSliderPlacement;
|
|
5
5
|
}>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { FC } from
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
export declare const Volume: FC;
|
package/dist/types/components/AudioPlayer/Interface/Controller/Tooltip/Volume/useVolume.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { VolumeSliderPlacement } from '
|
|
1
|
+
import { VolumeSliderPlacement } from '../../../../Context';
|
|
2
2
|
export declare const useVolumeSliderPlacement: ({ triggerRef, initialState, }: {
|
|
3
3
|
triggerRef: React.RefObject<HTMLElement>;
|
|
4
4
|
initialState: VolumeSliderPlacement;
|
|
5
|
-
}) => import(
|
|
5
|
+
}) => import('../../../../../Dropdown').DropdownContentPlacement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './Volume';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { FC } from
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
export declare const Controller: FC;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GridItemProps } from '../../../Grid/Item';
|
|
2
|
-
import React,
|
|
3
|
-
export
|
|
2
|
+
import { default as React, FC } from 'react';
|
|
3
|
+
export type CustomComponentProps = {
|
|
4
4
|
children?: React.ReactNode;
|
|
5
5
|
id: string;
|
|
6
6
|
} & GridItemProps;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { FC } from
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
export declare const Artwork: FC;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { FC } from
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
export declare const TrackInfo: FC;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { FC } from
|
|
2
|
-
import { TrackTimeChildrenProps } from
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { TrackTimeChildrenProps } from './Types';
|
|
3
3
|
export declare const Current: FC<TrackTimeChildrenProps>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { FC } from
|
|
2
|
-
import { TrackTimeChildrenProps } from
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { TrackTimeChildrenProps } from './Types';
|
|
3
3
|
export declare const Duration: FC<TrackTimeChildrenProps>;
|
package/dist/types/components/AudioPlayer/Interface/Information/TrackTime/TrackTimeContainer.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FC, HTMLAttributes, PropsWithChildren } from 'react';
|
|
2
|
+
import { TrackTimePosition } from './Types';
|
|
3
|
+
export interface TrackTimeContainerProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
position: TrackTimePosition;
|
|
5
|
+
}
|
|
6
|
+
export declare const TrackTimeContainer: FC<PropsWithChildren<TrackTimeContainerProps>>;
|