@layers-app/shared 0.4.6 → 0.4.8
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/assets/default-workspace-avatar.jpg.js +1 -1
- package/dist/components/AliasTextInput/AliasTextInput.d.ts.map +1 -1
- package/dist/components/AliasTextInput/AliasTextInput.js +32 -32
- package/dist/components/AppContainer/AppContainer.d.ts +1 -1
- package/dist/components/AppContainer/AppContainer.d.ts.map +1 -1
- package/dist/components/AppContainer/AppContainer.js +82 -70
- package/dist/components/AppContainer/AppContainer.module.css.js +20 -10
- package/dist/components/AppContainer/components/AppsSidebar/DesktopUpdateButton.d.ts +6 -0
- package/dist/components/AppContainer/components/AppsSidebar/DesktopUpdateButton.d.ts.map +1 -0
- package/dist/components/AppContainer/components/AppsSidebar/DesktopUpdateButton.js +161 -0
- package/dist/components/AppContainer/components/AppsSidebar/TopSection.d.ts.map +1 -1
- package/dist/components/AppContainer/components/AppsSidebar/TopSection.js +77 -49
- package/dist/components/AppContainer/components/AppsSidebar/UserSection.d.ts.map +1 -1
- package/dist/components/AppContainer/components/AppsSidebar/UserSection.js +238 -105
- package/dist/components/AppContainer/components/Main.js +4 -4
- package/dist/components/AppContainer/components/NavbarContent.d.ts.map +1 -1
- package/dist/components/AppContainer/components/NavbarContent.js +16 -2
- package/dist/components/AppContainer/components/SlideAnimation.js +4 -4
- package/dist/components/AppContainer/components/ToolSidebar.d.ts +5 -0
- package/dist/components/AppContainer/components/ToolSidebar.d.ts.map +1 -1
- package/dist/components/AppContainer/components/ToolSidebar.js +51 -39
- package/dist/components/AppContainer/components/menus/HelpMenu/HelpMenu.d.ts +62 -1
- package/dist/components/AppContainer/components/menus/HelpMenu/HelpMenu.d.ts.map +1 -1
- package/dist/components/AppContainer/components/menus/HelpMenu/HelpMenu.js +1107 -137
- package/dist/components/AppContainer/components/menus/HelpMenu/HelpMenu.module.css.js +158 -6
- package/dist/components/AppContainer/types.d.ts +12 -0
- package/dist/components/AppContainer/types.d.ts.map +1 -1
- package/dist/components/AttachmentsPreview/AttachmentsPreview.d.ts +3 -1
- package/dist/components/AttachmentsPreview/AttachmentsPreview.d.ts.map +1 -1
- package/dist/components/AttachmentsPreview/AttachmentsPreview.js +237 -93
- package/dist/components/AttachmentsPreview/AttachmentsPreview.module.css.js +18 -16
- package/dist/components/Chat/ChatInput/index.d.ts +13 -1
- package/dist/components/Chat/ChatInput/index.d.ts.map +1 -1
- package/dist/components/Chat/ChatInput/index.js +264 -164
- package/dist/components/Chat/ChatInput/useVoiceRecorder.d.ts +16 -0
- package/dist/components/Chat/ChatInput/useVoiceRecorder.d.ts.map +1 -0
- package/dist/components/Chat/ChatInput/useVoiceRecorder.js +83 -0
- package/dist/components/Chat/ChatMessage/ChatMessage.module.css.js +20 -16
- package/dist/components/Chat/ChatMessage/index.d.ts +16 -0
- package/dist/components/Chat/ChatMessage/index.d.ts.map +1 -1
- package/dist/components/Chat/ChatMessage/index.js +153 -118
- package/dist/components/Chat/MessageActions/index.d.ts +2 -0
- package/dist/components/Chat/MessageActions/index.d.ts.map +1 -1
- package/dist/components/Chat/MessageActions/index.js +189 -50
- package/dist/components/Chat/MessageAuthor/index.d.ts +7 -1
- package/dist/components/Chat/MessageAuthor/index.d.ts.map +1 -1
- package/dist/components/Chat/MessageAuthor/index.js +39 -25
- package/dist/components/Chat/MessageList/MessageList.module.css.js +14 -12
- package/dist/components/Chat/MessageList/index.d.ts +17 -25
- package/dist/components/Chat/MessageList/index.d.ts.map +1 -1
- package/dist/components/Chat/MessageList/index.js +201 -149
- package/dist/components/Chat/MessageMeta/index.d.ts.map +1 -1
- package/dist/components/Chat/MessageMeta/index.js +21 -19
- package/dist/components/ColorPicker/ColorPicker.d.ts +3 -0
- package/dist/components/ColorPicker/ColorPicker.d.ts.map +1 -1
- package/dist/components/ColorPicker/ColorPicker.js +81 -76
- package/dist/components/ColorPicker/ColorPickerToolbar.d.ts +1 -0
- package/dist/components/ColorPicker/ColorPickerToolbar.d.ts.map +1 -1
- package/dist/components/ColorPicker/ColorPickerToolbar.js +97 -91
- package/dist/components/CommentComposer/CommentEditorHotkeys.d.ts +2 -1
- package/dist/components/CommentComposer/CommentEditorHotkeys.d.ts.map +1 -1
- package/dist/components/CommentComposer/CommentEditorHotkeys.js +29 -26
- package/dist/components/CommentComposer/index.d.ts +1 -1
- package/dist/components/CommentComposer/index.d.ts.map +1 -1
- package/dist/components/CommentComposer/index.js +70 -68
- package/dist/components/CommentComposer/types.d.ts +6 -0
- package/dist/components/CommentComposer/types.d.ts.map +1 -1
- package/dist/components/CustomKBD/index.js +21 -22
- package/dist/components/EmojiPicker/EmojiPicker.d.ts +1 -0
- package/dist/components/EmojiPicker/EmojiPicker.d.ts.map +1 -1
- package/dist/components/EmojiPicker/EmojiPicker.js +129 -121
- package/dist/components/EntityTitle/EntityTitle.d.ts +3 -4
- package/dist/components/EntityTitle/EntityTitle.d.ts.map +1 -1
- package/dist/components/EntityTitle/EntityTitle.js +81 -80
- package/dist/components/FormViewer/helpers/conditions.d.ts.map +1 -1
- package/dist/components/FormViewer/helpers/conditions.js +33 -17
- package/dist/components/IntegrationFlowAnimation/IntegrationFlowAnimation.d.ts +3 -1
- package/dist/components/IntegrationFlowAnimation/IntegrationFlowAnimation.d.ts.map +1 -1
- package/dist/components/IntegrationFlowAnimation/IntegrationFlowAnimation.js +26 -25
- package/dist/components/NewToolbar/utils.d.ts +12 -0
- package/dist/components/NewToolbar/utils.d.ts.map +1 -0
- package/dist/components/Notification/InfiniteScroll.d.ts +12 -0
- package/dist/components/Notification/InfiniteScroll.d.ts.map +1 -0
- package/dist/components/Notification/InfiniteScroll.js +42 -0
- package/dist/components/Notification/Notification.d.ts +4 -1
- package/dist/components/Notification/Notification.d.ts.map +1 -1
- package/dist/components/Notification/Notification.module.css.js +28 -4
- package/dist/components/Notification/atoms/ActionBadge.d.ts +11 -0
- package/dist/components/Notification/atoms/ActionBadge.d.ts.map +1 -0
- package/dist/components/Notification/atoms/ActionBadge.js +53 -0
- package/dist/components/Notification/atoms/ArchiveIcon.d.ts +7 -0
- package/dist/components/Notification/atoms/ArchiveIcon.d.ts.map +1 -0
- package/dist/components/Notification/atoms/ArchiveIcon.js +40 -0
- package/dist/components/Notification/atoms/InboxIcon.d.ts +7 -0
- package/dist/components/Notification/atoms/InboxIcon.d.ts.map +1 -0
- package/dist/components/Notification/atoms/InboxIcon.js +33 -0
- package/dist/components/Notification/atoms/MarkReadIcon.d.ts +7 -0
- package/dist/components/Notification/atoms/MarkReadIcon.d.ts.map +1 -0
- package/dist/components/Notification/atoms/MarkReadIcon.js +33 -0
- package/dist/components/Notification/atoms/ResourceIcon.d.ts +7 -0
- package/dist/components/Notification/atoms/ResourceIcon.d.ts.map +1 -0
- package/dist/components/Notification/atoms/TabBadge.d.ts +7 -0
- package/dist/components/Notification/atoms/TabBadge.d.ts.map +1 -0
- package/dist/components/Notification/atoms/TabBadge.js +32 -0
- package/dist/components/Notification/atoms/UnreadDot.d.ts +6 -0
- package/dist/components/Notification/atoms/UnreadDot.d.ts.map +1 -0
- package/dist/components/Notification/atoms/UnreadDot.js +23 -0
- package/dist/components/Notification/atoms/index.d.ts +5 -0
- package/dist/components/Notification/atoms/index.d.ts.map +1 -0
- package/dist/components/Notification/hooks/index.d.ts +8 -0
- package/dist/components/Notification/hooks/index.d.ts.map +1 -0
- package/dist/components/Notification/hooks/useInboxActions.d.ts +12 -0
- package/dist/components/Notification/hooks/useInboxActions.d.ts.map +1 -0
- package/dist/components/Notification/hooks/useInboxActions.js +58 -0
- package/dist/components/Notification/hooks/useInboxLoader.d.ts +8 -0
- package/dist/components/Notification/hooks/useInboxLoader.d.ts.map +1 -0
- package/dist/components/Notification/hooks/useInboxLoader.js +49 -0
- package/dist/components/Notification/hooks/useNotificationItem.d.ts +26 -0
- package/dist/components/Notification/hooks/useNotificationItem.d.ts.map +1 -0
- package/dist/components/Notification/hooks/useNotificationItem.js +51 -0
- package/dist/components/Notification/hooks/useNotificationStore.d.ts +49 -0
- package/dist/components/Notification/hooks/useNotificationStore.d.ts.map +1 -0
- package/dist/components/Notification/hooks/useNotificationStore.js +139 -0
- package/dist/components/Notification/hooks/useNotificationStream.d.ts +2 -0
- package/dist/components/Notification/hooks/useNotificationStream.d.ts.map +1 -0
- package/dist/components/Notification/hooks/useNotificationStream.js +86 -0
- package/dist/components/Notification/hooks/useNotificationTime.d.ts +2 -0
- package/dist/components/Notification/hooks/useNotificationTime.d.ts.map +1 -0
- package/dist/components/Notification/hooks/useNotificationTime.js +23 -0
- package/dist/components/Notification/hooks/useNotificationsApi.d.ts +25 -0
- package/dist/components/Notification/hooks/useNotificationsApi.d.ts.map +1 -0
- package/dist/components/Notification/hooks/useNotificationsApi.js +64 -0
- package/dist/components/Notification/lib/api.d.ts +4 -0
- package/dist/components/Notification/lib/api.d.ts.map +1 -0
- package/dist/components/Notification/lib/api.js +19 -0
- package/dist/components/Notification/lib/index.d.ts +5 -0
- package/dist/components/Notification/lib/index.d.ts.map +1 -0
- package/dist/components/Notification/lib/notificationText.d.ts +10 -0
- package/dist/components/Notification/lib/notificationText.d.ts.map +1 -0
- package/dist/components/Notification/lib/notificationText.js +131 -0
- package/dist/components/Notification/lib/stripHtml.d.ts +2 -0
- package/dist/components/Notification/lib/stripHtml.d.ts.map +1 -0
- package/dist/components/Notification/lib/stripHtml.js +6 -0
- package/dist/components/Notification/lib/types.d.ts +45 -0
- package/dist/components/Notification/lib/types.d.ts.map +1 -0
- package/dist/components/Notification/lib/types.js +9 -0
- package/dist/components/Notification/molecules/InboxEmpty.d.ts +8 -0
- package/dist/components/Notification/molecules/InboxEmpty.d.ts.map +1 -0
- package/dist/components/Notification/molecules/InboxEmpty.js +21 -0
- package/dist/components/Notification/molecules/InboxHeader.d.ts +17 -0
- package/dist/components/Notification/molecules/InboxHeader.d.ts.map +1 -0
- package/dist/components/Notification/molecules/InboxHeader.js +73 -0
- package/dist/components/Notification/molecules/InboxTabs.d.ts +15 -0
- package/dist/components/Notification/molecules/InboxTabs.d.ts.map +1 -0
- package/dist/components/Notification/molecules/InboxTabs.js +60 -0
- package/dist/components/Notification/molecules/NotificationActions.d.ts +9 -0
- package/dist/components/Notification/molecules/NotificationActions.d.ts.map +1 -0
- package/dist/components/Notification/molecules/NotificationActions.js +64 -0
- package/dist/components/Notification/molecules/NotificationAvatar.d.ts +17 -0
- package/dist/components/Notification/molecules/NotificationAvatar.d.ts.map +1 -0
- package/dist/components/Notification/molecules/NotificationAvatar.js +38 -0
- package/dist/components/Notification/molecules/NotificationContent.d.ts +22 -0
- package/dist/components/Notification/molecules/NotificationContent.d.ts.map +1 -0
- package/dist/components/Notification/molecules/NotificationContent.js +183 -0
- package/dist/components/Notification/molecules/index.d.ts +7 -0
- package/dist/components/Notification/molecules/index.d.ts.map +1 -0
- package/dist/components/Notification/organisms/InboxItem.d.ts +14 -0
- package/dist/components/Notification/organisms/InboxItem.d.ts.map +1 -0
- package/dist/components/Notification/organisms/InboxItem.js +100 -0
- package/dist/components/Notification/organisms/InboxPanel.d.ts +4 -0
- package/dist/components/Notification/organisms/InboxPanel.d.ts.map +1 -0
- package/dist/components/Notification/organisms/InboxPanel.js +99 -0
- package/dist/components/Notification/organisms/index.d.ts +3 -0
- package/dist/components/Notification/organisms/index.d.ts.map +1 -0
- package/dist/components/OnboardingTour/index.d.ts +1 -1
- package/dist/components/OnboardingTour/index.d.ts.map +1 -1
- package/dist/components/OnboardingTour/useOnboardingTour.d.ts +2 -0
- package/dist/components/OnboardingTour/useOnboardingTour.d.ts.map +1 -1
- package/dist/components/OnboardingTour/useOnboardingTour.js +63 -51
- package/dist/components/modals/RemoveConfirmModal.d.ts.map +1 -1
- package/dist/components/modals/RemoveConfirmModal.js +27 -26
- package/dist/config/brand.d.ts.map +1 -1
- package/dist/config/brand.js +29 -29
- package/dist/config/envConfig.d.ts +4 -0
- package/dist/config/envConfig.d.ts.map +1 -1
- package/dist/config/envConfig.js +29 -28
- package/dist/helpers/getFileIcons.js +5 -5
- package/dist/helpers/getFileType.d.ts.map +1 -1
- package/dist/helpers/getFileType.js +11 -2
- package/dist/helpers/platform.d.ts +1 -1
- package/dist/helpers/platform.d.ts.map +1 -1
- package/dist/helpers/platform.js +1 -0
- package/dist/helpers/showNotifications.d.ts +8 -14
- package/dist/helpers/showNotifications.d.ts.map +1 -1
- package/dist/helpers/showNotifications.js +107 -111
- package/dist/helpers/showNotifications.module.css.js +4 -16
- package/dist/hooks/useDateUtils.d.ts.map +1 -1
- package/dist/hooks/useDateUtils.js +19 -23
- package/dist/index.css +1 -1
- package/dist/index.js +576 -573
- package/dist/node_modules/@gfazioli/mantine-audio/dist/esm/Audio.context.js +15 -0
- package/dist/node_modules/@gfazioli/mantine-audio/dist/esm/Audio.js +228 -0
- package/dist/node_modules/@gfazioli/mantine-audio/dist/esm/Audio.module.css.js +4 -0
- package/dist/node_modules/@gfazioli/mantine-audio/dist/esm/components/AudioControls.js +19 -0
- package/dist/node_modules/@gfazioli/mantine-audio/dist/esm/components/AudioMuteButton.js +30 -0
- package/dist/node_modules/@gfazioli/mantine-audio/dist/esm/components/AudioPlayButton.js +40 -0
- package/dist/node_modules/@gfazioli/mantine-audio/dist/esm/components/AudioSkipButton.js +28 -0
- package/dist/node_modules/@gfazioli/mantine-audio/dist/esm/components/AudioSpectrum.js +137 -0
- package/dist/node_modules/@gfazioli/mantine-audio/dist/esm/components/AudioSpeedControl.js +31 -0
- package/dist/node_modules/@gfazioli/mantine-audio/dist/esm/components/AudioTimeDisplay.js +44 -0
- package/dist/node_modules/@gfazioli/mantine-audio/dist/esm/components/AudioTimeline.js +71 -0
- package/dist/node_modules/@gfazioli/mantine-audio/dist/esm/components/AudioVolumeSlider.js +43 -0
- package/dist/node_modules/@gfazioli/mantine-audio/dist/esm/components/AudioWaveform.js +166 -0
- package/dist/node_modules/@gfazioli/mantine-audio/dist/esm/use-audio.js +201 -0
- package/dist/node_modules/@gfazioli/mantine-video/dist/esm/Video.context.js +15 -0
- package/dist/node_modules/@gfazioli/mantine-video/dist/esm/Video.js +272 -0
- package/dist/node_modules/@gfazioli/mantine-video/dist/esm/Video.module.css.js +4 -0
- package/dist/node_modules/@gfazioli/mantine-video/dist/esm/components/VideoCaptionsButton.js +55 -0
- package/dist/node_modules/@gfazioli/mantine-video/dist/esm/components/VideoControls.js +30 -0
- package/dist/node_modules/@gfazioli/mantine-video/dist/esm/components/VideoFullscreenButton.js +31 -0
- package/dist/node_modules/@gfazioli/mantine-video/dist/esm/components/VideoMuteButton.js +29 -0
- package/dist/node_modules/@gfazioli/mantine-video/dist/esm/components/VideoPiPButton.js +29 -0
- package/dist/node_modules/@gfazioli/mantine-video/dist/esm/components/VideoPlayButton.js +28 -0
- package/dist/node_modules/@gfazioli/mantine-video/dist/esm/components/VideoSkipButton.js +27 -0
- package/dist/node_modules/@gfazioli/mantine-video/dist/esm/components/VideoTimeDisplay.js +44 -0
- package/dist/node_modules/@gfazioli/mantine-video/dist/esm/components/VideoTimeline.js +70 -0
- package/dist/node_modules/@gfazioli/mantine-video/dist/esm/use-video.js +170 -0
- package/package.json +5 -3
- package/dist/components/Notification/Notification.js +0 -119
- package/dist/components/Notification/NotificationCard.d.ts +0 -10
- package/dist/components/Notification/NotificationCard.d.ts.map +0 -1
- package/dist/components/Notification/NotificationCard.js +0 -93
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createContext as t, useContext as n } from "react";
|
|
2
|
+
const o = t(null), r = o.Provider;
|
|
3
|
+
function d() {
|
|
4
|
+
const e = n(o);
|
|
5
|
+
if (!e)
|
|
6
|
+
throw new Error(
|
|
7
|
+
"Audio compound component must be rendered inside an <Audio /> parent. If you need access to the audio state outside the <Audio /> tree, use the useAudio() hook instead."
|
|
8
|
+
);
|
|
9
|
+
return e;
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
o as AudioContext,
|
|
13
|
+
r as AudioProvider,
|
|
14
|
+
d as useAudioContext
|
|
15
|
+
};
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { factory as re, useProps as te, useStyles as ae, Box as se, createVarsResolver as le, getThemeColor as ie, getRadius as ue } from "@mantine/core";
|
|
2
|
+
import a, { useState as ce, useEffect as ne, useCallback as S } from "react";
|
|
3
|
+
import { AudioProvider as de } from "./Audio.context.js";
|
|
4
|
+
import { AudioControls as w } from "./components/AudioControls.js";
|
|
5
|
+
import { AudioMuteButton as R } from "./components/AudioMuteButton.js";
|
|
6
|
+
import { AudioPlayButton as me } from "./components/AudioPlayButton.js";
|
|
7
|
+
import { AudioSkipButton as pe } from "./components/AudioSkipButton.js";
|
|
8
|
+
import { AudioSpectrum as fe } from "./components/AudioSpectrum.js";
|
|
9
|
+
import { AudioSpeedControl as ye } from "./components/AudioSpeedControl.js";
|
|
10
|
+
import { AudioTimeDisplay as ge } from "./components/AudioTimeDisplay.js";
|
|
11
|
+
import { AudioTimeline as ke } from "./components/AudioTimeline.js";
|
|
12
|
+
import { AudioVolumeSlider as be } from "./components/AudioVolumeSlider.js";
|
|
13
|
+
import { AudioWaveform as ve } from "./components/AudioWaveform.js";
|
|
14
|
+
import { useAudio as Ae } from "./use-audio.js";
|
|
15
|
+
import E from "./Audio.module.css.js";
|
|
16
|
+
const he = {
|
|
17
|
+
color: "blue",
|
|
18
|
+
radius: "md",
|
|
19
|
+
size: "md",
|
|
20
|
+
variant: "overlay",
|
|
21
|
+
preload: "metadata",
|
|
22
|
+
crossOrigin: "anonymous",
|
|
23
|
+
waveformSamples: 512,
|
|
24
|
+
fftSize: 256,
|
|
25
|
+
backgroundMuteButton: !0
|
|
26
|
+
}, Se = le((s, { color: i, radius: u }) => ({
|
|
27
|
+
root: {
|
|
28
|
+
"--audio-color": ie(i, s),
|
|
29
|
+
"--audio-radius": u === void 0 ? void 0 : ue(u),
|
|
30
|
+
"--audio-bg": void 0,
|
|
31
|
+
"--audio-text-color": void 0,
|
|
32
|
+
"--audio-timeline-color": void 0,
|
|
33
|
+
"--audio-timeline-thumb-color": void 0,
|
|
34
|
+
"--audio-waveform-color": void 0,
|
|
35
|
+
"--audio-waveform-played-color": void 0,
|
|
36
|
+
"--audio-spectrum-bar-color": void 0
|
|
37
|
+
}
|
|
38
|
+
})), r = re((s) => {
|
|
39
|
+
const i = te("Audio", he, s), {
|
|
40
|
+
ref: u,
|
|
41
|
+
src: l,
|
|
42
|
+
sources: t,
|
|
43
|
+
fallbackSrc: c,
|
|
44
|
+
controls: we,
|
|
45
|
+
autoPlay: y,
|
|
46
|
+
muted: g,
|
|
47
|
+
loop: k,
|
|
48
|
+
preload: B,
|
|
49
|
+
crossOrigin: b,
|
|
50
|
+
playing: C,
|
|
51
|
+
onPlayChange: D,
|
|
52
|
+
currentTime: P,
|
|
53
|
+
onCurrentTimeChange: T,
|
|
54
|
+
volume: M,
|
|
55
|
+
onVolumeChange: x,
|
|
56
|
+
playbackRate: N,
|
|
57
|
+
onPlaybackRateChange: V,
|
|
58
|
+
color: Re,
|
|
59
|
+
radius: Ee,
|
|
60
|
+
size: _,
|
|
61
|
+
variant: z,
|
|
62
|
+
shortcuts: Be,
|
|
63
|
+
waveformSamples: O,
|
|
64
|
+
fftSize: F,
|
|
65
|
+
disableWebAudio: K,
|
|
66
|
+
scrubSound: L = !1,
|
|
67
|
+
onEnded: W,
|
|
68
|
+
onError: v,
|
|
69
|
+
asBackground: n,
|
|
70
|
+
backgroundMuteButton: I,
|
|
71
|
+
children: U,
|
|
72
|
+
classNames: $,
|
|
73
|
+
style: j,
|
|
74
|
+
styles: J,
|
|
75
|
+
unstyled: X,
|
|
76
|
+
vars: q,
|
|
77
|
+
className: G,
|
|
78
|
+
mod: H,
|
|
79
|
+
...Q
|
|
80
|
+
} = i, Y = s.controls ?? !n, f = s.shortcuts ?? !n;
|
|
81
|
+
process.env.NODE_ENV !== "production" && l && t && t.length > 0 && console.warn(
|
|
82
|
+
"[mantine-audio] Both `src` and `sources` are set — `sources` will be used. Pass only one."
|
|
83
|
+
);
|
|
84
|
+
const [d, A] = ce(!1);
|
|
85
|
+
ne(() => {
|
|
86
|
+
A(!1);
|
|
87
|
+
}, [l, t, c]);
|
|
88
|
+
const Z = S(
|
|
89
|
+
(o) => {
|
|
90
|
+
c && !d && A(!0), v?.(o);
|
|
91
|
+
},
|
|
92
|
+
[c, d, v]
|
|
93
|
+
), h = !d && Array.isArray(t) && t.length > 0, ee = d ? c : h ? void 0 : l, m = ae({
|
|
94
|
+
name: "Audio",
|
|
95
|
+
props: i,
|
|
96
|
+
classes: E,
|
|
97
|
+
className: G,
|
|
98
|
+
style: j,
|
|
99
|
+
classNames: $,
|
|
100
|
+
styles: J,
|
|
101
|
+
unstyled: X,
|
|
102
|
+
vars: q,
|
|
103
|
+
varsResolver: Se
|
|
104
|
+
}), e = Ae({
|
|
105
|
+
src: l,
|
|
106
|
+
autoPlay: y,
|
|
107
|
+
muted: g,
|
|
108
|
+
loop: k,
|
|
109
|
+
playing: C,
|
|
110
|
+
onPlayChange: D,
|
|
111
|
+
currentTime: P,
|
|
112
|
+
onCurrentTimeChange: T,
|
|
113
|
+
volume: M,
|
|
114
|
+
onVolumeChange: x,
|
|
115
|
+
playbackRate: N,
|
|
116
|
+
onPlaybackRateChange: V,
|
|
117
|
+
onEnded: W,
|
|
118
|
+
onError: Z,
|
|
119
|
+
waveformSamples: O,
|
|
120
|
+
fftSize: F,
|
|
121
|
+
disableWebAudio: K
|
|
122
|
+
}), oe = S(
|
|
123
|
+
(o) => {
|
|
124
|
+
if (!f)
|
|
125
|
+
return;
|
|
126
|
+
const p = o.target;
|
|
127
|
+
if (!(p.tagName === "INPUT" || p.tagName === "TEXTAREA"))
|
|
128
|
+
switch (o.key) {
|
|
129
|
+
case " ":
|
|
130
|
+
case "k":
|
|
131
|
+
case "K":
|
|
132
|
+
o.preventDefault(), e.toggle();
|
|
133
|
+
break;
|
|
134
|
+
case "ArrowLeft":
|
|
135
|
+
case "j":
|
|
136
|
+
case "J":
|
|
137
|
+
o.preventDefault(), e.seekBy(o.key === "ArrowLeft" ? -5 : -10);
|
|
138
|
+
break;
|
|
139
|
+
case "ArrowRight":
|
|
140
|
+
case "l":
|
|
141
|
+
case "L":
|
|
142
|
+
o.preventDefault(), e.seekBy(o.key === "ArrowRight" ? 5 : 10);
|
|
143
|
+
break;
|
|
144
|
+
case "ArrowUp":
|
|
145
|
+
o.preventDefault(), e.setVolume(Math.min(1, e.volume + 0.05));
|
|
146
|
+
break;
|
|
147
|
+
case "ArrowDown":
|
|
148
|
+
o.preventDefault(), e.setVolume(Math.max(0, e.volume - 0.05));
|
|
149
|
+
break;
|
|
150
|
+
case "m":
|
|
151
|
+
case "M":
|
|
152
|
+
o.preventDefault(), e.toggleMute();
|
|
153
|
+
break;
|
|
154
|
+
case ">":
|
|
155
|
+
case ".":
|
|
156
|
+
o.preventDefault(), e.setPlaybackRate(Math.min(4, +(e.playbackRate + 0.25).toFixed(2)));
|
|
157
|
+
break;
|
|
158
|
+
case "<":
|
|
159
|
+
case ",":
|
|
160
|
+
o.preventDefault(), e.setPlaybackRate(Math.max(0.25, +(e.playbackRate - 0.25).toFixed(2)));
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
[f, e]
|
|
165
|
+
);
|
|
166
|
+
return /* @__PURE__ */ a.createElement(
|
|
167
|
+
de,
|
|
168
|
+
{
|
|
169
|
+
value: {
|
|
170
|
+
...e,
|
|
171
|
+
getStyles: m,
|
|
172
|
+
scrubSound: L
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
/* @__PURE__ */ a.createElement(
|
|
176
|
+
se,
|
|
177
|
+
{
|
|
178
|
+
...m("root"),
|
|
179
|
+
...Q,
|
|
180
|
+
ref: u,
|
|
181
|
+
mod: [
|
|
182
|
+
{
|
|
183
|
+
variant: z,
|
|
184
|
+
size: _,
|
|
185
|
+
playing: e.playing,
|
|
186
|
+
paused: e.paused && !e.ended,
|
|
187
|
+
ended: e.ended,
|
|
188
|
+
"as-background": n
|
|
189
|
+
},
|
|
190
|
+
H
|
|
191
|
+
],
|
|
192
|
+
tabIndex: f ? 0 : void 0,
|
|
193
|
+
onKeyDown: oe
|
|
194
|
+
},
|
|
195
|
+
/* @__PURE__ */ a.createElement(
|
|
196
|
+
"audio",
|
|
197
|
+
{
|
|
198
|
+
...m("audio"),
|
|
199
|
+
ref: e.audioRef,
|
|
200
|
+
src: ee,
|
|
201
|
+
autoPlay: y,
|
|
202
|
+
muted: g,
|
|
203
|
+
loop: k,
|
|
204
|
+
preload: B,
|
|
205
|
+
crossOrigin: b === "" ? void 0 : b
|
|
206
|
+
},
|
|
207
|
+
h && t.map((o, p) => /* @__PURE__ */ a.createElement("source", { key: `${o.src}-${p}`, src: o.src, type: o.type, media: o.media }))
|
|
208
|
+
),
|
|
209
|
+
n && I && /* @__PURE__ */ a.createElement(R, { ...m("backgroundMuteButton") }),
|
|
210
|
+
U ?? (Y && /* @__PURE__ */ a.createElement(w, null))
|
|
211
|
+
)
|
|
212
|
+
);
|
|
213
|
+
});
|
|
214
|
+
r.classes = E;
|
|
215
|
+
r.displayName = "Audio";
|
|
216
|
+
r.Controls = w;
|
|
217
|
+
r.PlayButton = me;
|
|
218
|
+
r.Timeline = ke;
|
|
219
|
+
r.TimeDisplay = ge;
|
|
220
|
+
r.MuteButton = R;
|
|
221
|
+
r.SkipButton = pe;
|
|
222
|
+
r.VolumeSlider = be;
|
|
223
|
+
r.SpeedControl = ye;
|
|
224
|
+
r.Waveform = ve;
|
|
225
|
+
r.Spectrum = fe;
|
|
226
|
+
export {
|
|
227
|
+
r as Audio
|
|
228
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var e = { root: "me_5069d899", backgroundMuteButton: "me_f4a0c830", audio: "me_bbe43aff", controls: "me_c878eaed", controlBar: "me_8de937ed", playButton: "me_a956d9fd", timeline: "me_6e7c7878", timelineBuffered: "me_6fba7577", timeDisplay: "me_231ae99e", volumeSlider: "me_b5a1c152", speedControl: "me_c3931fcd", waveform: "me_e471f74", waveformCanvas: "me_4e6619ec", waveformHover: "me_76714228", spectrum: "me_6b27bc08", spectrumCanvas: "me_647bf780" };
|
|
2
|
+
export {
|
|
3
|
+
e as default
|
|
4
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Box as o } from "@mantine/core";
|
|
2
|
+
import e, { forwardRef as n } from "react";
|
|
3
|
+
import { useAudioContext as i } from "../Audio.context.js";
|
|
4
|
+
import { AudioMuteButton as u } from "./AudioMuteButton.js";
|
|
5
|
+
import { AudioPlayButton as a } from "./AudioPlayButton.js";
|
|
6
|
+
import { AudioSpeedControl as c } from "./AudioSpeedControl.js";
|
|
7
|
+
import { AudioTimeDisplay as d } from "./AudioTimeDisplay.js";
|
|
8
|
+
import { AudioTimeline as p } from "./AudioTimeline.js";
|
|
9
|
+
import { AudioVolumeSlider as f } from "./AudioVolumeSlider.js";
|
|
10
|
+
const s = n(
|
|
11
|
+
({ children: r, ...l }, m) => {
|
|
12
|
+
const t = i();
|
|
13
|
+
return /* @__PURE__ */ e.createElement(o, { ref: m, ...t.getStyles("controls"), ...l }, /* @__PURE__ */ e.createElement(o, { ...t.getStyles("controlBar") }, r ?? /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(a, null), /* @__PURE__ */ e.createElement(p, null), /* @__PURE__ */ e.createElement(d, null), /* @__PURE__ */ e.createElement(u, null), /* @__PURE__ */ e.createElement(f, null), /* @__PURE__ */ e.createElement(c, null))));
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
s.displayName = "AudioControls";
|
|
17
|
+
export {
|
|
18
|
+
s as AudioControls
|
|
19
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Tooltip as c, ActionIcon as m } from "@mantine/core";
|
|
2
|
+
import { IconVolume3 as s, IconVolume2 as d, IconVolume as p } from "@tabler/icons-react";
|
|
3
|
+
import o, { forwardRef as f } from "react";
|
|
4
|
+
import { useAudioContext as h } from "../Audio.context.js";
|
|
5
|
+
const v = f(
|
|
6
|
+
({ muteLabel: a = "Mute", unmuteLabel: u = "Unmute", ...r }, n) => {
|
|
7
|
+
const t = h(), e = t.muted || t.volume === 0, i = e ? u : a, l = e ? s : t.volume < 0.5 ? d : p;
|
|
8
|
+
return /* @__PURE__ */ o.createElement(c, { label: i, withArrow: !0, openDelay: 400 }, /* @__PURE__ */ o.createElement(
|
|
9
|
+
m,
|
|
10
|
+
{
|
|
11
|
+
ref: n,
|
|
12
|
+
variant: "subtle",
|
|
13
|
+
color: "gray",
|
|
14
|
+
"aria-label": i,
|
|
15
|
+
"aria-pressed": e,
|
|
16
|
+
onClick: t.toggleMute,
|
|
17
|
+
"data-state": e ? "muted" : "unmuted",
|
|
18
|
+
...t.getStyles("muteButton", {
|
|
19
|
+
style: { width: "var(--audio-action-size)", height: "var(--audio-action-size)" }
|
|
20
|
+
}),
|
|
21
|
+
...r
|
|
22
|
+
},
|
|
23
|
+
/* @__PURE__ */ o.createElement(l, { style: { width: "var(--audio-icon-size)", height: "var(--audio-icon-size)" } })
|
|
24
|
+
));
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
v.displayName = "AudioMuteButton";
|
|
28
|
+
export {
|
|
29
|
+
v as AudioMuteButton
|
|
30
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Tooltip as n, ActionIcon as d } from "@mantine/core";
|
|
2
|
+
import { IconPlayerPauseFilled as u, IconPlayerPlayFilled as c } from "@tabler/icons-react";
|
|
3
|
+
import a, { forwardRef as s } from "react";
|
|
4
|
+
import { useAudioContext as y } from "../Audio.context.js";
|
|
5
|
+
const p = s(
|
|
6
|
+
({ playLabel: i = "Play", pauseLabel: o = "Pause", ...l }, r) => {
|
|
7
|
+
const e = y(), t = e.playing ? o : i;
|
|
8
|
+
return /* @__PURE__ */ a.createElement(n, { label: t, withArrow: !0, openDelay: 400 }, /* @__PURE__ */ a.createElement(
|
|
9
|
+
d,
|
|
10
|
+
{
|
|
11
|
+
ref: r,
|
|
12
|
+
variant: "filled",
|
|
13
|
+
color: "var(--audio-color)",
|
|
14
|
+
radius: "xl",
|
|
15
|
+
"aria-label": t,
|
|
16
|
+
onClick: e.toggle,
|
|
17
|
+
"data-state": e.playing ? "playing" : "paused",
|
|
18
|
+
...e.getStyles("playButton", {
|
|
19
|
+
style: { width: "var(--audio-play-size)", height: "var(--audio-play-size)" }
|
|
20
|
+
}),
|
|
21
|
+
...l
|
|
22
|
+
},
|
|
23
|
+
e.playing ? /* @__PURE__ */ a.createElement(
|
|
24
|
+
u,
|
|
25
|
+
{
|
|
26
|
+
style: { width: "var(--audio-icon-size)", height: "var(--audio-icon-size)" }
|
|
27
|
+
}
|
|
28
|
+
) : /* @__PURE__ */ a.createElement(
|
|
29
|
+
c,
|
|
30
|
+
{
|
|
31
|
+
style: { width: "var(--audio-icon-size)", height: "var(--audio-icon-size)" }
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
));
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
p.displayName = "AudioPlayButton";
|
|
38
|
+
export {
|
|
39
|
+
p as AudioPlayButton
|
|
40
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Tooltip as m, ActionIcon as u } from "@mantine/core";
|
|
2
|
+
import { IconRewindForward30 as y, IconRewindForward15 as p, IconRewindForward10 as h, IconRewindBackward30 as k, IconRewindBackward15 as f, IconRewindBackward10 as B } from "@tabler/icons-react";
|
|
3
|
+
import e, { forwardRef as E } from "react";
|
|
4
|
+
import { useAudioContext as I } from "../Audio.context.js";
|
|
5
|
+
const R = E(
|
|
6
|
+
({ seconds: o = 10, icon: c, label: l, ...d }, s) => {
|
|
7
|
+
const r = I(), i = o >= 0, n = l ?? `${i ? "Forward" : "Back"} ${Math.abs(o)}s`, a = Math.abs(o), t = { width: "var(--audio-icon-size)", height: "var(--audio-icon-size)" }, w = c ?? (i ? a >= 30 ? /* @__PURE__ */ e.createElement(y, { style: t }) : a >= 15 ? /* @__PURE__ */ e.createElement(p, { style: t }) : /* @__PURE__ */ e.createElement(h, { style: t }) : a >= 30 ? /* @__PURE__ */ e.createElement(k, { style: t }) : a >= 15 ? /* @__PURE__ */ e.createElement(f, { style: t }) : /* @__PURE__ */ e.createElement(B, { style: t }));
|
|
8
|
+
return /* @__PURE__ */ e.createElement(m, { label: n, withArrow: !0, openDelay: 400 }, /* @__PURE__ */ e.createElement(
|
|
9
|
+
u,
|
|
10
|
+
{
|
|
11
|
+
ref: s,
|
|
12
|
+
variant: "subtle",
|
|
13
|
+
color: "gray",
|
|
14
|
+
"aria-label": n,
|
|
15
|
+
onClick: () => r.seekBy(o),
|
|
16
|
+
...r.getStyles("skipButton", {
|
|
17
|
+
style: { width: "var(--audio-action-size)", height: "var(--audio-action-size)" }
|
|
18
|
+
}),
|
|
19
|
+
...d
|
|
20
|
+
},
|
|
21
|
+
w
|
|
22
|
+
));
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
R.displayName = "AudioSkipButton";
|
|
26
|
+
export {
|
|
27
|
+
R as AudioSkipButton
|
|
28
|
+
};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { useMantineTheme as G, getThemeColor as I, Box as J, getRadius as K } from "@mantine/core";
|
|
2
|
+
import $, { forwardRef as Q, useRef as F, useState as X, useEffect as D } from "react";
|
|
3
|
+
import { useAudioContext as tt } from "../Audio.context.js";
|
|
4
|
+
function N(e) {
|
|
5
|
+
if (!e)
|
|
6
|
+
return "transparent";
|
|
7
|
+
if (e.startsWith("#") || e.startsWith("rgb") || e.startsWith("hsl") || e === "transparent" || typeof document > "u")
|
|
8
|
+
return e;
|
|
9
|
+
const o = document.createElement("div");
|
|
10
|
+
o.style.color = e, document.body.appendChild(o);
|
|
11
|
+
const S = getComputedStyle(o).color;
|
|
12
|
+
return o.remove(), S || e;
|
|
13
|
+
}
|
|
14
|
+
const et = Q(
|
|
15
|
+
({
|
|
16
|
+
height: e = 64,
|
|
17
|
+
barCount: o = 32,
|
|
18
|
+
barGap: S = 2,
|
|
19
|
+
barRadius: B = 2,
|
|
20
|
+
radius: H,
|
|
21
|
+
color: j,
|
|
22
|
+
smoothing: x = 0.6,
|
|
23
|
+
colorMode: M = "solid",
|
|
24
|
+
mirror: z = !1,
|
|
25
|
+
...U
|
|
26
|
+
}, w) => {
|
|
27
|
+
const Z = G(), L = j ? I(j, Z) : null, p = tt(), O = F(null), T = F(null), [y, V] = X(0), l = F(null), h = F(null);
|
|
28
|
+
return D(() => {
|
|
29
|
+
const r = T.current;
|
|
30
|
+
if (!r || typeof ResizeObserver > "u")
|
|
31
|
+
return;
|
|
32
|
+
const g = new ResizeObserver((R) => {
|
|
33
|
+
for (const s of R)
|
|
34
|
+
V(s.contentRect.width);
|
|
35
|
+
});
|
|
36
|
+
return g.observe(r), V(r.getBoundingClientRect().width), () => g.disconnect();
|
|
37
|
+
}, []), D(() => {
|
|
38
|
+
const r = O.current, g = p.analyser;
|
|
39
|
+
if (!r || !g || y <= 0) {
|
|
40
|
+
l.current !== null && (cancelAnimationFrame(l.current), l.current = null);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const R = window.devicePixelRatio || 1;
|
|
44
|
+
r.width = y * R, r.height = e * R, r.style.width = `${y}px`, r.style.height = `${e}px`;
|
|
45
|
+
const s = r.getContext("2d");
|
|
46
|
+
if (!s)
|
|
47
|
+
return;
|
|
48
|
+
s.scale(R, R);
|
|
49
|
+
const b = g.frequencyBinCount, Y = new Uint8Array(b);
|
|
50
|
+
(!h.current || h.current.length !== o) && (h.current = new Float32Array(o));
|
|
51
|
+
const v = Math.max(1, (y - S * (o - 1)) / o), q = (a) => getComputedStyle(r).getPropertyValue(a).trim(), W = () => {
|
|
52
|
+
if (!p.playing) {
|
|
53
|
+
const t = h.current;
|
|
54
|
+
if (t) {
|
|
55
|
+
let c = !0;
|
|
56
|
+
for (let n = 0; n < t.length; n += 1)
|
|
57
|
+
t[n] *= x * 0.9, t[n] > 5e-3 ? c = !1 : t[n] = 0;
|
|
58
|
+
if (_(), c) {
|
|
59
|
+
l.current = null;
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
l.current = requestAnimationFrame(W);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
l.current = null;
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
g.getByteFrequencyData(Y);
|
|
69
|
+
const a = h.current;
|
|
70
|
+
for (let t = 0; t < o; t += 1) {
|
|
71
|
+
const c = Math.floor(t * b / o), n = Math.floor((t + 1) * b / o), f = Math.max(1, n - c);
|
|
72
|
+
let i = 0;
|
|
73
|
+
for (let u = c; u < n; u += 1)
|
|
74
|
+
i += Y[u] ?? 0;
|
|
75
|
+
const d = i / f / 255;
|
|
76
|
+
a[t] = a[t] * x + d * (1 - x);
|
|
77
|
+
}
|
|
78
|
+
_(), l.current = requestAnimationFrame(W);
|
|
79
|
+
}, E = (a, t, c, n, f) => {
|
|
80
|
+
s.fillStyle = f, B > 0 && typeof s.roundRect == "function" ? (s.beginPath(), s.roundRect(a, t, c, n, Math.min(B, c / 2, n / 2)), s.fill()) : s.fillRect(a, t, c, n);
|
|
81
|
+
}, k = L || q("--audio-spectrum-bar-color") || q("--audio-color") || "#228be6", A = N(k), P = N(q("--audio-spectrum-bar-color-fade") || "transparent"), _ = () => {
|
|
82
|
+
s.clearRect(0, 0, y, e);
|
|
83
|
+
const a = h.current, t = e / 2;
|
|
84
|
+
for (let c = 0; c < o; c += 1) {
|
|
85
|
+
const n = a[c] ?? 0, f = c * (v + S);
|
|
86
|
+
if (z) {
|
|
87
|
+
const i = Math.max(1, n * t), d = t - i, u = t;
|
|
88
|
+
let m = A;
|
|
89
|
+
if (M === "gradient") {
|
|
90
|
+
const C = s.createLinearGradient(0, d, 0, t + i);
|
|
91
|
+
C.addColorStop(0, P), C.addColorStop(0.5, A), C.addColorStop(1, P), m = C;
|
|
92
|
+
}
|
|
93
|
+
E(f, d, v, i, m), E(f, u, v, i, m);
|
|
94
|
+
} else {
|
|
95
|
+
const i = Math.max(2, n * e), d = e - i;
|
|
96
|
+
let u = A;
|
|
97
|
+
if (M === "gradient") {
|
|
98
|
+
const m = s.createLinearGradient(0, d, 0, e);
|
|
99
|
+
m.addColorStop(0, A), m.addColorStop(1, P), u = m;
|
|
100
|
+
}
|
|
101
|
+
E(f, d, v, i, u);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
return l.current === null && (l.current = requestAnimationFrame(W)), () => {
|
|
106
|
+
l.current !== null && (cancelAnimationFrame(l.current), l.current = null);
|
|
107
|
+
};
|
|
108
|
+
}, [
|
|
109
|
+
p.analyser,
|
|
110
|
+
p.playing,
|
|
111
|
+
y,
|
|
112
|
+
e,
|
|
113
|
+
o,
|
|
114
|
+
S,
|
|
115
|
+
B,
|
|
116
|
+
x,
|
|
117
|
+
M,
|
|
118
|
+
z,
|
|
119
|
+
L
|
|
120
|
+
]), /* @__PURE__ */ $.createElement(
|
|
121
|
+
J,
|
|
122
|
+
{
|
|
123
|
+
ref: (r) => {
|
|
124
|
+
T.current = r, typeof w == "function" ? w(r) : w && typeof w == "object" && (w.current = r);
|
|
125
|
+
},
|
|
126
|
+
...p.getStyles("spectrum"),
|
|
127
|
+
style: { height: e, borderRadius: H === void 0 ? void 0 : K(H) },
|
|
128
|
+
...U
|
|
129
|
+
},
|
|
130
|
+
/* @__PURE__ */ $.createElement("canvas", { ref: O, ...p.getStyles("spectrumCanvas") })
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
et.displayName = "AudioSpectrum";
|
|
135
|
+
export {
|
|
136
|
+
et as AudioSpectrum
|
|
137
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Menu as o, UnstyledButton as m } from "@mantine/core";
|
|
2
|
+
import a, { forwardRef as d } from "react";
|
|
3
|
+
import { useAudioContext as p } from "../Audio.context.js";
|
|
4
|
+
const i = [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2], u = d(
|
|
5
|
+
({ speeds: r = i, menuProps: n }, c) => {
|
|
6
|
+
const t = p(), l = t.playbackRate === 1 ? "1×" : `${t.playbackRate}×`;
|
|
7
|
+
return /* @__PURE__ */ a.createElement(o, { shadow: "md", width: 120, position: "top", ...n }, /* @__PURE__ */ a.createElement(o.Target, null, /* @__PURE__ */ a.createElement(
|
|
8
|
+
m,
|
|
9
|
+
{
|
|
10
|
+
ref: c,
|
|
11
|
+
"aria-label": `Playback speed (${l})`,
|
|
12
|
+
"data-state": t.playbackRate === 1 ? "normal" : "custom",
|
|
13
|
+
...t.getStyles("speedControl")
|
|
14
|
+
},
|
|
15
|
+
l
|
|
16
|
+
)), /* @__PURE__ */ a.createElement(o.Dropdown, null, /* @__PURE__ */ a.createElement(o.Label, null, "Playback speed"), r.map((e) => /* @__PURE__ */ a.createElement(
|
|
17
|
+
o.Item,
|
|
18
|
+
{
|
|
19
|
+
key: e,
|
|
20
|
+
onClick: () => t.setPlaybackRate(e),
|
|
21
|
+
"data-active": e === t.playbackRate,
|
|
22
|
+
fw: e === t.playbackRate ? 600 : 400
|
|
23
|
+
},
|
|
24
|
+
e === 1 ? "Normal" : `${e}×`
|
|
25
|
+
))));
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
u.displayName = "AudioSpeedControl";
|
|
29
|
+
export {
|
|
30
|
+
u as AudioSpeedControl
|
|
31
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Text as s } from "@mantine/core";
|
|
2
|
+
import c, { forwardRef as u } from "react";
|
|
3
|
+
import { useAudioContext as f } from "../Audio.context.js";
|
|
4
|
+
const l = u(
|
|
5
|
+
({ format: e = "current/duration", ...t }, r) => {
|
|
6
|
+
const o = f(), n = p(e, o.currentTime, o.duration);
|
|
7
|
+
return /* @__PURE__ */ c.createElement(
|
|
8
|
+
s,
|
|
9
|
+
{
|
|
10
|
+
ref: r,
|
|
11
|
+
size: "sm",
|
|
12
|
+
ff: "monospace",
|
|
13
|
+
ta: "center",
|
|
14
|
+
...o.getStyles("timeDisplay"),
|
|
15
|
+
...t
|
|
16
|
+
},
|
|
17
|
+
n
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
l.displayName = "AudioTimeDisplay";
|
|
22
|
+
function a(e) {
|
|
23
|
+
if (!Number.isFinite(e) || e < 0)
|
|
24
|
+
return "0:00";
|
|
25
|
+
const t = Math.floor(e), r = Math.floor(t / 3600), o = Math.floor(t % 3600 / 60), n = t % 60, i = r > 0 ? String(o).padStart(2, "0") : String(o), m = String(n).padStart(2, "0");
|
|
26
|
+
return r > 0 ? `${r}:${i}:${m}` : `${i}:${m}`;
|
|
27
|
+
}
|
|
28
|
+
function p(e, t, r) {
|
|
29
|
+
switch (e) {
|
|
30
|
+
case "current":
|
|
31
|
+
return a(t);
|
|
32
|
+
case "duration":
|
|
33
|
+
return a(r);
|
|
34
|
+
case "remaining":
|
|
35
|
+
return a(Math.max(r - t, 0));
|
|
36
|
+
case "current/-remaining":
|
|
37
|
+
return `${a(t)} / -${a(Math.max(r - t, 0))}`;
|
|
38
|
+
default:
|
|
39
|
+
return `${a(t)} / ${a(r)}`;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
l as AudioTimeDisplay
|
|
44
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Box as p, Slider as v } from "@mantine/core";
|
|
2
|
+
import b, { forwardRef as R, useState as w, useRef as f, useEffect as A, useCallback as S } from "react";
|
|
3
|
+
import { useAudioContext as E } from "../Audio.context.js";
|
|
4
|
+
const $ = R(
|
|
5
|
+
({ sliderProps: u, liveScrub: n = !0, scrubSound: l, ...o }, m) => {
|
|
6
|
+
const e = E(), t = l ?? e.scrubSound, [y, h] = w(null), d = f(!1), c = f(!1), r = f(null), a = f(null), s = Number.isFinite(e.duration) && e.duration > 0 ? e.duration : 0, g = y ?? e.currentTime, C = s > 0 ? e.buffered / s * 100 : 0;
|
|
7
|
+
A(
|
|
8
|
+
() => () => {
|
|
9
|
+
r.current !== null && cancelAnimationFrame(r.current);
|
|
10
|
+
},
|
|
11
|
+
[]
|
|
12
|
+
);
|
|
13
|
+
const x = S(
|
|
14
|
+
(i) => {
|
|
15
|
+
d.current || (d.current = !0, c.current = e.playing, n && (t && !e.playing ? e.play() : !t && e.playing && e.pause())), h(i), n && (a.current = i, r.current === null && (r.current = requestAnimationFrame(() => {
|
|
16
|
+
r.current = null, a.current !== null && (e.seek(a.current), a.current = null);
|
|
17
|
+
})));
|
|
18
|
+
},
|
|
19
|
+
[e, n, t]
|
|
20
|
+
), k = S(
|
|
21
|
+
(i) => {
|
|
22
|
+
r.current !== null && (cancelAnimationFrame(r.current), r.current = null), a.current = null, e.seek(i), h(null), d.current = !1, t && !c.current ? e.pause() : !t && c.current && e.play(), c.current = !1;
|
|
23
|
+
},
|
|
24
|
+
[e, t]
|
|
25
|
+
);
|
|
26
|
+
return /* @__PURE__ */ b.createElement(p, { ref: m, ...e.getStyles("timeline"), ...o }, /* @__PURE__ */ b.createElement(
|
|
27
|
+
p,
|
|
28
|
+
{
|
|
29
|
+
...e.getStyles("timelineBuffered"),
|
|
30
|
+
style: { width: `${C}%` },
|
|
31
|
+
"aria-hidden": !0
|
|
32
|
+
}
|
|
33
|
+
), /* @__PURE__ */ b.createElement(
|
|
34
|
+
v,
|
|
35
|
+
{
|
|
36
|
+
value: Math.min(g, s || g),
|
|
37
|
+
onChange: x,
|
|
38
|
+
onChangeEnd: k,
|
|
39
|
+
min: 0,
|
|
40
|
+
max: s || 1e-4,
|
|
41
|
+
step: 0.01,
|
|
42
|
+
label: (i) => F(i),
|
|
43
|
+
showLabelOnHover: !0,
|
|
44
|
+
color: "var(--audio-timeline-color)",
|
|
45
|
+
size: "xs",
|
|
46
|
+
"aria-label": "Seek",
|
|
47
|
+
styles: {
|
|
48
|
+
root: { flex: 1, width: "100%" },
|
|
49
|
+
bar: { backgroundColor: "var(--audio-timeline-color)" },
|
|
50
|
+
thumb: {
|
|
51
|
+
backgroundColor: "var(--audio-timeline-thumb-color)",
|
|
52
|
+
borderColor: "var(--audio-timeline-thumb-color)",
|
|
53
|
+
width: "var(--audio-timeline-thumb-size)",
|
|
54
|
+
height: "var(--audio-timeline-thumb-size)"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
...u
|
|
58
|
+
}
|
|
59
|
+
));
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
$.displayName = "AudioTimeline";
|
|
63
|
+
function F(u) {
|
|
64
|
+
if (!Number.isFinite(u) || u < 0)
|
|
65
|
+
return "0:00";
|
|
66
|
+
const n = Math.floor(u), l = Math.floor(n / 3600), o = Math.floor(n % 3600 / 60), m = n % 60, e = l > 0 ? String(o).padStart(2, "0") : String(o), t = String(m).padStart(2, "0");
|
|
67
|
+
return l > 0 ? `${l}:${e}:${t}` : `${e}:${t}`;
|
|
68
|
+
}
|
|
69
|
+
export {
|
|
70
|
+
$ as AudioTimeline
|
|
71
|
+
};
|