@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,43 @@
|
|
|
1
|
+
import { Slider as i } from "@mantine/core";
|
|
2
|
+
import u, { forwardRef as d, useCallback as m } from "react";
|
|
3
|
+
import { useAudioContext as n } from "../Audio.context.js";
|
|
4
|
+
const s = d(
|
|
5
|
+
({ ...r }, a) => {
|
|
6
|
+
const e = n(), l = e.muted ? 0 : Math.round(e.volume * 100), t = m(
|
|
7
|
+
(o) => {
|
|
8
|
+
e.setVolume(o / 100);
|
|
9
|
+
},
|
|
10
|
+
[e]
|
|
11
|
+
);
|
|
12
|
+
return /* @__PURE__ */ u.createElement(
|
|
13
|
+
i,
|
|
14
|
+
{
|
|
15
|
+
ref: a,
|
|
16
|
+
value: l,
|
|
17
|
+
onChange: t,
|
|
18
|
+
min: 0,
|
|
19
|
+
max: 100,
|
|
20
|
+
step: 1,
|
|
21
|
+
label: (o) => `${o}%`,
|
|
22
|
+
showLabelOnHover: !0,
|
|
23
|
+
size: "xs",
|
|
24
|
+
"aria-label": "Volume",
|
|
25
|
+
styles: {
|
|
26
|
+
bar: { backgroundColor: "var(--audio-color)" },
|
|
27
|
+
thumb: {
|
|
28
|
+
backgroundColor: "var(--audio-color)",
|
|
29
|
+
borderColor: "var(--audio-color)",
|
|
30
|
+
width: "var(--audio-timeline-thumb-size)",
|
|
31
|
+
height: "var(--audio-timeline-thumb-size)"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
...e.getStyles("volumeSlider"),
|
|
35
|
+
...r
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
s.displayName = "AudioVolumeSlider";
|
|
41
|
+
export {
|
|
42
|
+
s as AudioVolumeSlider
|
|
43
|
+
};
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { useMantineTheme as ut, getThemeColor as ft, Box as K, getRadius as dt } from "@mantine/core";
|
|
2
|
+
import H, { forwardRef as mt, useRef as R, useState as Q, useEffect as $, useCallback as Y } from "react";
|
|
3
|
+
import { useAudioContext as pt } from "../Audio.context.js";
|
|
4
|
+
function Z(r) {
|
|
5
|
+
if (!r)
|
|
6
|
+
return "transparent";
|
|
7
|
+
if (r.startsWith("#") || r.startsWith("rgb") || r.startsWith("hsl") || r === "transparent" || typeof document > "u")
|
|
8
|
+
return r;
|
|
9
|
+
const i = document.createElement("div");
|
|
10
|
+
i.style.color = r, document.body.appendChild(i);
|
|
11
|
+
const d = getComputedStyle(i).color;
|
|
12
|
+
return i.remove(), d || r;
|
|
13
|
+
}
|
|
14
|
+
const ht = mt(
|
|
15
|
+
({
|
|
16
|
+
height: r = 64,
|
|
17
|
+
barGap: i = 2,
|
|
18
|
+
barWidth: d,
|
|
19
|
+
barRadius: A = 1,
|
|
20
|
+
radius: z,
|
|
21
|
+
color: L,
|
|
22
|
+
mirror: F = !0,
|
|
23
|
+
mirrorGap: O = 0,
|
|
24
|
+
interactive: v = !0,
|
|
25
|
+
scrubSound: G,
|
|
26
|
+
...tt
|
|
27
|
+
}, x) => {
|
|
28
|
+
const et = ut(), U = L ? ft(L, et) : null, e = pt(), C = G ?? e.scrubSound, V = R(null), B = R(null), [u, X] = Q(0), [_, j] = Q(null), M = R(!1), m = R(!1), k = R(null), p = R(() => {
|
|
29
|
+
}), S = e.audioRef;
|
|
30
|
+
$(() => {
|
|
31
|
+
const t = B.current;
|
|
32
|
+
if (!t || typeof ResizeObserver > "u")
|
|
33
|
+
return;
|
|
34
|
+
const n = new ResizeObserver((c) => {
|
|
35
|
+
for (const o of c)
|
|
36
|
+
X(o.contentRect.width);
|
|
37
|
+
});
|
|
38
|
+
return n.observe(t), X(t.getBoundingClientRect().width), () => n.disconnect();
|
|
39
|
+
}, []), $(() => {
|
|
40
|
+
const t = V.current;
|
|
41
|
+
if (!t) {
|
|
42
|
+
p.current = () => {
|
|
43
|
+
};
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const n = e.peaks;
|
|
47
|
+
if (!n || n.length === 0 || u <= 0) {
|
|
48
|
+
const s = window.devicePixelRatio || 1;
|
|
49
|
+
t.width = u * s, t.height = r * s, t.getContext("2d")?.clearRect(0, 0, t.width, t.height), p.current = () => {
|
|
50
|
+
};
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const c = window.devicePixelRatio || 1;
|
|
54
|
+
t.width = u * c, t.height = r * c, t.style.width = `${u}px`, t.style.height = `${r}px`;
|
|
55
|
+
const o = t.getContext("2d");
|
|
56
|
+
if (!o) {
|
|
57
|
+
p.current = () => {
|
|
58
|
+
};
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
o.scale(c, c);
|
|
62
|
+
const P = !d || d <= 0, rt = P ? 2 : d, ot = Math.max(1, Math.floor((u + i) / (rt + i))), h = Math.min(n.length, ot), E = P ? Math.max(1, (u - i * (h - 1)) / h) : d, D = n.length / h, ct = U || getComputedStyle(t).getPropertyValue("--audio-waveform-played-color").trim() || "#228be6", st = getComputedStyle(t).getPropertyValue("--audio-waveform-color").trim() || "rgba(120, 120, 120, 0.4)", at = Z(ct), it = Z(st), N = new Float32Array(h);
|
|
63
|
+
for (let s = 0; s < h; s += 1) {
|
|
64
|
+
const y = Math.floor(s * D), g = Math.floor((s + 1) * D);
|
|
65
|
+
let a = 0;
|
|
66
|
+
for (let l = y; l < g; l += 1) {
|
|
67
|
+
const f = n[l] ?? 0;
|
|
68
|
+
f > a && (a = f);
|
|
69
|
+
}
|
|
70
|
+
N[s] = a;
|
|
71
|
+
}
|
|
72
|
+
const b = (s, y, g, a, l) => {
|
|
73
|
+
o.fillStyle = l, A > 0 && typeof o.roundRect == "function" ? (o.beginPath(), o.roundRect(s, y, g, a, Math.min(A, g / 2, Math.max(0, a / 2))), o.fill()) : o.fillRect(s, y, g, a);
|
|
74
|
+
};
|
|
75
|
+
p.current = (s) => {
|
|
76
|
+
o.clearRect(0, 0, u, r);
|
|
77
|
+
const y = s * h, g = Math.floor(y), a = r / 2, l = F ? O / 2 : 0;
|
|
78
|
+
for (let f = 0; f < h; f += 1) {
|
|
79
|
+
const J = N[f], W = f * (E + i), q = f < g ? at : it;
|
|
80
|
+
if (F) {
|
|
81
|
+
const w = Math.max(1, J * (a - l));
|
|
82
|
+
b(W, a - l - w, E, w, q), b(W, a + l, E, w, q);
|
|
83
|
+
} else {
|
|
84
|
+
const w = Math.max(2, J * r);
|
|
85
|
+
b(W, r - w, E, w, q);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
const I = e.duration, lt = I > 0 ? (S.current?.currentTime ?? 0) / I : 0;
|
|
90
|
+
p.current(Math.max(0, Math.min(1, lt)));
|
|
91
|
+
}, [e.peaks, u, r, i, d, A, F, O, U]), $(() => {
|
|
92
|
+
const t = () => {
|
|
93
|
+
const n = S.current, c = n?.duration ?? 0, o = n?.currentTime ?? 0, P = c > 0 ? Math.max(0, Math.min(1, o / c)) : 0;
|
|
94
|
+
p.current(P), k.current = requestAnimationFrame(t);
|
|
95
|
+
};
|
|
96
|
+
if (e.playing)
|
|
97
|
+
k.current = requestAnimationFrame(t);
|
|
98
|
+
else {
|
|
99
|
+
const n = e.duration, c = S.current?.currentTime ?? 0, o = n > 0 ? Math.max(0, Math.min(1, c / n)) : 0;
|
|
100
|
+
p.current(o);
|
|
101
|
+
}
|
|
102
|
+
return () => {
|
|
103
|
+
k.current !== null && (cancelAnimationFrame(k.current), k.current = null);
|
|
104
|
+
};
|
|
105
|
+
}, [e.playing, e.duration, e.currentTime, S]);
|
|
106
|
+
const T = Y(
|
|
107
|
+
(t) => {
|
|
108
|
+
const n = B.current;
|
|
109
|
+
if (!n || e.duration <= 0)
|
|
110
|
+
return;
|
|
111
|
+
const c = n.getBoundingClientRect(), o = Math.max(0, Math.min(1, (t.clientX - c.left) / c.width));
|
|
112
|
+
e.seek(o * e.duration);
|
|
113
|
+
},
|
|
114
|
+
[e]
|
|
115
|
+
), nt = Y(
|
|
116
|
+
(t) => {
|
|
117
|
+
const n = B.current;
|
|
118
|
+
if (!n)
|
|
119
|
+
return;
|
|
120
|
+
const c = n.getBoundingClientRect(), o = Math.max(0, Math.min(1, (t.clientX - c.left) / c.width));
|
|
121
|
+
j(o), M.current && v && T(t);
|
|
122
|
+
},
|
|
123
|
+
[v, T]
|
|
124
|
+
);
|
|
125
|
+
return /* @__PURE__ */ H.createElement(
|
|
126
|
+
K,
|
|
127
|
+
{
|
|
128
|
+
ref: (t) => {
|
|
129
|
+
B.current = t, typeof x == "function" ? x(t) : x && typeof x == "object" && (x.current = t);
|
|
130
|
+
},
|
|
131
|
+
...e.getStyles("waveform"),
|
|
132
|
+
style: {
|
|
133
|
+
height: r,
|
|
134
|
+
cursor: v ? "pointer" : "default",
|
|
135
|
+
borderRadius: z === void 0 ? void 0 : dt(z)
|
|
136
|
+
},
|
|
137
|
+
onMouseDown: (t) => {
|
|
138
|
+
v && (M.current = !0, m.current = e.playing, C ? e.playing || e.play() : e.playing && e.pause(), T(t));
|
|
139
|
+
},
|
|
140
|
+
onMouseUp: () => {
|
|
141
|
+
M.current && (M.current = !1, C && !m.current ? e.pause() : !C && m.current && e.play(), m.current = !1);
|
|
142
|
+
},
|
|
143
|
+
onMouseMove: nt,
|
|
144
|
+
onMouseLeave: () => {
|
|
145
|
+
M.current && (C && !m.current ? e.pause() : !C && m.current && e.play()), M.current = !1, m.current = !1, j(null);
|
|
146
|
+
},
|
|
147
|
+
"data-loading": e.peaksLoading || void 0,
|
|
148
|
+
"data-error": e.peaksError ? "true" : void 0,
|
|
149
|
+
...tt
|
|
150
|
+
},
|
|
151
|
+
/* @__PURE__ */ H.createElement("canvas", { ref: V, ...e.getStyles("waveformCanvas") }),
|
|
152
|
+
_ !== null && v && /* @__PURE__ */ H.createElement(
|
|
153
|
+
K,
|
|
154
|
+
{
|
|
155
|
+
...e.getStyles("waveformHover"),
|
|
156
|
+
style: { left: `${_ * 100}%` },
|
|
157
|
+
"aria-hidden": !0
|
|
158
|
+
}
|
|
159
|
+
)
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
ht.displayName = "AudioWaveform";
|
|
164
|
+
export {
|
|
165
|
+
ht as AudioWaveform
|
|
166
|
+
};
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { useRef as x, useState as a, useEffect as v, useCallback as i } from "react";
|
|
2
|
+
function me(n, r) {
|
|
3
|
+
const h = n.getChannelData(0), f = Math.floor(h.length / r), E = new Float32Array(r);
|
|
4
|
+
for (let m = 0; m < r; m += 1) {
|
|
5
|
+
const L = m * f;
|
|
6
|
+
let y = 0;
|
|
7
|
+
for (let g = 0; g < f; g += 1) {
|
|
8
|
+
const b = Math.abs(h[L + g] ?? 0);
|
|
9
|
+
b > y && (y = b);
|
|
10
|
+
}
|
|
11
|
+
E[m] = y;
|
|
12
|
+
}
|
|
13
|
+
return E;
|
|
14
|
+
}
|
|
15
|
+
function ye(n = {}) {
|
|
16
|
+
const r = x(null), [h, f] = a(!1), [E, m] = a(0), [L, y] = a(0), [g, b] = a(0), [j, R] = a(n.volume ?? 1), [H, S] = a(n.muted ?? !1), [U, T] = a(n.playbackRate ?? 1), [$, P] = a(!1), [q, p] = a(!1), [J, K] = a(null), [O, A] = a(!1), [Q, M] = a(null), [X, w] = a(!1), [Y, D] = a(null), [Z, _] = a(null), [ee, te] = a(null), [C, ne] = a(null), s = x(n);
|
|
17
|
+
s.current = n;
|
|
18
|
+
const d = x(null);
|
|
19
|
+
v(() => {
|
|
20
|
+
const e = r.current;
|
|
21
|
+
if (!e)
|
|
22
|
+
return;
|
|
23
|
+
const t = () => {
|
|
24
|
+
f(!0), P(!1), s.current.onPlayChange?.(!0);
|
|
25
|
+
}, c = () => {
|
|
26
|
+
f(!1), s.current.onPlayChange?.(!1);
|
|
27
|
+
}, l = () => {
|
|
28
|
+
P(!0), f(!1), s.current.onEnded?.();
|
|
29
|
+
}, o = () => {
|
|
30
|
+
m(e.currentTime), s.current.onCurrentTimeChange?.(e.currentTime);
|
|
31
|
+
}, u = () => {
|
|
32
|
+
const G = e.duration || 0;
|
|
33
|
+
y(G), e.currentSrc && ne(e.currentSrc), s.current.onDurationChange?.(G);
|
|
34
|
+
}, F = () => {
|
|
35
|
+
R(e.volume), S(e.muted), s.current.onVolumeChange?.(e.volume);
|
|
36
|
+
}, N = () => {
|
|
37
|
+
T(e.playbackRate), s.current.onPlaybackRateChange?.(e.playbackRate);
|
|
38
|
+
}, V = () => p(!0), W = () => p(!1), z = () => {
|
|
39
|
+
A(!0), p(!1);
|
|
40
|
+
}, B = () => {
|
|
41
|
+
e.buffered.length > 0 && b(e.buffered.end(e.buffered.length - 1));
|
|
42
|
+
}, I = () => {
|
|
43
|
+
K(e.error), p(!1), s.current.onError?.(e.error);
|
|
44
|
+
};
|
|
45
|
+
return e.addEventListener("play", t), e.addEventListener("pause", c), e.addEventListener("ended", l), e.addEventListener("timeupdate", o), e.addEventListener("durationchange", u), e.addEventListener("loadedmetadata", u), e.addEventListener("volumechange", F), e.addEventListener("ratechange", N), e.addEventListener("waiting", V), e.addEventListener("playing", W), e.addEventListener("canplay", z), e.addEventListener("progress", B), e.addEventListener("error", I), Number.isFinite(e.duration) && e.duration > 0 && y(e.duration), e.currentTime > 0 && m(e.currentTime), (e.volume !== 1 || e.muted) && (R(e.volume), S(e.muted)), e.playbackRate !== 1 && T(e.playbackRate), e.paused || f(!0), e.readyState >= 3 && A(!0), e.buffered.length > 0 && b(e.buffered.end(e.buffered.length - 1)), () => {
|
|
46
|
+
e.removeEventListener("play", t), e.removeEventListener("pause", c), e.removeEventListener("ended", l), e.removeEventListener("timeupdate", o), e.removeEventListener("durationchange", u), e.removeEventListener("loadedmetadata", u), e.removeEventListener("volumechange", F), e.removeEventListener("ratechange", N), e.removeEventListener("waiting", V), e.removeEventListener("playing", W), e.removeEventListener("canplay", z), e.removeEventListener("progress", B), e.removeEventListener("error", I);
|
|
47
|
+
};
|
|
48
|
+
}, []), v(() => {
|
|
49
|
+
if (n.playing === void 0)
|
|
50
|
+
return;
|
|
51
|
+
const e = r.current;
|
|
52
|
+
e && (n.playing && e.paused ? e.play().catch(() => {
|
|
53
|
+
}) : !n.playing && !e.paused && e.pause());
|
|
54
|
+
}, [n.playing]), v(() => {
|
|
55
|
+
if (n.currentTime === void 0)
|
|
56
|
+
return;
|
|
57
|
+
const e = r.current;
|
|
58
|
+
e && Math.abs(e.currentTime - n.currentTime) > 0.5 && (e.currentTime = n.currentTime);
|
|
59
|
+
}, [n.currentTime]), v(() => {
|
|
60
|
+
if (n.volume === void 0)
|
|
61
|
+
return;
|
|
62
|
+
const e = r.current;
|
|
63
|
+
e && Math.abs(e.volume - n.volume) > 0.01 && (e.volume = Math.max(0, Math.min(1, n.volume)));
|
|
64
|
+
}, [n.volume]), v(() => {
|
|
65
|
+
if (n.playbackRate === void 0)
|
|
66
|
+
return;
|
|
67
|
+
const e = r.current;
|
|
68
|
+
e && e.playbackRate !== n.playbackRate && (e.playbackRate = n.playbackRate);
|
|
69
|
+
}, [n.playbackRate]), v(() => {
|
|
70
|
+
if (n.disableWebAudio)
|
|
71
|
+
return;
|
|
72
|
+
const e = C || n.src;
|
|
73
|
+
if (!e || typeof window > "u")
|
|
74
|
+
return;
|
|
75
|
+
const t = window.AudioContext || window.webkitAudioContext;
|
|
76
|
+
if (!t)
|
|
77
|
+
return;
|
|
78
|
+
const c = n.waveformSamples ?? 512;
|
|
79
|
+
if (c <= 0)
|
|
80
|
+
return;
|
|
81
|
+
let l = !1;
|
|
82
|
+
M(null), D(null), w(!0);
|
|
83
|
+
const o = new t();
|
|
84
|
+
return fetch(e).then((u) => {
|
|
85
|
+
if (!u.ok)
|
|
86
|
+
throw new Error(`Failed to fetch audio: HTTP ${u.status}`);
|
|
87
|
+
return u.arrayBuffer();
|
|
88
|
+
}).then((u) => o.decodeAudioData(u.slice(0))).then((u) => {
|
|
89
|
+
l || (M(me(u, c)), w(!1));
|
|
90
|
+
}).catch((u) => {
|
|
91
|
+
l || (D(u instanceof Error ? u : new Error(String(u))), w(!1));
|
|
92
|
+
}).finally(() => {
|
|
93
|
+
o.close().catch(() => {
|
|
94
|
+
});
|
|
95
|
+
}), () => {
|
|
96
|
+
l = !0;
|
|
97
|
+
};
|
|
98
|
+
}, [C, n.src, n.disableWebAudio, n.waveformSamples]);
|
|
99
|
+
const k = i(() => {
|
|
100
|
+
if (d.current && d.current.ctx.state !== "closed")
|
|
101
|
+
return d.current;
|
|
102
|
+
if (d.current = null, s.current.disableWebAudio || typeof window > "u")
|
|
103
|
+
return null;
|
|
104
|
+
const e = r.current;
|
|
105
|
+
if (!e)
|
|
106
|
+
return null;
|
|
107
|
+
const t = window.AudioContext || window.webkitAudioContext;
|
|
108
|
+
if (!t)
|
|
109
|
+
return null;
|
|
110
|
+
try {
|
|
111
|
+
const c = new t(), l = c.createMediaElementSource(e), o = c.createAnalyser();
|
|
112
|
+
return o.fftSize = s.current.fftSize ?? 256, l.connect(o), o.connect(c.destination), d.current = { ctx: c, source: l, analyser: o }, te(c), _(o), d.current;
|
|
113
|
+
} catch {
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
}, []);
|
|
117
|
+
v(() => () => {
|
|
118
|
+
d.current?.ctx.close().catch(() => {
|
|
119
|
+
}), d.current = null;
|
|
120
|
+
}, []);
|
|
121
|
+
const re = i(async () => {
|
|
122
|
+
const e = r.current;
|
|
123
|
+
if (!e)
|
|
124
|
+
return;
|
|
125
|
+
const t = k();
|
|
126
|
+
t && t.ctx.state === "suspended" && await t.ctx.resume().catch(() => {
|
|
127
|
+
});
|
|
128
|
+
try {
|
|
129
|
+
await e.play();
|
|
130
|
+
} catch {
|
|
131
|
+
}
|
|
132
|
+
}, [k]), ae = i(() => {
|
|
133
|
+
r.current?.pause();
|
|
134
|
+
}, []), ue = i(() => {
|
|
135
|
+
const e = r.current;
|
|
136
|
+
if (!e)
|
|
137
|
+
return;
|
|
138
|
+
const t = k();
|
|
139
|
+
t && t.ctx.state === "suspended" && t.ctx.resume().catch(() => {
|
|
140
|
+
}), e.paused ? e.play().catch(() => {
|
|
141
|
+
}) : e.pause();
|
|
142
|
+
}, [k]), ce = i((e) => {
|
|
143
|
+
const t = r.current;
|
|
144
|
+
if (!t)
|
|
145
|
+
return;
|
|
146
|
+
const c = Number.isFinite(t.duration) ? t.duration : 1 / 0;
|
|
147
|
+
t.currentTime = Math.max(0, Math.min(e, c));
|
|
148
|
+
}, []), se = i((e) => {
|
|
149
|
+
const t = r.current;
|
|
150
|
+
if (!t)
|
|
151
|
+
return;
|
|
152
|
+
const c = Number.isFinite(t.duration) ? t.duration : 1 / 0;
|
|
153
|
+
t.currentTime = Math.max(0, Math.min(t.currentTime + e, c));
|
|
154
|
+
}, []), oe = i((e) => {
|
|
155
|
+
const t = r.current;
|
|
156
|
+
t && (t.volume = Math.max(0, Math.min(1, e)), e > 0 && t.muted && (t.muted = !1));
|
|
157
|
+
}, []), ie = i(() => {
|
|
158
|
+
r.current && (r.current.muted = !0);
|
|
159
|
+
}, []), le = i(() => {
|
|
160
|
+
r.current && (r.current.muted = !1);
|
|
161
|
+
}, []), de = i(() => {
|
|
162
|
+
const e = r.current;
|
|
163
|
+
e && (e.muted = !e.muted);
|
|
164
|
+
}, []), fe = i((e) => {
|
|
165
|
+
r.current && (r.current.playbackRate = e);
|
|
166
|
+
}, []);
|
|
167
|
+
return {
|
|
168
|
+
audioRef: r,
|
|
169
|
+
playing: h,
|
|
170
|
+
paused: !h,
|
|
171
|
+
ended: $,
|
|
172
|
+
currentTime: E,
|
|
173
|
+
duration: L,
|
|
174
|
+
buffered: g,
|
|
175
|
+
volume: j,
|
|
176
|
+
muted: H,
|
|
177
|
+
playbackRate: U,
|
|
178
|
+
isLoading: q,
|
|
179
|
+
error: J,
|
|
180
|
+
canPlay: O,
|
|
181
|
+
currentSrc: C,
|
|
182
|
+
peaks: Q,
|
|
183
|
+
peaksLoading: X,
|
|
184
|
+
peaksError: Y,
|
|
185
|
+
analyser: Z,
|
|
186
|
+
audioContext: ee,
|
|
187
|
+
play: re,
|
|
188
|
+
pause: ae,
|
|
189
|
+
toggle: ue,
|
|
190
|
+
seek: ce,
|
|
191
|
+
seekBy: se,
|
|
192
|
+
setVolume: oe,
|
|
193
|
+
mute: ie,
|
|
194
|
+
unmute: le,
|
|
195
|
+
toggleMute: de,
|
|
196
|
+
setPlaybackRate: fe
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
export {
|
|
200
|
+
ye as useAudio
|
|
201
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createContext as t, useContext as n } from "react";
|
|
2
|
+
const o = t(null), d = o.Provider;
|
|
3
|
+
function i() {
|
|
4
|
+
const e = n(o);
|
|
5
|
+
if (!e)
|
|
6
|
+
throw new Error(
|
|
7
|
+
"Video compound component must be rendered inside a <Video /> parent. If you need access to the video state outside the <Video /> tree, use the useVideo() hook instead."
|
|
8
|
+
);
|
|
9
|
+
return e;
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
o as VideoContext,
|
|
13
|
+
d as VideoProvider,
|
|
14
|
+
i as useVideoContext
|
|
15
|
+
};
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { factory as ge, useProps as pe, useStyles as ye, Box as ke, createVarsResolver as be, getThemeColor as ve, getRadius as he } from "@mantine/core";
|
|
2
|
+
import u, { useRef as V, useEffect as I, useCallback as k, useState as Te } from "react";
|
|
3
|
+
import { VideoCaptionsButton as Ce } from "./components/VideoCaptionsButton.js";
|
|
4
|
+
import { VideoControls as N } from "./components/VideoControls.js";
|
|
5
|
+
import { VideoFullscreenButton as Ve } from "./components/VideoFullscreenButton.js";
|
|
6
|
+
import { VideoMuteButton as x } from "./components/VideoMuteButton.js";
|
|
7
|
+
import { VideoPiPButton as Pe } from "./components/VideoPiPButton.js";
|
|
8
|
+
import { VideoPlayButton as Re } from "./components/VideoPlayButton.js";
|
|
9
|
+
import { VideoSkipButton as Be } from "./components/VideoSkipButton.js";
|
|
10
|
+
import { VideoTimeDisplay as De } from "./components/VideoTimeDisplay.js";
|
|
11
|
+
import { VideoTimeline as we } from "./components/VideoTimeline.js";
|
|
12
|
+
import { useVideo as Ee } from "./use-video.js";
|
|
13
|
+
import { VideoProvider as Ae } from "./Video.context.js";
|
|
14
|
+
import L from "./Video.module.css.js";
|
|
15
|
+
const Me = {
|
|
16
|
+
color: "blue",
|
|
17
|
+
radius: "md",
|
|
18
|
+
size: "md",
|
|
19
|
+
variant: "overlay",
|
|
20
|
+
preload: "metadata",
|
|
21
|
+
playsInline: !0,
|
|
22
|
+
fit: "contain",
|
|
23
|
+
backgroundMuteButton: !0
|
|
24
|
+
}, Fe = be(
|
|
25
|
+
(l, { color: f, radius: n, fit: d, asBackground: c }) => {
|
|
26
|
+
const a = ve(f, l);
|
|
27
|
+
return {
|
|
28
|
+
root: {
|
|
29
|
+
"--video-color": a,
|
|
30
|
+
"--video-radius": n === void 0 ? void 0 : he(n),
|
|
31
|
+
"--video-bg": "black",
|
|
32
|
+
"--video-controls-bg": "linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.35) 60%, transparent 100%)",
|
|
33
|
+
"--video-controls-height": "44px",
|
|
34
|
+
"--video-controls-text-color": "white",
|
|
35
|
+
"--video-timeline-color": a,
|
|
36
|
+
"--video-timeline-thumb-color": a,
|
|
37
|
+
"--video-object-fit": c ? "cover" : d ?? "contain"
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
), t = ge((l) => {
|
|
42
|
+
const f = pe("Video", Me, l), {
|
|
43
|
+
ref: n,
|
|
44
|
+
src: d,
|
|
45
|
+
sources: c,
|
|
46
|
+
fallbackSrc: a,
|
|
47
|
+
poster: _,
|
|
48
|
+
controls: Se,
|
|
49
|
+
autoPlay: P,
|
|
50
|
+
muted: R,
|
|
51
|
+
loop: B,
|
|
52
|
+
playsInline: H,
|
|
53
|
+
preload: j,
|
|
54
|
+
playing: K,
|
|
55
|
+
onPlayChange: z,
|
|
56
|
+
currentTime: U,
|
|
57
|
+
onCurrentTimeChange: q,
|
|
58
|
+
volume: J,
|
|
59
|
+
onVolumeChange: O,
|
|
60
|
+
playbackRate: X,
|
|
61
|
+
onPlaybackRateChange: G,
|
|
62
|
+
color: Ie,
|
|
63
|
+
radius: Ne,
|
|
64
|
+
aspectRatio: g,
|
|
65
|
+
size: Q,
|
|
66
|
+
variant: b,
|
|
67
|
+
onEnded: W,
|
|
68
|
+
onError: Y,
|
|
69
|
+
onEnterPictureInPicture: Z,
|
|
70
|
+
onLeavePictureInPicture: $,
|
|
71
|
+
onFullscreenChange: ee,
|
|
72
|
+
fit: xe,
|
|
73
|
+
// Pulled out so they don't leak onto the root DOM element via `...others`.
|
|
74
|
+
// The effective values are derived from `_props.*` below (background mode
|
|
75
|
+
// flips their defaults), so the destructured copies are intentionally unused.
|
|
76
|
+
shortcuts: Le,
|
|
77
|
+
clickToToggle: _e,
|
|
78
|
+
doubleClickToFullscreen: He,
|
|
79
|
+
autoHideControls: je,
|
|
80
|
+
asBackground: i,
|
|
81
|
+
backgroundMuteButton: oe,
|
|
82
|
+
children: te,
|
|
83
|
+
classNames: re,
|
|
84
|
+
style: D,
|
|
85
|
+
styles: le,
|
|
86
|
+
unstyled: ne,
|
|
87
|
+
vars: ae,
|
|
88
|
+
className: ie,
|
|
89
|
+
mod: ce,
|
|
90
|
+
...se
|
|
91
|
+
} = f, ue = l.controls ?? !i, v = l.shortcuts ?? !i, w = l.clickToToggle ?? !i, E = l.doubleClickToFullscreen ?? !i, s = l.autoHideControls ?? (i ? 0 : 3e3), p = ye({
|
|
92
|
+
name: "Video",
|
|
93
|
+
props: f,
|
|
94
|
+
classes: L,
|
|
95
|
+
className: ie,
|
|
96
|
+
style: D,
|
|
97
|
+
classNames: re,
|
|
98
|
+
styles: le,
|
|
99
|
+
unstyled: ne,
|
|
100
|
+
vars: ae,
|
|
101
|
+
varsResolver: Fe
|
|
102
|
+
}), o = Ee({
|
|
103
|
+
src: d,
|
|
104
|
+
autoPlay: P,
|
|
105
|
+
muted: R,
|
|
106
|
+
loop: B,
|
|
107
|
+
playing: K,
|
|
108
|
+
onPlayChange: z,
|
|
109
|
+
currentTime: U,
|
|
110
|
+
onCurrentTimeChange: q,
|
|
111
|
+
volume: J,
|
|
112
|
+
onVolumeChange: O,
|
|
113
|
+
playbackRate: X,
|
|
114
|
+
onPlaybackRateChange: G,
|
|
115
|
+
onEnded: W,
|
|
116
|
+
onError: Y,
|
|
117
|
+
onEnterPictureInPicture: Z,
|
|
118
|
+
onLeavePictureInPicture: $,
|
|
119
|
+
onFullscreenChange: ee
|
|
120
|
+
}), A = Array.isArray(c) && c.length > 0, h = V(!1);
|
|
121
|
+
I(() => {
|
|
122
|
+
h.current = !1;
|
|
123
|
+
}, [d, c, a]);
|
|
124
|
+
const de = k(() => {
|
|
125
|
+
if (!a || h.current)
|
|
126
|
+
return;
|
|
127
|
+
const e = o.videoRef.current;
|
|
128
|
+
e && (h.current = !0, e.removeAttribute("src"), e.querySelectorAll("source").forEach((r) => r.remove()), e.src = a, e.load());
|
|
129
|
+
}, [a, o.videoRef]), [M, T] = Te(!0), m = V(null), y = k(() => {
|
|
130
|
+
T(!0), m.current && clearTimeout(m.current), s && s > 0 && o.playing && (m.current = setTimeout(() => T(!1), s));
|
|
131
|
+
}, [s, o.playing]);
|
|
132
|
+
I(() => (y(), () => {
|
|
133
|
+
m.current && clearTimeout(m.current);
|
|
134
|
+
}), [y, o.playing]);
|
|
135
|
+
const C = V(0), me = k(
|
|
136
|
+
(e) => {
|
|
137
|
+
if (e.target !== e.currentTarget && e.target.tagName !== "VIDEO")
|
|
138
|
+
return;
|
|
139
|
+
const r = Date.now(), S = r - C.current < 300;
|
|
140
|
+
if (C.current = r, S && E) {
|
|
141
|
+
o.toggleFullscreen();
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
w && !S && setTimeout(() => {
|
|
145
|
+
Date.now() - C.current >= 250 && o.toggle();
|
|
146
|
+
}, 260);
|
|
147
|
+
},
|
|
148
|
+
[w, E, o]
|
|
149
|
+
), fe = k(
|
|
150
|
+
(e) => {
|
|
151
|
+
if (!v) return;
|
|
152
|
+
const r = e.target;
|
|
153
|
+
if (!(r.tagName === "INPUT" || r.tagName === "TEXTAREA"))
|
|
154
|
+
switch (e.key) {
|
|
155
|
+
case " ":
|
|
156
|
+
case "k":
|
|
157
|
+
case "K":
|
|
158
|
+
e.preventDefault(), o.toggle();
|
|
159
|
+
break;
|
|
160
|
+
case "ArrowLeft":
|
|
161
|
+
case "j":
|
|
162
|
+
case "J":
|
|
163
|
+
e.preventDefault(), o.seekBy(e.key === "ArrowLeft" ? -5 : -10);
|
|
164
|
+
break;
|
|
165
|
+
case "ArrowRight":
|
|
166
|
+
case "l":
|
|
167
|
+
case "L":
|
|
168
|
+
e.preventDefault(), o.seekBy(e.key === "ArrowRight" ? 5 : 10);
|
|
169
|
+
break;
|
|
170
|
+
case "ArrowUp":
|
|
171
|
+
e.preventDefault(), o.setVolume(Math.min(1, o.volume + 0.05));
|
|
172
|
+
break;
|
|
173
|
+
case "ArrowDown":
|
|
174
|
+
e.preventDefault(), o.setVolume(Math.max(0, o.volume - 0.05));
|
|
175
|
+
break;
|
|
176
|
+
case "m":
|
|
177
|
+
case "M":
|
|
178
|
+
e.preventDefault(), o.toggleMute();
|
|
179
|
+
break;
|
|
180
|
+
case "f":
|
|
181
|
+
case "F":
|
|
182
|
+
e.preventDefault(), o.toggleFullscreen();
|
|
183
|
+
break;
|
|
184
|
+
case "p":
|
|
185
|
+
case "P":
|
|
186
|
+
e.preventDefault(), o.togglePiP();
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
[v, o]
|
|
191
|
+
), F = b === "minimal" || b === "bordered";
|
|
192
|
+
return /* @__PURE__ */ u.createElement(
|
|
193
|
+
Ae,
|
|
194
|
+
{
|
|
195
|
+
value: {
|
|
196
|
+
...o,
|
|
197
|
+
getStyles: p,
|
|
198
|
+
controlsVisible: M,
|
|
199
|
+
showControls: y
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
/* @__PURE__ */ u.createElement(
|
|
203
|
+
ke,
|
|
204
|
+
{
|
|
205
|
+
...p("root", {
|
|
206
|
+
style: [
|
|
207
|
+
g && !F ? { aspectRatio: String(g) } : void 0,
|
|
208
|
+
D
|
|
209
|
+
]
|
|
210
|
+
}),
|
|
211
|
+
...se,
|
|
212
|
+
ref: (e) => {
|
|
213
|
+
o.containerRef.current = e, typeof n == "function" ? n(e) : n && typeof n == "object" && (n.current = e);
|
|
214
|
+
},
|
|
215
|
+
mod: [
|
|
216
|
+
{
|
|
217
|
+
variant: b,
|
|
218
|
+
size: Q,
|
|
219
|
+
playing: o.playing,
|
|
220
|
+
paused: o.paused && !o.ended,
|
|
221
|
+
ended: o.ended,
|
|
222
|
+
fullscreen: o.fullscreen,
|
|
223
|
+
"controls-visible": M,
|
|
224
|
+
"as-background": i
|
|
225
|
+
},
|
|
226
|
+
ce
|
|
227
|
+
],
|
|
228
|
+
tabIndex: v ? 0 : void 0,
|
|
229
|
+
onMouseMove: y,
|
|
230
|
+
onMouseLeave: () => {
|
|
231
|
+
s && s > 0 && o.playing && T(!1);
|
|
232
|
+
},
|
|
233
|
+
onClick: me,
|
|
234
|
+
onKeyDown: fe
|
|
235
|
+
},
|
|
236
|
+
/* @__PURE__ */ u.createElement(
|
|
237
|
+
"video",
|
|
238
|
+
{
|
|
239
|
+
...p("video", {
|
|
240
|
+
style: g && F ? { aspectRatio: String(g) } : void 0
|
|
241
|
+
}),
|
|
242
|
+
ref: o.videoRef,
|
|
243
|
+
src: A ? void 0 : d,
|
|
244
|
+
poster: _,
|
|
245
|
+
autoPlay: P,
|
|
246
|
+
muted: R,
|
|
247
|
+
loop: B,
|
|
248
|
+
playsInline: H,
|
|
249
|
+
preload: j,
|
|
250
|
+
onError: de
|
|
251
|
+
},
|
|
252
|
+
A ? c.map((e, r) => /* @__PURE__ */ u.createElement("source", { key: r, src: e.src, type: e.type, media: e.media })) : null
|
|
253
|
+
),
|
|
254
|
+
i && oe && /* @__PURE__ */ u.createElement(x, { ...p("backgroundMuteButton") }),
|
|
255
|
+
te ?? (ue && /* @__PURE__ */ u.createElement(N, null))
|
|
256
|
+
)
|
|
257
|
+
);
|
|
258
|
+
});
|
|
259
|
+
t.classes = L;
|
|
260
|
+
t.displayName = "Video";
|
|
261
|
+
t.Controls = N;
|
|
262
|
+
t.PlayButton = Re;
|
|
263
|
+
t.Timeline = we;
|
|
264
|
+
t.TimeDisplay = De;
|
|
265
|
+
t.MuteButton = x;
|
|
266
|
+
t.FullscreenButton = Ve;
|
|
267
|
+
t.PiPButton = Pe;
|
|
268
|
+
t.CaptionsButton = Ce;
|
|
269
|
+
t.SkipButton = Be;
|
|
270
|
+
export {
|
|
271
|
+
t as Video
|
|
272
|
+
};
|