@apple-pie/slice 0.1.21 → 0.1.23
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 +25 -1
- package/dist/cjs/chunks/AudioBubble-v4xKclI8.js +54 -0
- package/dist/cjs/chunks/{Button-DXvjvGtY.js → Button-DmWbooXb.js} +1 -1
- package/dist/cjs/chunks/{ButtonBar-BZ6sme27.js → ButtonBar-RSBwFaU-.js} +1 -1
- package/dist/cjs/chunks/{Camera-rVC4KI4v.js → Camera-CLm3aQR8.js} +6 -2
- package/dist/cjs/chunks/{CheckBox-DQRLqTAK.js → CheckBox-DDINn56u.js} +1 -1
- package/dist/cjs/chunks/{Chip-Pv9-KTnh.js → Chip-DRSg6kLh.js} +1 -1
- package/dist/cjs/chunks/{DrggablePanel-CkhCXqKv.js → DrggablePanel-CERavfv3.js} +6 -2
- package/dist/cjs/chunks/{DropDown-C3AZ5b_b.js → DropDown-CJH-Y6Z5.js} +1 -1
- package/dist/cjs/chunks/{ErrorSummary-BTgAd3sK.js → ErrorSummary-BfVHS893.js} +6 -2
- package/dist/cjs/chunks/{FileIcon-CZLe2S2l.js → FileIcon-xoD-xIme.js} +2 -2
- package/dist/cjs/chunks/{FileList-BHwBIics.js → FileList-DjTXjXnK.js} +1 -1
- package/dist/cjs/chunks/{Grouper-D4yyHHkM.js → Grouper-RYRxazG9.js} +1 -1
- package/dist/cjs/chunks/{Icon-D1EB8S5r.js → Icon-BB-t50Yt.js} +6 -2
- package/dist/cjs/chunks/{IconButton-B07Ttxbr.js → IconButton-BUw3YUsI.js} +1 -1
- package/dist/cjs/chunks/{Label-CTzvGcds.js → Label-NzMpkZo2.js} +1 -1
- package/dist/cjs/chunks/MdStreamBuffer-DObxjnAm.js +381 -0
- package/dist/cjs/chunks/{ProgressIndicator-BGqIwycX.js → ProgressIndicator-8QZwTSyY.js} +9 -4
- package/dist/cjs/chunks/{PromptInput-z6TuhHsG.js → PromptInput-D1wP5-uN.js} +2 -2
- package/dist/cjs/chunks/{RadioButton-DuIsM4lu.js → RadioButton-Cvqum7dU.js} +1 -1
- package/dist/cjs/chunks/{RadioButtonList-bu11ILyw.js → RadioButtonList-CPHTioGa.js} +1 -1
- package/dist/cjs/chunks/{TabBar-Bcq_n4Mk.js → TabBar-CnD3E-qa.js} +1 -1
- package/dist/cjs/chunks/{TextArea-BSKbDOEt.js → TextArea-rWqDDui3.js} +6 -6
- package/dist/cjs/chunks/{TextField-BNacOZVx.js → TextField-C6U-qhDt.js} +20 -22
- package/dist/cjs/chunks/{Toast-CZzAWG0S.js → Toast-D2fpwdjF.js} +6 -2
- package/dist/cjs/chunks/{UploadArea-CKuE4rtg.js → UploadArea-BS2BPuhZ.js} +1 -1
- package/dist/cjs/chunks/audioVisualizer-EIfIjWH7.js +60 -0
- package/dist/cjs/components/AudioBubble/index.js +10 -0
- package/dist/cjs/components/Button/index.js +4 -4
- package/dist/cjs/components/ButtonBar/index.js +2 -2
- package/dist/cjs/components/Camera/index.js +4 -4
- package/dist/cjs/components/CheckBox/index.js +2 -2
- package/dist/cjs/components/Chip/index.js +2 -2
- package/dist/cjs/components/DraggablePanel/index.js +3 -3
- package/dist/cjs/components/DropDown/index.js +2 -2
- package/dist/cjs/components/ErrorSummary/index.js +2 -2
- package/dist/cjs/components/FileIcon/index.js +3 -4
- package/dist/cjs/components/FileList/index.js +4 -4
- package/dist/cjs/components/Grouper/index.js +2 -2
- package/dist/cjs/components/Icon/index.js +3 -3
- package/dist/cjs/components/IconButton/index.js +4 -4
- package/dist/cjs/components/Label/index.js +1 -1
- package/dist/cjs/components/Progress/index.js +5 -5
- package/dist/cjs/components/PromptInput/index.js +7 -7
- package/dist/cjs/components/RadioButton/index.js +2 -2
- package/dist/cjs/components/RadioButtonList/index.js +3 -3
- package/dist/cjs/components/TabBar/index.js +3 -3
- package/dist/cjs/components/TextArea/index.js +4 -4
- package/dist/cjs/components/Textfield/index.js +5 -5
- package/dist/cjs/components/Toast/index.js +2 -2
- package/dist/cjs/components/UploadArea/index.js +5 -5
- package/dist/cjs/hooks/useAudioRecorder.js +70 -0
- package/dist/cjs/hooks/useMdStreamBuffer.js +41 -0
- package/dist/cjs/hooks/useMicrophone.js +132 -0
- package/dist/cjs/hooks.js +4 -2
- package/dist/cjs/index.js +7 -4
- package/dist/cjs/utils/index.js +2 -1
- package/dist/cjs/utils/objects/index.js +2 -1
- package/dist/esm/chunks/AudioBubble-Dvsrq1dZ.mjs +62 -0
- package/dist/esm/chunks/{Avatar-CSLVUF_y.mjs → Avatar-C8uV7ROZ.mjs} +2 -2
- package/dist/esm/chunks/{AvatarGroup--ELW-bO1.mjs → AvatarGroup-Bt1Lkn5S.mjs} +2 -2
- package/dist/esm/chunks/{Badge-DyICxZP2.mjs → Badge-D-U1jomY.mjs} +1 -1
- package/dist/esm/chunks/{Button-daLv0i7S.mjs → Button-sEYjFcR2.mjs} +5 -5
- package/dist/esm/chunks/{ButtonBar-DXK8meQq.mjs → ButtonBar-DSR2lhhN.mjs} +3 -3
- package/dist/esm/chunks/{Camera-BqmVsVKy.mjs → Camera-DSSiOeJd.mjs} +6 -6
- package/dist/esm/chunks/{CheckBox-BsaYFNC6.mjs → CheckBox-B6zWSySW.mjs} +3 -3
- package/dist/esm/chunks/{Chip-BRZeD1OX.mjs → Chip-BBKJ6wG4.mjs} +3 -3
- package/dist/esm/chunks/{DivInput-DeSpC8Wm.mjs → DivInput-cIMIH07H.mjs} +2 -2
- package/dist/esm/chunks/{Dot-CLGwQu-i.mjs → Dot-Cj6gWj4_.mjs} +1 -1
- package/dist/esm/chunks/{DrggablePanel-Ddi0vPRp.mjs → DrggablePanel-CQcIbxpX.mjs} +3 -3
- package/dist/esm/chunks/{DropDown-DOJvg96J.mjs → DropDown-B98ZoY1x.mjs} +3 -3
- package/dist/esm/chunks/{ErrorSummary-CHLkvdHk.mjs → ErrorSummary-Mz9siVxm.mjs} +3 -3
- package/dist/esm/chunks/{FileIcon-ePouoJpT.mjs → FileIcon-DeW-ZBiv.mjs} +3 -3
- package/dist/esm/chunks/{FileList-5LElsgoE.mjs → FileList-0Dzx15hl.mjs} +5 -5
- package/dist/esm/chunks/{Grouper-DR14qDXP.mjs → Grouper-B04WxD6K.mjs} +3 -3
- package/dist/esm/chunks/{Icon-CUSQtytG.mjs → Icon-KDwlMXzH.mjs} +3 -3
- package/dist/esm/chunks/{IconButton-DG69Vlhj.mjs → IconButton-oAB8ZFTf.mjs} +4 -4
- package/dist/esm/chunks/{IndexedDB-CJgzPHPB.mjs → IndexedDB-Dk7a4fPS.mjs} +1 -1
- package/dist/esm/chunks/{Label-CRsE7o3D.mjs → Label-BD7VlTDw.mjs} +3 -3
- package/dist/esm/chunks/MdStreamBuffer-DNXE4XbN.mjs +381 -0
- package/dist/esm/chunks/{Overlay-TOzZXnwF.mjs → Overlay-3KkyDm1f.mjs} +1 -1
- package/dist/esm/chunks/{Pager-BYT7_mCb.mjs → Pager-DmiwYLl5.mjs} +2 -2
- package/dist/esm/chunks/{ProgressIndicator-D7paCpgY.mjs → ProgressIndicator-CxsZm_As.mjs} +6 -5
- package/dist/esm/chunks/{PromptInput-CpxUcInZ.mjs → PromptInput-D4Q-DWjz.mjs} +4 -2
- package/dist/esm/chunks/{RadioButton-B5ZF5oJ_.mjs → RadioButton-B0jvM5VW.mjs} +3 -3
- package/dist/esm/chunks/{RadioButtonList-D9ZAZgkK.mjs → RadioButtonList-DBRAv87_.mjs} +3 -3
- package/dist/esm/chunks/{Slider-DL2iuNlh.mjs → Slider-CONGTXUE.mjs} +2 -2
- package/dist/esm/chunks/{Spacer-BlgEdKEM.mjs → Spacer-C5fcJYq-.mjs} +1 -1
- package/dist/esm/chunks/{Switch-BhCOo5Lu.mjs → Switch-CyoaJwSX.mjs} +1 -1
- package/dist/esm/chunks/{TabBar-BK7OcjPl.mjs → TabBar-DmO1ixBz.mjs} +4 -4
- package/dist/esm/chunks/{TextArea-BmsEj6IA.mjs → TextArea-Bd_obSSH.mjs} +7 -7
- package/dist/esm/chunks/{TextField-DWPpevsj.mjs → TextField-CZnUNhFe.mjs} +20 -26
- package/dist/esm/chunks/{Tip-BnKB9qMi.mjs → Tip-DrQvxDsH.mjs} +2 -2
- package/dist/esm/chunks/{Toast-DPHLwDES.mjs → Toast-C5XSDgno.mjs} +4 -4
- package/dist/esm/chunks/{UploadArea-DPiOaNpc.mjs → UploadArea-Gpq-MhqB.mjs} +4 -4
- package/dist/esm/chunks/{WSConnection-D9mpsVdc.mjs → WSConnection-DV7k84B4.mjs} +1 -1
- package/dist/esm/chunks/{_types-CPrEyJX9.mjs → _types-DOQAaLqq.mjs} +1 -1
- package/dist/esm/chunks/audioVisualizer-ZgT77nUw.mjs +60 -0
- package/dist/esm/chunks/{localDBStore-B4jkR5Jx.mjs → localDBStore-Dnpo5nSv.mjs} +2 -2
- package/dist/esm/chunks/{misc-N8KLjOXc.mjs → misc-BeEWwOaJ.mjs} +1 -1
- package/dist/esm/chunks/{sseStore-2JIpEKfz.mjs → sseStore-DjrfpNAS.mjs} +1 -1
- package/dist/esm/chunks/{tslib.es6-c-7TIv71.mjs → tslib.es6-C-olHjXV.mjs} +1 -1
- package/dist/esm/chunks/{uploads-worker-Dv-4zGnC.mjs → uploads-worker-7X9EwX9N.mjs} +1 -1
- package/dist/esm/chunks/{uploadsStore-D69fEXMY.mjs → uploadsStore-B7VECR5Q.mjs} +1 -1
- package/dist/esm/chunks/{windowStore-BOTh1g37.mjs → windowStore-CAzx2-QV.mjs} +1 -1
- package/dist/esm/components/AudioBubble/index.mjs +31 -0
- package/dist/esm/components/Avatar/index.mjs +3 -3
- package/dist/esm/components/AvatarGroup/index.mjs +4 -4
- package/dist/esm/components/Badge/index.mjs +2 -2
- package/dist/esm/components/Button/index.mjs +8 -8
- package/dist/esm/components/ButtonBar/index.mjs +4 -4
- package/dist/esm/components/Camera/index.mjs +7 -7
- package/dist/esm/components/CheckBox/index.mjs +4 -4
- package/dist/esm/components/Chip/index.mjs +4 -4
- package/dist/esm/components/DivInput/index.mjs +3 -3
- package/dist/esm/components/Dot/index.mjs +2 -2
- package/dist/esm/components/DraggablePanel/index.mjs +4 -4
- package/dist/esm/components/DropDown/index.mjs +4 -4
- package/dist/esm/components/ErrorSummary/index.mjs +4 -4
- package/dist/esm/components/FileIcon/index.mjs +4 -4
- package/dist/esm/components/FileList/index.mjs +6 -6
- package/dist/esm/components/FlexDiv/index.mjs +2 -2
- package/dist/esm/components/Grouper/index.mjs +5 -5
- package/dist/esm/components/Icon/index.mjs +4 -4
- package/dist/esm/components/IconButton/index.mjs +7 -7
- package/dist/esm/components/Label/index.mjs +3 -3
- package/dist/esm/components/Overlay/index.mjs +2 -2
- package/dist/esm/components/Pager/index.mjs +3 -3
- package/dist/esm/components/Progress/index.mjs +5 -5
- package/dist/esm/components/PromptInput/index.mjs +11 -11
- package/dist/esm/components/RadioButton/index.mjs +4 -4
- package/dist/esm/components/RadioButtonList/index.mjs +5 -5
- package/dist/esm/components/Slider/index.mjs +3 -3
- package/dist/esm/components/Spacer/index.mjs +2 -2
- package/dist/esm/components/Switch/index.mjs +2 -2
- package/dist/esm/components/TabBar/index.mjs +7 -7
- package/dist/esm/components/TextArea/index.mjs +9 -9
- package/dist/esm/components/Textfield/index.mjs +10 -10
- package/dist/esm/components/Tip/index.mjs +3 -3
- package/dist/esm/components/Toast/index.mjs +5 -5
- package/dist/esm/components/UploadArea/index.mjs +7 -7
- package/dist/esm/hooks/useAudioRecorder.mjs +74 -0
- package/dist/esm/hooks/useMdStreamBuffer.mjs +42 -0
- package/dist/esm/hooks/useMicrophone.mjs +134 -0
- package/dist/esm/hooks/useTrackRenders.mjs +2 -2
- package/dist/esm/hooks.mjs +10 -0
- package/dist/esm/index.mjs +51 -39
- package/dist/esm/stores/LocalDB.mjs +3 -3
- package/dist/esm/stores/SSE.mjs +2 -2
- package/dist/esm/stores/WS.mjs +2 -2
- package/dist/esm/stores/uploads.mjs +3 -3
- package/dist/esm/stores/window.mjs +2 -2
- package/dist/esm/stores.mjs +7 -7
- package/dist/esm/utils/index.mjs +8 -4
- package/dist/esm/utils/objects/index.mjs +7 -3
- package/dist/esm/workers/uploads/uploads.mjs +2 -2
- package/dist/types/components/AudioBubble/AudioBubble.d.ts +3 -0
- package/dist/types/components/AudioBubble/_types.d.ts +18 -0
- package/dist/types/components/AudioBubble/index.d.ts +2 -0
- package/dist/types/components/Textfield/_types.d.ts +1 -3
- package/dist/types/hooks/index.d.ts +3 -0
- package/dist/types/hooks/useAudioRecorder/useAudioRecorder.d.ts +14 -0
- package/dist/types/hooks/useMdStreamBuffer/useMdStreamBuffer.d.ts +10 -0
- package/dist/types/hooks/useMicrophone/useMicrophone.d.ts +19 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/utils/index.d.ts +2 -2
- package/dist/types/utils/objects/MDStreamBuffer/MdStreamBuffer.d.ts +63 -0
- package/dist/types/utils/objects/MDStreamBuffer/_defaults.d.ts +3 -0
- package/dist/types/utils/objects/MDStreamBuffer/_types.d.ts +25 -0
- package/dist/types/utils/objects/WebRTCConnection/WebRTCConnection.d.ts +86 -0
- package/dist/types/utils/objects/WebRTCConnection/_types.d.ts +11 -0
- package/dist/types/utils/objects/audioVisualizer/audioVisualizer.d.ts +40 -0
- package/dist/types/utils/objects/index.d.ts +4 -0
- package/package.json +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var UploadArea = require("../../chunks/UploadArea-
|
|
3
|
+
var UploadArea = require("../../chunks/UploadArea-BS2BPuhZ.js");
|
|
4
4
|
|
|
5
5
|
require("react/jsx-runtime"), require("react"), require("../../chunks/misc-BTF7BCZW.js"),
|
|
6
|
-
require("../../chunks/tslib.es6-C8dZW5nY.js"), require("../../chunks/FileList-
|
|
7
|
-
require("../../chunks/FileIcon-
|
|
6
|
+
require("../../chunks/tslib.es6-C8dZW5nY.js"), require("../../chunks/FileList-DjTXjXnK.js"),
|
|
7
|
+
require("../../chunks/FileIcon-xoD-xIme.js"), require("../../hooks/useTheme.js"),
|
|
8
8
|
require("../../theme/themes.js"), require("../../theme/colors.js"), require("../../theme/corners.js"),
|
|
9
9
|
require("../../theme/elevations.js"), require("../../theme/motion.js"), require("../../theme/type.js"),
|
|
10
10
|
require("../../hooks/useObserveTheme.js"), require("../../hooks/useWindow.js"),
|
|
11
|
-
require("../../chunks/Icon-
|
|
12
|
-
require("../../chunks/ProgressIndicator-
|
|
11
|
+
require("../../chunks/Icon-BB-t50Yt.js"), require("../../chunks/style-inject.es-CMuL-BfJ.js"),
|
|
12
|
+
require("../../chunks/ProgressIndicator-8QZwTSyY.js"), require("motion/react"),
|
|
13
13
|
exports.UploadArea = UploadArea.UploadArea, exports.allTypes = UploadArea.allTypes,
|
|
14
14
|
exports.audioTypes = UploadArea.audioTypes, exports.documentTypes = UploadArea.documentTypes,
|
|
15
15
|
exports.imageTypes = UploadArea.imageTypes, exports.textTypes = UploadArea.textTypes,
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var tslib_es6 = require("../chunks/tslib.es6-C8dZW5nY.js"), React = require("react");
|
|
4
|
+
|
|
5
|
+
exports.useAudioRecorder = function(audioStream) {
|
|
6
|
+
const audioBlob = React.useRef(null), mediaRecorderRef = React.useRef(null), recordedChunksRef = React.useRef([]), stopResolveRef = React.useRef(null), [error, setError] = React.useState(null), [isRecording, setIsRecording] = React.useState(!1), [recordingSizeMb, setRecordingSizeMb] = React.useState(0), [mimeType, setMimeType] = React.useState(null), resetRecording = React.useCallback(() => {
|
|
7
|
+
audioBlob.current = null, recordedChunksRef.current = [], setRecordingSizeMb(0),
|
|
8
|
+
setError(null);
|
|
9
|
+
}, []), startRecording = React.useCallback(() => {
|
|
10
|
+
var _a;
|
|
11
|
+
try {
|
|
12
|
+
if ("undefined" == typeof MediaRecorder) throw new TypeError("MediaRecorder is not supported in this browser");
|
|
13
|
+
if ("recording" === (null === (_a = mediaRecorderRef.current) || void 0 === _a ? void 0 : _a.state)) return;
|
|
14
|
+
const stream = (audioStream => {
|
|
15
|
+
const source = (audioStream => audioStream ? "object" == typeof audioStream && "current" in audioStream ? audioStream.current : audioStream : null)(audioStream);
|
|
16
|
+
return source ? "undefined" == typeof MediaStream ? null : source instanceof MediaStream ? source : new MediaStream([ source ]) : null;
|
|
17
|
+
})(audioStream);
|
|
18
|
+
if (!stream) throw new Error("No audio stream or track provided");
|
|
19
|
+
resetRecording();
|
|
20
|
+
const nextMimeType = (() => {
|
|
21
|
+
if ("undefined" == typeof MediaRecorder) return null;
|
|
22
|
+
const mimeTypes = [ "audio/mpeg", "audio/mp4", "audio/webm;codecs=opus", "audio/webm", "audio/ogg;codecs=opus", "audio/ogg" ];
|
|
23
|
+
for (const mimeType of mimeTypes) if (MediaRecorder.isTypeSupported(mimeType)) return mimeType;
|
|
24
|
+
return null;
|
|
25
|
+
})();
|
|
26
|
+
setMimeType(nextMimeType);
|
|
27
|
+
const mediaRecorder = nextMimeType ? new MediaRecorder(stream, {
|
|
28
|
+
mimeType: nextMimeType
|
|
29
|
+
}) : new MediaRecorder(stream);
|
|
30
|
+
mediaRecorder.ondataavailable = event => {
|
|
31
|
+
event.data.size > 0 && (recordedChunksRef.current.push(event.data), setRecordingSizeMb(size => size + event.data.size / 1024 / 1024));
|
|
32
|
+
}, mediaRecorder.onerror = () => {
|
|
33
|
+
setError(new Error("Audio recording failed")), setIsRecording(!1);
|
|
34
|
+
}, mediaRecorder.onstop = () => {
|
|
35
|
+
var _a;
|
|
36
|
+
const nextBlob = new Blob(recordedChunksRef.current, {
|
|
37
|
+
type: mediaRecorder.mimeType || nextMimeType || "audio/webm"
|
|
38
|
+
});
|
|
39
|
+
audioBlob.current = nextBlob, setIsRecording(!1), null === (_a = stopResolveRef.current) || void 0 === _a || _a.call(stopResolveRef, nextBlob),
|
|
40
|
+
stopResolveRef.current = null;
|
|
41
|
+
}, mediaRecorderRef.current = mediaRecorder, mediaRecorder.start(250), setIsRecording(!0);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
console.error("Error recording audio:", error), setError(error instanceof Error ? error : new Error("Unknown error")),
|
|
44
|
+
setIsRecording(!1);
|
|
45
|
+
}
|
|
46
|
+
}, [ audioStream, resetRecording ]), stopRecording = React.useCallback(() => tslib_es6.__awaiter(this, void 0, void 0, function*() {
|
|
47
|
+
try {
|
|
48
|
+
const mediaRecorder = mediaRecorderRef.current;
|
|
49
|
+
return mediaRecorder && "inactive" !== mediaRecorder.state ? new Promise(resolve => {
|
|
50
|
+
stopResolveRef.current = resolve, mediaRecorder.stop();
|
|
51
|
+
}) : (setIsRecording(!1), audioBlob.current);
|
|
52
|
+
} catch (error) {
|
|
53
|
+
return console.error("Error stopping recording:", error), setError(error instanceof Error ? error : new Error("Unknown error")),
|
|
54
|
+
setIsRecording(!1), null;
|
|
55
|
+
}
|
|
56
|
+
}), []);
|
|
57
|
+
return React.useEffect(() => () => {
|
|
58
|
+
mediaRecorderRef.current && "inactive" !== mediaRecorderRef.current.state && mediaRecorderRef.current.stop(),
|
|
59
|
+
mediaRecorderRef.current = null, stopResolveRef.current = null;
|
|
60
|
+
}, []), {
|
|
61
|
+
audioBlob: audioBlob,
|
|
62
|
+
error: error,
|
|
63
|
+
isRecording: isRecording,
|
|
64
|
+
recordingSizeMb: recordingSizeMb,
|
|
65
|
+
mimeType: mimeType,
|
|
66
|
+
resetRecording: resetRecording,
|
|
67
|
+
startRecording: startRecording,
|
|
68
|
+
stopRecording: stopRecording
|
|
69
|
+
};
|
|
70
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var React = require("react");
|
|
4
|
+
|
|
5
|
+
require("../chunks/tslib.es6-C8dZW5nY.js");
|
|
6
|
+
|
|
7
|
+
var MdStreamBuffer = require("../chunks/MdStreamBuffer-DObxjnAm.js");
|
|
8
|
+
|
|
9
|
+
exports.useMDStreamBuffer = function(options) {
|
|
10
|
+
const bufferRef = React.useRef(null), [healthy, setHealthy] = React.useState(""), [raw, setRaw] = React.useState(""), [isComplete, setIsComplete] = React.useState(!1);
|
|
11
|
+
return React.useEffect(() => (bufferRef.current = new MdStreamBuffer.MdBuffer(Object.assign(Object.assign({}, options), {
|
|
12
|
+
onFlush: snapshot => {
|
|
13
|
+
const {healthy: healthy, raw: raw, isComplete: isComplete} = snapshot;
|
|
14
|
+
setHealthy(healthy), setRaw(raw), setIsComplete(isComplete);
|
|
15
|
+
}
|
|
16
|
+
})), () => {
|
|
17
|
+
var _a;
|
|
18
|
+
null === (_a = bufferRef.current) || void 0 === _a || _a.dispose(), bufferRef.current = null;
|
|
19
|
+
}), []), {
|
|
20
|
+
raw: raw,
|
|
21
|
+
healthy: healthy,
|
|
22
|
+
isComplete: isComplete,
|
|
23
|
+
append: React.useCallback(value => {
|
|
24
|
+
var _a;
|
|
25
|
+
value && (null === (_a = bufferRef.current) || void 0 === _a || _a.append(value));
|
|
26
|
+
}, []),
|
|
27
|
+
flush: React.useCallback(() => {
|
|
28
|
+
var _a;
|
|
29
|
+
return null === (_a = bufferRef.current) || void 0 === _a ? void 0 : _a.flush();
|
|
30
|
+
}, []),
|
|
31
|
+
complete: React.useCallback(() => {
|
|
32
|
+
var _a;
|
|
33
|
+
return null === (_a = bufferRef.current) || void 0 === _a ? void 0 : _a.complete();
|
|
34
|
+
}, []),
|
|
35
|
+
reset: React.useCallback(() => {
|
|
36
|
+
var _a;
|
|
37
|
+
null === (_a = bufferRef.current) || void 0 === _a || _a.reset(), setHealthy(""),
|
|
38
|
+
setRaw("");
|
|
39
|
+
}, [])
|
|
40
|
+
};
|
|
41
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var tslib_es6 = require("../chunks/tslib.es6-C8dZW5nY.js"), React = require("react");
|
|
4
|
+
|
|
5
|
+
exports.useMicrophone = function(startMuted = !0, microphoneDeviceId) {
|
|
6
|
+
const micStream = React.useRef(null), micTrack = React.useRef(null), mutedRef = React.useRef(startMuted), mountedRef = React.useRef(!0), initializedRef = React.useRef(!1), [microphones, setMicrophones] = React.useState([]), [muted, setMuted] = React.useState(startMuted), [isRequesting, setIsRequesting] = React.useState(!1), [error, setError] = React.useState(null), waitForPaint = React.useCallback(() => tslib_es6.__awaiter(this, void 0, void 0, function*() {
|
|
7
|
+
yield new Promise(resolve => {
|
|
8
|
+
requestAnimationFrame(() => resolve());
|
|
9
|
+
});
|
|
10
|
+
}), []), waitForTrackToBecomeActive = React.useCallback(track => tslib_es6.__awaiter(this, void 0, void 0, function*() {
|
|
11
|
+
("live" !== track.readyState || track.muted) && (yield new Promise(resolve => {
|
|
12
|
+
const handleUnmute = () => {
|
|
13
|
+
track.removeEventListener("unmute", handleUnmute), resolve();
|
|
14
|
+
};
|
|
15
|
+
track.addEventListener("unmute", handleUnmute, {
|
|
16
|
+
once: !0
|
|
17
|
+
});
|
|
18
|
+
}));
|
|
19
|
+
}), []), stopMicStream = React.useCallback(() => {
|
|
20
|
+
var _a;
|
|
21
|
+
const tracks = null === (_a = micStream.current) || void 0 === _a ? void 0 : _a.getTracks();
|
|
22
|
+
for (const track of null != tracks ? tracks : []) track.stop();
|
|
23
|
+
micStream.current = null, micTrack.current = null;
|
|
24
|
+
}, []), hasMediaSupport = React.useMemo(() => {
|
|
25
|
+
var _a;
|
|
26
|
+
return "undefined" != typeof navigator && Boolean(null === (_a = navigator.mediaDevices) || void 0 === _a ? void 0 : _a.getUserMedia);
|
|
27
|
+
}, []), getMicTrack = React.useCallback(() => {
|
|
28
|
+
if (!micStream.current) throw new Error("No microphone stream found");
|
|
29
|
+
const audioTrack = micStream.current.getAudioTracks()[0];
|
|
30
|
+
if (!audioTrack) throw new Error("No audio track found");
|
|
31
|
+
return audioTrack;
|
|
32
|
+
}, []), muteMic = React.useCallback(() => (getMicTrack().enabled = !1, mutedRef.current = !0,
|
|
33
|
+
setMuted(!0), !0), [ getMicTrack ]), unmuteMic = React.useCallback(() => (getMicTrack().enabled = !0,
|
|
34
|
+
mutedRef.current = !1, setMuted(!1), !0), [ getMicTrack ]), constraints = React.useCallback(deviceId => {
|
|
35
|
+
var _a;
|
|
36
|
+
const id = null !== (_a = null != deviceId ? deviceId : microphoneDeviceId) && void 0 !== _a ? _a : void 0;
|
|
37
|
+
return {
|
|
38
|
+
audio: {
|
|
39
|
+
deviceId: id ? {
|
|
40
|
+
exact: id
|
|
41
|
+
} : void 0
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}, [ microphoneDeviceId ]), requestMicrophone = React.useCallback(() => tslib_es6.__awaiter(this, void 0, void 0, function*() {
|
|
45
|
+
if (setIsRequesting(!0), yield waitForPaint(), !hasMediaSupport) {
|
|
46
|
+
const nextError = new Error("Microphone access is not supported");
|
|
47
|
+
return setError(nextError), mountedRef.current && setIsRequesting(!1), null;
|
|
48
|
+
}
|
|
49
|
+
setError(null), stopMicStream();
|
|
50
|
+
try {
|
|
51
|
+
return micStream.current = yield navigator.mediaDevices.getUserMedia(constraints()),
|
|
52
|
+
micTrack.current = getMicTrack(), micTrack.current.enabled = !mutedRef.current,
|
|
53
|
+
mutedRef.current || (yield waitForTrackToBecomeActive(micTrack.current)), micStream.current;
|
|
54
|
+
} catch (error) {
|
|
55
|
+
if (!(error instanceof DOMException && "OverconstrainedError" === error.name || error instanceof DOMException && "NotFoundError" === error.name)) {
|
|
56
|
+
const nextError = error instanceof Error ? error : new Error("Failed to access microphone");
|
|
57
|
+
throw setError(nextError), nextError;
|
|
58
|
+
}
|
|
59
|
+
return micStream.current = yield navigator.mediaDevices.getUserMedia({
|
|
60
|
+
audio: !0
|
|
61
|
+
}), micTrack.current = getMicTrack(), micTrack.current.enabled = !mutedRef.current,
|
|
62
|
+
micStream.current;
|
|
63
|
+
} finally {
|
|
64
|
+
setIsRequesting(!1);
|
|
65
|
+
}
|
|
66
|
+
}), [ constraints, getMicTrack, hasMediaSupport, stopMicStream, waitForPaint, waitForTrackToBecomeActive ]), refreshMicrophones = React.useCallback(() => tslib_es6.__awaiter(this, void 0, void 0, function*() {
|
|
67
|
+
if (!hasMediaSupport) return [];
|
|
68
|
+
try {
|
|
69
|
+
const devices = yield navigator.mediaDevices.enumerateDevices(), mics = devices.filter(device => "audioinput" === device.kind);
|
|
70
|
+
return setMicrophones(mics), devices.filter(device => "audioinput" === device.kind);
|
|
71
|
+
} catch (error) {
|
|
72
|
+
return console.warn("Error getting microphone devices:", error), setMicrophones([]),
|
|
73
|
+
[];
|
|
74
|
+
}
|
|
75
|
+
}), [ hasMediaSupport ]), setMicrophone = React.useCallback(deviceId => tslib_es6.__awaiter(this, void 0, void 0, function*() {
|
|
76
|
+
setIsRequesting(!0), yield waitForPaint();
|
|
77
|
+
try {
|
|
78
|
+
if (!deviceId) return;
|
|
79
|
+
setError(null), stopMicStream(), micStream.current = yield navigator.mediaDevices.getUserMedia(constraints(deviceId)),
|
|
80
|
+
micTrack.current = getMicTrack(), micTrack.current.enabled = !mutedRef.current,
|
|
81
|
+
mutedRef.current || (yield waitForTrackToBecomeActive(micTrack.current));
|
|
82
|
+
} catch (err) {
|
|
83
|
+
setError(err instanceof Error ? err : new Error("Error switching microphone")),
|
|
84
|
+
console.warn("Error switching microphone:", err);
|
|
85
|
+
} finally {
|
|
86
|
+
setIsRequesting(!1);
|
|
87
|
+
}
|
|
88
|
+
}), [ constraints, getMicTrack, stopMicStream, waitForPaint, waitForTrackToBecomeActive ]), toggleMute = React.useCallback(() => {
|
|
89
|
+
try {
|
|
90
|
+
muted ? unmuteMic() : muteMic();
|
|
91
|
+
} catch (error) {
|
|
92
|
+
return void console.warn("Error toggling microphone mute:", error);
|
|
93
|
+
}
|
|
94
|
+
}, [ muted, unmuteMic, muteMic ]);
|
|
95
|
+
return React.useEffect(() => {
|
|
96
|
+
if (mountedRef.current = !0, hasMediaSupport && !initializedRef.current) return initializedRef.current = !0,
|
|
97
|
+
requestMicrophone().then(() => {
|
|
98
|
+
startMuted && muteMic();
|
|
99
|
+
}).catch(err => {
|
|
100
|
+
console.error("Error accessing microphone:", err);
|
|
101
|
+
}), () => {
|
|
102
|
+
mountedRef.current = !1, stopMicStream();
|
|
103
|
+
};
|
|
104
|
+
}, [ hasMediaSupport, requestMicrophone, startMuted, muteMic, stopMicStream ]),
|
|
105
|
+
React.useEffect(() => {
|
|
106
|
+
var _a;
|
|
107
|
+
if (!hasMediaSupport || !(null === (_a = navigator.mediaDevices) || void 0 === _a ? void 0 : _a.addEventListener)) return;
|
|
108
|
+
refreshMicrophones();
|
|
109
|
+
const handleDeviceChange = () => {
|
|
110
|
+
refreshMicrophones();
|
|
111
|
+
};
|
|
112
|
+
return navigator.mediaDevices.addEventListener("devicechange", handleDeviceChange),
|
|
113
|
+
() => {
|
|
114
|
+
navigator.mediaDevices.removeEventListener("devicechange", handleDeviceChange);
|
|
115
|
+
};
|
|
116
|
+
}, [ hasMediaSupport, refreshMicrophones ]), {
|
|
117
|
+
micStream: micStream,
|
|
118
|
+
micTrack: micTrack,
|
|
119
|
+
muted: muted,
|
|
120
|
+
isSupported: hasMediaSupport,
|
|
121
|
+
isRequesting: isRequesting,
|
|
122
|
+
error: error,
|
|
123
|
+
microphones: microphones,
|
|
124
|
+
requestMicrophone: requestMicrophone,
|
|
125
|
+
stopMicrophone: stopMicStream,
|
|
126
|
+
muteMic: muteMic,
|
|
127
|
+
unmuteMic: unmuteMic,
|
|
128
|
+
toggleMute: toggleMute,
|
|
129
|
+
refreshMicrophones: refreshMicrophones,
|
|
130
|
+
setMicrophone: setMicrophone
|
|
131
|
+
};
|
|
132
|
+
};
|
package/dist/cjs/hooks.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var hooks_useTheme = require("./hooks/useTheme.js"), hooks_useObserveTheme = require("./hooks/useObserveTheme.js"), hooks_useDoubleClick = require("./hooks/useDoubleClick.js"), hooks_useToolTip = require("./hooks/useToolTip.js"), hooks_useKeyboardShortcuts = require("./hooks/useKeyboardShortcuts.js"), hooks_useLastUpdated = require("./hooks/useLastUpdated.js"), hooks_useLocalStore = require("./hooks/useLocalStore.js"), hooks_useWindow = require("./hooks/useWindow.js"), hooks_useObserveResize = require("./hooks/useObserveResize.js");
|
|
3
|
+
var hooks_useTheme = require("./hooks/useTheme.js"), hooks_useObserveTheme = require("./hooks/useObserveTheme.js"), hooks_useDoubleClick = require("./hooks/useDoubleClick.js"), hooks_useToolTip = require("./hooks/useToolTip.js"), hooks_useKeyboardShortcuts = require("./hooks/useKeyboardShortcuts.js"), hooks_useLastUpdated = require("./hooks/useLastUpdated.js"), hooks_useLocalStore = require("./hooks/useLocalStore.js"), hooks_useMdStreamBuffer = require("./hooks/useMdStreamBuffer.js"), hooks_useMicrophone = require("./hooks/useMicrophone.js"), hooks_useAudioRecorder = require("./hooks/useAudioRecorder.js"), hooks_useWindow = require("./hooks/useWindow.js"), hooks_useObserveResize = require("./hooks/useObserveResize.js");
|
|
4
4
|
|
|
5
5
|
require("react"), require("./theme/themes.js"), require("./theme/colors.js"), require("./theme/corners.js"),
|
|
6
6
|
require("./theme/elevations.js"), require("./theme/motion.js"), require("./theme/type.js"),
|
|
7
|
+
require("./chunks/tslib.es6-C8dZW5nY.js"), require("./chunks/MdStreamBuffer-DObxjnAm.js"),
|
|
7
8
|
exports.useTheme = hooks_useTheme.useTheme, exports.useObserveTheme = hooks_useObserveTheme.useObserveTheme,
|
|
8
9
|
exports.useDoubleClick = hooks_useDoubleClick.useDoubleClick, exports.useToolTip = hooks_useToolTip.useToolTip,
|
|
9
10
|
exports.useKeyboardShortcuts = hooks_useKeyboardShortcuts.useKeyboardShortcuts,
|
|
10
11
|
exports.useLastUpdated = hooks_useLastUpdated.useLastUpdated, exports.useLocalStore = hooks_useLocalStore.useLocalStore,
|
|
11
|
-
|
|
12
|
+
exports.useMDStreamBuffer = hooks_useMdStreamBuffer.useMDStreamBuffer, exports.useMicrophone = hooks_useMicrophone.useMicrophone,
|
|
13
|
+
exports.useAudioRecorder = hooks_useAudioRecorder.useAudioRecorder, Object.defineProperty(exports, "FormFactor", {
|
|
12
14
|
enumerable: !0,
|
|
13
15
|
get: function() {
|
|
14
16
|
return hooks_useWindow.FormFactor;
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var sharedTypes = require("./chunks/sharedTypes-gCECyn2N.js"), theme_themes = require("./theme/themes.js"), theme_colors = require("./theme/colors.js"), theme_elevations = require("./theme/elevations.js"), theme_motion = require("./theme/motion.js"), hooks_useTheme = require("./hooks/useTheme.js"), hooks_useObserveTheme = require("./hooks/useObserveTheme.js"), hooks_useDoubleClick = require("./hooks/useDoubleClick.js"), hooks_useToolTip = require("./hooks/useToolTip.js"), hooks_useKeyboardShortcuts = require("./hooks/useKeyboardShortcuts.js"), hooks_useLastUpdated = require("./hooks/useLastUpdated.js"), hooks_useLocalStore = require("./hooks/useLocalStore.js"), hooks_useWindow = require("./hooks/useWindow.js"), hooks_useObserveResize = require("./hooks/useObserveResize.js"), Avatar = require("./chunks/Avatar-CUaQ3kN1.js"), AvatarGroup = require("./chunks/AvatarGroup-B3M7o4Hh.js"), Badge = require("./chunks/Badge-CY_DG6cD.js"), IconButton = require("./chunks/IconButton-
|
|
3
|
+
var sharedTypes = require("./chunks/sharedTypes-gCECyn2N.js"), theme_themes = require("./theme/themes.js"), theme_colors = require("./theme/colors.js"), theme_elevations = require("./theme/elevations.js"), theme_motion = require("./theme/motion.js"), hooks_useTheme = require("./hooks/useTheme.js"), hooks_useObserveTheme = require("./hooks/useObserveTheme.js"), hooks_useDoubleClick = require("./hooks/useDoubleClick.js"), hooks_useToolTip = require("./hooks/useToolTip.js"), hooks_useKeyboardShortcuts = require("./hooks/useKeyboardShortcuts.js"), hooks_useLastUpdated = require("./hooks/useLastUpdated.js"), hooks_useLocalStore = require("./hooks/useLocalStore.js"), hooks_useMdStreamBuffer = require("./hooks/useMdStreamBuffer.js"), hooks_useMicrophone = require("./hooks/useMicrophone.js"), hooks_useAudioRecorder = require("./hooks/useAudioRecorder.js"), hooks_useWindow = require("./hooks/useWindow.js"), hooks_useObserveResize = require("./hooks/useObserveResize.js"), AudioBubble = require("./chunks/AudioBubble-v4xKclI8.js"), Avatar = require("./chunks/Avatar-CUaQ3kN1.js"), AvatarGroup = require("./chunks/AvatarGroup-B3M7o4Hh.js"), Badge = require("./chunks/Badge-CY_DG6cD.js"), IconButton = require("./chunks/IconButton-BUw3YUsI.js"), Camera = require("./chunks/Camera-CLm3aQR8.js"), CheckBox = require("./chunks/CheckBox-DDINn56u.js"), DivInput = require("./chunks/DivInput-DO3Dgbjp.js"), Dot = require("./chunks/Dot-_HCJ3qxd.js"), DrggablePanel = require("./chunks/DrggablePanel-CERavfv3.js"), DropDown = require("./chunks/DropDown-CJH-Y6Z5.js"), ErrorSummary = require("./chunks/ErrorSummary-BfVHS893.js"), Grouper = require("./chunks/Grouper-RYRxazG9.js"), Overlay = require("./chunks/Overlay-BX6vXX9F.js"), _types = require("./chunks/_types-Sa2RAJ2U.js"), Pager = require("./chunks/Pager-BN37VYEC.js"), PromptInput = require("./chunks/PromptInput-D1wP5-uN.js"), ProgressIndicator = require("./chunks/ProgressIndicator-8QZwTSyY.js"), RadioButton = require("./chunks/RadioButton-Cvqum7dU.js"), RadioButtonList = require("./chunks/RadioButtonList-CPHTioGa.js"), Slider = require("./chunks/Slider-CnXBacf-.js"), Spacer = require("./chunks/Spacer-CtxV2Pww.js"), Switch = require("./chunks/Switch-Cbn0ql3B.js"), TabBar = require("./chunks/TabBar-CnD3E-qa.js"), TextArea = require("./chunks/TextArea-rWqDDui3.js"), TextField = require("./chunks/TextField-C6U-qhDt.js"), providers_ThemeProvider = require("./providers/ThemeProvider.js"), Tip = require("./chunks/Tip-DAxoyMyA.js"), Toast = require("./chunks/Toast-D2fpwdjF.js"), Button = require("./chunks/Button-DmWbooXb.js"), Chip = require("./chunks/Chip-DRSg6kLh.js"), FileIcon = require("./chunks/FileIcon-xoD-xIme.js"), Icon = require("./chunks/Icon-BB-t50Yt.js"), _types$1 = require("./chunks/_types-BD6txsj1.js"), ButtonBar = require("./chunks/ButtonBar-RSBwFaU-.js"), Label = require("./chunks/Label-NzMpkZo2.js"), UploadArea = require("./chunks/UploadArea-BS2BPuhZ.js");
|
|
4
4
|
|
|
5
5
|
require("./theme/corners.js"), require("./theme/type.js"), require("react"), require("./chunks/tslib.es6-C8dZW5nY.js"),
|
|
6
|
-
require("
|
|
7
|
-
require("
|
|
6
|
+
require("./chunks/MdStreamBuffer-DObxjnAm.js"), require("react/jsx-runtime"), require("./chunks/colors-njquvHkx.js"),
|
|
7
|
+
require("./chunks/audioVisualizer-EIfIjWH7.js"), require("./chunks/style-inject.es-CMuL-BfJ.js"),
|
|
8
|
+
require("./chunks/misc-BTF7BCZW.js"), require("motion/react"), require("./chunks/FileList-DjTXjXnK.js"),
|
|
8
9
|
require("./chunks/debounce-BF4i6uIC.js"), Object.defineProperty(exports, "ToolTipType", {
|
|
9
10
|
enumerable: !0,
|
|
10
11
|
get: function() {
|
|
@@ -17,7 +18,9 @@ exports.useTheme = hooks_useTheme.useTheme, exports.useObserveTheme = hooks_useO
|
|
|
17
18
|
exports.useDoubleClick = hooks_useDoubleClick.useDoubleClick, exports.useToolTip = hooks_useToolTip.useToolTip,
|
|
18
19
|
exports.useKeyboardShortcuts = hooks_useKeyboardShortcuts.useKeyboardShortcuts,
|
|
19
20
|
exports.useLastUpdated = hooks_useLastUpdated.useLastUpdated, exports.useLocalStore = hooks_useLocalStore.useLocalStore,
|
|
20
|
-
exports.
|
|
21
|
+
exports.useMDStreamBuffer = hooks_useMdStreamBuffer.useMDStreamBuffer, exports.useMicrophone = hooks_useMicrophone.useMicrophone,
|
|
22
|
+
exports.useAudioRecorder = hooks_useAudioRecorder.useAudioRecorder, exports.useWindow = hooks_useWindow.useWindow,
|
|
23
|
+
exports.useObserveResize = hooks_useObserveResize.useObserveResize, exports.AudioBubble = AudioBubble.AudioBubble,
|
|
21
24
|
exports.Avatar = Avatar.Avatar, exports.AvatarGroup = AvatarGroup.AvatarGroup, exports.Badge = Badge.Badge,
|
|
22
25
|
exports.IconButton = IconButton.IconButton, exports.Camera = Camera.Camera, exports.CheckBox = CheckBox.CheckBox,
|
|
23
26
|
exports.DivInput = DivInput.DivInput, exports.Dot = Dot.Dot, exports.DraggablePanel = DrggablePanel.DraggablePanel,
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var misc = require("../chunks/misc-BTF7BCZW.js"), debounce = require("../chunks/debounce-BF4i6uIC.js"), colors = require("../chunks/colors-njquvHkx.js"), IndexedDB = require("../chunks/IndexedDB-BaVmQgkK.js"), SSEConnection = require("../chunks/SSEConnection-C-1OzEOp.js"), WSConnection = require("../chunks/WSConnection-DrOC8Z0R.js");
|
|
3
|
+
var misc = require("../chunks/misc-BTF7BCZW.js"), debounce = require("../chunks/debounce-BF4i6uIC.js"), colors = require("../chunks/colors-njquvHkx.js"), IndexedDB = require("../chunks/IndexedDB-BaVmQgkK.js"), audioVisualizer = require("../chunks/audioVisualizer-EIfIjWH7.js"), MdStreamBuffer = require("../chunks/MdStreamBuffer-DObxjnAm.js"), SSEConnection = require("../chunks/SSEConnection-C-1OzEOp.js"), WSConnection = require("../chunks/WSConnection-DrOC8Z0R.js");
|
|
4
4
|
|
|
5
5
|
require("../chunks/tslib.es6-C8dZW5nY.js"), exports.copyToClipboard = misc.copyToClipboard,
|
|
6
6
|
exports.hexToRgb = misc.hexToRgb, exports.debounce = debounce.debounce, exports.addOpacity = colors.addOpacity,
|
|
7
7
|
exports.tintFromColor = colors.tintFromColor, exports.IndexedDB = IndexedDB.IndexedDB,
|
|
8
|
+
exports.AudioVisualizer = audioVisualizer.AudioVisualizer, exports.MdBuffer = MdStreamBuffer.MdBuffer,
|
|
8
9
|
exports.SSEConnection = SSEConnection.SSEConnection, exports.WSConnection = WSConnection.WSConnection;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var IndexedDB = require("../../chunks/IndexedDB-BaVmQgkK.js"), SSEConnection = require("../../chunks/SSEConnection-C-1OzEOp.js"), WSConnection = require("../../chunks/WSConnection-DrOC8Z0R.js");
|
|
3
|
+
var IndexedDB = require("../../chunks/IndexedDB-BaVmQgkK.js"), audioVisualizer = require("../../chunks/audioVisualizer-EIfIjWH7.js"), MdStreamBuffer = require("../../chunks/MdStreamBuffer-DObxjnAm.js"), SSEConnection = require("../../chunks/SSEConnection-C-1OzEOp.js"), WSConnection = require("../../chunks/WSConnection-DrOC8Z0R.js");
|
|
4
4
|
|
|
5
5
|
require("../../chunks/tslib.es6-C8dZW5nY.js"), exports.IndexedDB = IndexedDB.IndexedDB,
|
|
6
|
+
exports.AudioVisualizer = audioVisualizer.AudioVisualizer, exports.MdBuffer = MdStreamBuffer.MdBuffer,
|
|
6
7
|
exports.SSEConnection = SSEConnection.SSEConnection, exports.WSConnection = WSConnection.WSConnection;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { a as __rest } from "./tslib.es6-C-olHjXV.mjs";
|
|
2
|
+
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
import React, { useRef, useState, useMemo, useEffect } from "react";
|
|
6
|
+
|
|
7
|
+
import { useTheme } from "../hooks/useTheme.mjs";
|
|
8
|
+
|
|
9
|
+
import "../theme/colors.mjs";
|
|
10
|
+
|
|
11
|
+
import { a as addOpacity } from "./colors-FQ0uNQcW.mjs";
|
|
12
|
+
|
|
13
|
+
import { A as AudioVisualizer } from "./audioVisualizer-ZgT77nUw.mjs";
|
|
14
|
+
|
|
15
|
+
import "../hooks/useWindow.mjs";
|
|
16
|
+
|
|
17
|
+
import { s as styleInject } from "./style-inject.es-D0BjEaN8.mjs";
|
|
18
|
+
|
|
19
|
+
var css_wrapper = "AudioBubble-module_wrapper__f2yKg flexBox-module_row__z24tF", css_bubble = "AudioBubble-module_bubble__bpPT3 flexBox-module_row__z24tF";
|
|
20
|
+
|
|
21
|
+
styleInject(".flexBox-module_row__z24tF {\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowBetween__5FEvi {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowStart__4tcxS {\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowEnd__rVdVm {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_column__ezvMq {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStart__C7P44 {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: flex-start;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStartCenter__PKcrG {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnBetween__ERfp7 {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnEnd__lLJuc {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-end;\n\talign-items: flex-end;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}\n\n.AudioBubble-module_wrapper__f2yKg {\n\tmin-height: var(--ab-size);\n\tmin-width: var(--ab-size);\n\theight: var(--ab-size);\n\twidth: var(--ab-size);\n\toverflow: visible;\n}\n\n.AudioBubble-module_bubble__bpPT3 {\n\tmin-height: var(--ab-size);\n\tmin-width: var(--ab-size);\n\theight: var(--ab-size);\n\twidth: var(--ab-size);\n\tborder-radius: 100%;\n\tbackground: var(--ab-bg-color);\n\tbox-shadow: var(--ab-box-shadow);\n\ttransition: transform 40ms linear 0s;\n}\n");
|
|
22
|
+
|
|
23
|
+
const AudioBubble = React.memo(props => {
|
|
24
|
+
const lightColor = useTheme().current.colors["core-text-light"], {audioStream: audioStream, playing: playing = !1, size: size = 64, backgroundColor: backgroundColor = lightColor, glow: glow = !0, glowColor: glowColor = addOpacity(lightColor, .1), glowSize: glowSize = 48, glowOffset: glowOffset = 18, minScale: minScale = 1, maxScale: maxScale = 3, intensity: intensity = 2.2, peakIntensity: peakIntensity = .5, risePerSeconds: risePerSeconds = 4, ReleasePerSeconds: ReleasePerSeconds = 1.5} = props, divAttributes = __rest(props, [ "audioStream", "playing", "size", "backgroundColor", "glow", "glowColor", "glowSize", "glowOffset", "minScale", "maxScale", "intensity", "peakIntensity", "risePerSeconds", "ReleasePerSeconds" ]), {id: divId, className: className, style: style} = divAttributes, rest = __rest(divAttributes, [ "id", "className", "style" ]), divStyle = null != style ? style : {}, divClass = className ? ` ${className}` : "", visualizerRef = useRef(null), [scale, setScale] = useState(minScale), visualizerSettings = useMemo(() => ({
|
|
25
|
+
minScale: minScale,
|
|
26
|
+
maxScale: maxScale,
|
|
27
|
+
intensityMultiplier: intensity,
|
|
28
|
+
peakIntensity: peakIntensity,
|
|
29
|
+
risePerSecond: risePerSeconds,
|
|
30
|
+
releasePerSecond: ReleasePerSeconds,
|
|
31
|
+
onUpdate: ({scale: nextScale}) => setScale(nextScale)
|
|
32
|
+
}), [ minScale, maxScale, intensity, peakIntensity, risePerSeconds, ReleasePerSeconds ]), setGlow = useMemo(() => glow ? `0 ${glowOffset}px ${glowSize}px ${glowColor}` : "unset", [ glow, glowColor, glowSize, glowOffset ]), cssVars = useMemo(() => ({
|
|
33
|
+
"--ab-size": `${size}px`,
|
|
34
|
+
"--ab-bg-color": backgroundColor,
|
|
35
|
+
"--ab-box-shadow": setGlow
|
|
36
|
+
}), [ size, backgroundColor, setGlow ]);
|
|
37
|
+
return useEffect(() => {
|
|
38
|
+
var _a;
|
|
39
|
+
if (null === (_a = visualizerRef.current) || void 0 === _a || _a.dispose(), visualizerRef.current = null,
|
|
40
|
+
!audioStream) return void setScale(minScale);
|
|
41
|
+
const visualizer = new AudioVisualizer(audioStream, visualizerSettings);
|
|
42
|
+
return visualizerRef.current = visualizer, playing && visualizer.start(), () => {
|
|
43
|
+
visualizer.dispose(), visualizerRef.current === visualizer && (visualizerRef.current = null);
|
|
44
|
+
};
|
|
45
|
+
}, [ audioStream, minScale, playing, visualizerSettings ]), useEffect(() => {
|
|
46
|
+
visualizerRef.current && (playing ? visualizerRef.current.start() : (visualizerRef.current.stop(),
|
|
47
|
+
setScale(minScale)));
|
|
48
|
+
}, [ minScale, playing ]), jsx("div", Object.assign({
|
|
49
|
+
id: divId,
|
|
50
|
+
className: `${css_wrapper}${divClass}`,
|
|
51
|
+
style: divStyle
|
|
52
|
+
}, rest, {
|
|
53
|
+
children: jsx("div", {
|
|
54
|
+
className: css_bubble,
|
|
55
|
+
style: Object.assign(Object.assign({}, cssVars), {
|
|
56
|
+
transform: `scale(${scale})`
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
}));
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export { AudioBubble as A };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as __rest } from "./tslib.es6-C-olHjXV.mjs";
|
|
2
2
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
import React, { useRef, useState, useMemo, useEffect, useCallback } from "react";
|
|
6
6
|
|
|
7
|
-
import { n as normalizedPercent, a as accessibleKeyDown, s as setStyle } from "./misc-
|
|
7
|
+
import { n as normalizedPercent, a as accessibleKeyDown, s as setStyle } from "./misc-BeEWwOaJ.mjs";
|
|
8
8
|
|
|
9
9
|
import { s as styleInject } from "./style-inject.es-D0BjEaN8.mjs";
|
|
10
10
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as __rest } from "./tslib.es6-C-olHjXV.mjs";
|
|
2
2
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
import React, { useMemo } from "react";
|
|
6
6
|
|
|
7
|
-
import { A as Avatar } from "./Avatar-
|
|
7
|
+
import { A as Avatar } from "./Avatar-C8uV7ROZ.mjs";
|
|
8
8
|
|
|
9
9
|
import { s as styleInject } from "./style-inject.es-D0BjEaN8.mjs";
|
|
10
10
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as __rest } from "./tslib.es6-C-olHjXV.mjs";
|
|
2
2
|
|
|
3
3
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
@@ -6,13 +6,13 @@ import { motion } from "motion/react";
|
|
|
6
6
|
|
|
7
7
|
import React, { forwardRef, useState, useRef, useCallback, useEffect, useImperativeHandle, useMemo } from "react";
|
|
8
8
|
|
|
9
|
-
import { B as Badge } from "./Badge-
|
|
9
|
+
import { B as Badge } from "./Badge-D-U1jomY.mjs";
|
|
10
10
|
|
|
11
|
-
import { D as Dot } from "./Dot-
|
|
11
|
+
import { D as Dot } from "./Dot-Cj6gWj4_.mjs";
|
|
12
12
|
|
|
13
|
-
import { I as Icon } from "./Icon-
|
|
13
|
+
import { I as Icon } from "./Icon-KDwlMXzH.mjs";
|
|
14
14
|
|
|
15
|
-
import { P as ProgressIndicator } from "./ProgressIndicator-
|
|
15
|
+
import { P as ProgressIndicator } from "./ProgressIndicator-CxsZm_As.mjs";
|
|
16
16
|
|
|
17
17
|
import { T as ToolTipType } from "./sharedTypes-tn9-uJvb.mjs";
|
|
18
18
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as __rest } from "./tslib.es6-C-olHjXV.mjs";
|
|
2
2
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
import React, { useState, useEffect, useCallback, useMemo, useRef } from "react";
|
|
6
6
|
|
|
7
|
-
import { s as setStyle } from "./misc-
|
|
7
|
+
import { s as setStyle } from "./misc-BeEWwOaJ.mjs";
|
|
8
8
|
|
|
9
|
-
import { I as Icon } from "./Icon-
|
|
9
|
+
import { I as Icon } from "./Icon-KDwlMXzH.mjs";
|
|
10
10
|
|
|
11
11
|
import { s as styleInject } from "./style-inject.es-D0BjEaN8.mjs";
|
|
12
12
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as __awaiter } from "./tslib.es6-C-olHjXV.mjs";
|
|
2
2
|
|
|
3
3
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
@@ -8,15 +8,15 @@ import { useTheme } from "../hooks/useTheme.mjs";
|
|
|
8
8
|
|
|
9
9
|
import "../theme/colors.mjs";
|
|
10
10
|
|
|
11
|
-
import "
|
|
12
|
-
|
|
13
|
-
import { a as accessibleKeyDown } from "./misc-N8KLjOXc.mjs";
|
|
11
|
+
import { a as accessibleKeyDown } from "./misc-BeEWwOaJ.mjs";
|
|
14
12
|
|
|
15
13
|
import { a as addOpacity } from "./colors-FQ0uNQcW.mjs";
|
|
16
14
|
|
|
17
|
-
import
|
|
15
|
+
import "../hooks/useWindow.mjs";
|
|
16
|
+
|
|
17
|
+
import { A as Avatar } from "./Avatar-C8uV7ROZ.mjs";
|
|
18
18
|
|
|
19
|
-
import { I as Icon } from "./Icon-
|
|
19
|
+
import { I as Icon } from "./Icon-KDwlMXzH.mjs";
|
|
20
20
|
|
|
21
21
|
import { s as styleInject } from "./style-inject.es-D0BjEaN8.mjs";
|
|
22
22
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as __rest } from "./tslib.es6-C-olHjXV.mjs";
|
|
2
2
|
|
|
3
3
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
@@ -6,9 +6,9 @@ import { motion } from "motion/react";
|
|
|
6
6
|
|
|
7
7
|
import React, { useState, useEffect, useMemo, useCallback } from "react";
|
|
8
8
|
|
|
9
|
-
import { a as accessibleKeyDown } from "./misc-
|
|
9
|
+
import { a as accessibleKeyDown } from "./misc-BeEWwOaJ.mjs";
|
|
10
10
|
|
|
11
|
-
import { I as Icon } from "./Icon-
|
|
11
|
+
import { I as Icon } from "./Icon-KDwlMXzH.mjs";
|
|
12
12
|
|
|
13
13
|
import { s as styleInject } from "./style-inject.es-D0BjEaN8.mjs";
|
|
14
14
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as __rest } from "./tslib.es6-C-olHjXV.mjs";
|
|
2
2
|
|
|
3
3
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
import React, { useState, useCallback, useMemo } from "react";
|
|
6
6
|
|
|
7
|
-
import { s as setStyle, a as accessibleKeyDown } from "./misc-
|
|
7
|
+
import { s as setStyle, a as accessibleKeyDown } from "./misc-BeEWwOaJ.mjs";
|
|
8
8
|
|
|
9
|
-
import { I as Icon } from "./Icon-
|
|
9
|
+
import { I as Icon } from "./Icon-KDwlMXzH.mjs";
|
|
10
10
|
|
|
11
11
|
import { T as ToolTipType } from "./sharedTypes-tn9-uJvb.mjs";
|
|
12
12
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as __rest } from "./tslib.es6-C-olHjXV.mjs";
|
|
2
2
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ import { motion } from "motion/react";
|
|
|
6
6
|
|
|
7
7
|
import React, { useRef, useState, useCallback, useEffect, useMemo } from "react";
|
|
8
8
|
|
|
9
|
-
import { b as cleanString } from "./misc-
|
|
9
|
+
import { b as cleanString } from "./misc-BeEWwOaJ.mjs";
|
|
10
10
|
|
|
11
11
|
import { s as styleInject } from "./style-inject.es-D0BjEaN8.mjs";
|
|
12
12
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as __rest } from "./tslib.es6-C-olHjXV.mjs";
|
|
2
2
|
|
|
3
3
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
4
4
|
|
|
@@ -8,12 +8,12 @@ import { useTheme } from "../hooks/useTheme.mjs";
|
|
|
8
8
|
|
|
9
9
|
import "../theme/colors.mjs";
|
|
10
10
|
|
|
11
|
+
import { p as pointerPosition } from "./misc-BeEWwOaJ.mjs";
|
|
12
|
+
|
|
11
13
|
import "../hooks/useWindow.mjs";
|
|
12
14
|
|
|
13
15
|
import { useObserveResize } from "../hooks/useObserveResize.mjs";
|
|
14
16
|
|
|
15
|
-
import { p as pointerPosition } from "./misc-N8KLjOXc.mjs";
|
|
16
|
-
|
|
17
17
|
import { s as styleInject } from "./style-inject.es-D0BjEaN8.mjs";
|
|
18
18
|
|
|
19
19
|
var css_panel = "DraggablePanel-module_panel__vuq2R flexBox-module_columnStart__C7P44", css_content = "DraggablePanel-module_content__SBL0T flexBox-module_columnStart__C7P44", css_handle = "DraggablePanel-module_handle__LPZw8";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as __rest } from "./tslib.es6-C-olHjXV.mjs";
|
|
2
2
|
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
import React, { useState, useRef, useEffect, useCallback, useMemo } from "react";
|
|
6
6
|
|
|
7
|
-
import { s as setStyle } from "./misc-
|
|
7
|
+
import { s as setStyle } from "./misc-BeEWwOaJ.mjs";
|
|
8
8
|
|
|
9
|
-
import { I as Icon } from "./Icon-
|
|
9
|
+
import { I as Icon } from "./Icon-KDwlMXzH.mjs";
|
|
10
10
|
|
|
11
11
|
import { s as styleInject } from "./style-inject.es-D0BjEaN8.mjs";
|
|
12
12
|
|