@exode-team/react-recorder 1.1.2 → 1.1.5
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/components/AudioRecorder.d.ts +2 -3
- package/dist/components/AudioRecorder.d.ts.map +1 -1
- package/dist/components/AudioRecorder.styled.d.ts.map +1 -1
- package/dist/components/RecordingShell/RecordingShell.d.ts.map +1 -1
- package/dist/components/RecordingShell/RecordingShell.styled.d.ts.map +1 -1
- package/dist/components/VoiceMessagePlayer/VoiceMessagePlayer.d.ts.map +1 -1
- package/dist/components/VoiceRecorderInput/PreviewBars.d.ts +1 -1
- package/dist/components/VoiceRecorderInput/PreviewBars.d.ts.map +1 -1
- package/dist/components/VoiceRecorderInput/TimelineBars.d.ts +1 -1
- package/dist/components/VoiceRecorderInput/TimelineBars.d.ts.map +1 -1
- package/dist/components/VoiceRecorderInput/VoiceRecorderInput.d.ts +1 -2
- package/dist/components/VoiceRecorderInput/VoiceRecorderInput.d.ts.map +1 -1
- package/dist/components/VoiceRecorderInput/VoiceRecorderInput.styled.d.ts.map +1 -1
- package/dist/hooks/useAudioBlobLoader.d.ts.map +1 -1
- package/dist/hooks/useRecordingSender.d.ts +1 -2
- package/dist/hooks/useRecordingSender.d.ts.map +1 -1
- package/dist/hooks/useVoiceRecorder.d.ts.map +1 -1
- package/dist/hooks/useVoiceRecorderInput.d.ts +1 -2
- package/dist/hooks/useVoiceRecorderInput.d.ts.map +1 -1
- package/dist/index.cjs +84 -65
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +87 -67
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +1 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/recorder.d.ts +1 -2
- package/dist/types/recorder.d.ts.map +1 -1
- package/dist/types/upload.d.ts +0 -7
- package/dist/types/upload.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -4,14 +4,13 @@
|
|
|
4
4
|
* @author: exode <hello@exode.ru>
|
|
5
5
|
*/
|
|
6
6
|
import { type RecorderMessagesInput } from './AudioRecorder.messages';
|
|
7
|
-
import { type StorageFileEntity, type
|
|
8
|
-
type RecorderOptionOverrides = Omit<UseVoiceRecorderOptions<Partial<StorageFileEntity>>, '
|
|
7
|
+
import { type StorageFileEntity, type UploadStrategy, type UseVoiceRecorderOptions } from '../types';
|
|
8
|
+
type RecorderOptionOverrides = Omit<UseVoiceRecorderOptions<Partial<StorageFileEntity>>, 'uploadId' | 'onUploaded' | 'uploader'>;
|
|
9
9
|
interface Props extends Partial<RecorderOptionOverrides> {
|
|
10
10
|
uploader: UploadStrategy<Partial<StorageFileEntity>>;
|
|
11
11
|
messages?: RecorderMessagesInput;
|
|
12
12
|
uploadId?: string;
|
|
13
13
|
className?: string;
|
|
14
|
-
space?: StorageSpace;
|
|
15
14
|
onUploadError?: (error: unknown) => void;
|
|
16
15
|
onUploaded?: (file: Partial<StorageFileEntity>) => void | Promise<void>;
|
|
17
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AudioRecorder.d.ts","sourceRoot":"","sources":["../../src/components/AudioRecorder.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,OAAO,EAAiB,KAAK,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAErF,OAAO,EACH,KAAK,iBAAiB,EACtB,KAAK,
|
|
1
|
+
{"version":3,"file":"AudioRecorder.d.ts","sourceRoot":"","sources":["../../src/components/AudioRecorder.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,OAAO,EAAiB,KAAK,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAErF,OAAO,EACH,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC/B,MAAM,UAAU,CAAC;AAGlB,KAAK,uBAAuB,GAAG,IAAI,CAC/B,uBAAuB,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,EACnD,UAAU,GAAG,YAAY,GAAG,UAAU,CACzC,CAAC;AAEF,UAAU,KAAM,SAAQ,OAAO,CAAC,uBAAuB,CAAC;IACpD,QAAQ,EAAE,cAAc,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC;IACrD,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,iBAAiB,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3E;AAGD,QAAA,MAAM,aAAa,GAAI,OAAO,KAAK,QAsHlC,CAAC;AAGF,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AudioRecorder.styled.d.ts","sourceRoot":"","sources":["../../src/components/AudioRecorder.styled.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"AudioRecorder.styled.d.ts","sourceRoot":"","sources":["../../src/components/AudioRecorder.styled.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,eAAO,MAAM,SAAS,KAKrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecordingShell.d.ts","sourceRoot":"","sources":["../../../src/components/RecordingShell/RecordingShell.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"RecordingShell.d.ts","sourceRoot":"","sources":["../../../src/components/RecordingShell/RecordingShell.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AA2BH,UAAU,KAAK;IACX,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,uBAAuB,EAAE,MAAM,CAAC;IAChC,wBAAwB,EAAE,MAAM,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;CAC3C;AAGD,QAAA,MAAM,cAAc,GAAI,OAAO,KAAK,QA6HnC,CAAC;AAGF,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecordingShell.styled.d.ts","sourceRoot":"","sources":["../../../src/components/RecordingShell/RecordingShell.styled.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"RecordingShell.styled.d.ts","sourceRoot":"","sources":["../../../src/components/RecordingShell/RecordingShell.styled.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,eAAO,MAAM,OAAO,KAOnB,CAAC;AAEF,eAAO,MAAM,YAAY,KAqBxB,CAAC;AAEF,eAAO,MAAM,KAAK,KAQjB,CAAC;AAEF,eAAO,MAAM,YAAY,KA2CxB,CAAC;AAEF,eAAO,MAAM,QAAQ,KAOpB,CAAC;AAEF,eAAO,MAAM,IAAI,KAMhB,CAAC;AAEF,eAAO,MAAM,GAAG,KAOf,CAAC;AAEF,eAAO,MAAM,KAAK,KAKjB,CAAC;AAEF,eAAO,MAAM,UAAU,KAyBtB,CAAC;AAEF,eAAO,MAAM,WAAW,KAMvB,CAAC;AAEF,eAAO,MAAM,OAAO,KAoBnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VoiceMessagePlayer.d.ts","sourceRoot":"","sources":["../../../src/components/VoiceMessagePlayer/VoiceMessagePlayer.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AA0BH,MAAM,WAAW,qBAAqB;IAClC,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACxB;AAeD,QAAA,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"VoiceMessagePlayer.d.ts","sourceRoot":"","sources":["../../../src/components/VoiceMessagePlayer/VoiceMessagePlayer.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AA0BH,MAAM,WAAW,qBAAqB;IAClC,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACxB;AAeD,QAAA,MAAM,kBAAkB,KA8MtB,CAAC;AAGH,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -10,7 +10,7 @@ interface PreviewBarsProps {
|
|
|
10
10
|
recordingTime: number;
|
|
11
11
|
previewLevels: number[];
|
|
12
12
|
timelineLevels: number[];
|
|
13
|
-
|
|
13
|
+
visibleBarsCount: number;
|
|
14
14
|
}
|
|
15
15
|
declare const PreviewBars: (props: PreviewBarsProps) => any;
|
|
16
16
|
export { PreviewBars };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreviewBars.d.ts","sourceRoot":"","sources":["../../../src/components/VoiceRecorderInput/PreviewBars.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,UAAU,gBAAgB;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,
|
|
1
|
+
{"version":3,"file":"PreviewBars.d.ts","sourceRoot":"","sources":["../../../src/components/VoiceRecorderInput/PreviewBars.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,UAAU,gBAAgB;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;CAC5B;AAGD,QAAA,MAAM,WAAW,GAAI,OAAO,gBAAgB,QA0E3C,CAAC;AAGF,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimelineBars.d.ts","sourceRoot":"","sources":["../../../src/components/VoiceRecorderInput/TimelineBars.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,UAAU,iBAAiB;IACvB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,
|
|
1
|
+
{"version":3,"file":"TimelineBars.d.ts","sourceRoot":"","sources":["../../../src/components/VoiceRecorderInput/TimelineBars.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,UAAU,iBAAiB;IACvB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;CAC5B;AAGD,QAAA,MAAM,YAAY,GAAI,OAAO,iBAAiB,QAkC7C,CAAC;AAGF,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @author: exode <hello@exode.ru>
|
|
5
5
|
*/
|
|
6
|
-
import
|
|
6
|
+
import type { UploadStrategy } from '../../types';
|
|
7
7
|
interface Props {
|
|
8
8
|
uploader?: UploadStrategy<unknown>;
|
|
9
9
|
onUploaded?: (file: unknown) => void | Promise<void>;
|
|
@@ -14,7 +14,6 @@ interface Props {
|
|
|
14
14
|
autoStart?: boolean;
|
|
15
15
|
mimeType?: string;
|
|
16
16
|
fileName?: string;
|
|
17
|
-
space?: StorageSpace;
|
|
18
17
|
className?: string;
|
|
19
18
|
}
|
|
20
19
|
declare const VoiceRecorderInput: (props: Props) => any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VoiceRecorderInput.d.ts","sourceRoot":"","sources":["../../../src/components/VoiceRecorderInput/VoiceRecorderInput.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"VoiceRecorderInput.d.ts","sourceRoot":"","sources":["../../../src/components/VoiceRecorderInput/VoiceRecorderInput.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAuBlD,UAAU,KAAK;IACX,QAAQ,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IACnC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC9C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAGD,QAAA,MAAM,kBAAkB,GAAI,OAAO,KAAK,QAmIvC,CAAC;AAGF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VoiceRecorderInput.styled.d.ts","sourceRoot":"","sources":["../../../src/components/VoiceRecorderInput/VoiceRecorderInput.styled.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,eAAO,MAAM,OAAO,KAOnB,CAAC;AAEF,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"VoiceRecorderInput.styled.d.ts","sourceRoot":"","sources":["../../../src/components/VoiceRecorderInput/VoiceRecorderInput.styled.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,eAAO,MAAM,OAAO,KAOnB,CAAC;AAEF,eAAO,MAAM,YAAY,KAcxB,CAAC;AAEF,eAAO,MAAM,WAAW,KASvB,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,UAAU,KAMtB,CAAC;AAEF,eAAO,MAAM,UAAU,KA0BtB,CAAC;AAEF,eAAO,MAAM,YAAY,KAUxB,CAAC;AAEF,eAAO,MAAM,KAAK,KAMjB,CAAC;AAEF,eAAO,MAAM,UAAU,KAuBtB,CAAC;AAEF,eAAO,MAAM,YAAY,KAiBxB,CAAC;AAEF,eAAO,MAAM,eAAe,KAqB3B,CAAC;AAEF,eAAO,MAAM,WAAW,KAcvB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAudioBlobLoader.d.ts","sourceRoot":"","sources":["../../src/hooks/useAudioBlobLoader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAYrD,UAAU,yBAAyB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAC5B,iBAAiB,EAAE,iBAAiB,CAAC;CACxC;AAED,UAAU,wBAAwB;IAC9B,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IAC1D,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,iBAAiB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1C;AAED,QAAA,MAAM,kBAAkB,GAAI,SAAS,yBAAyB,KAAG,
|
|
1
|
+
{"version":3,"file":"useAudioBlobLoader.d.ts","sourceRoot":"","sources":["../../src/hooks/useAudioBlobLoader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAYrD,UAAU,yBAAyB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAC5B,iBAAiB,EAAE,iBAAiB,CAAC;CACxC;AAED,UAAU,wBAAwB;IAC9B,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IAC1D,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,iBAAiB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1C;AAED,QAAA,MAAM,kBAAkB,GAAI,SAAS,yBAAyB,KAAG,wBAoIhE,CAAC;AAGF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @author: exode <hello@exode.ru>
|
|
5
5
|
*/
|
|
6
|
-
import type {
|
|
6
|
+
import type { UploadStrategy } from '../types';
|
|
7
7
|
interface UseRecordingSenderOptions<TFile> {
|
|
8
8
|
fileName: string;
|
|
9
9
|
mimeType: string;
|
|
10
10
|
audioBlob: Blob | null;
|
|
11
|
-
space: StorageSpace;
|
|
12
11
|
uploadId: string;
|
|
13
12
|
uploader?: UploadStrategy<TFile>;
|
|
14
13
|
onUploaded: (file: TFile) => void | Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRecordingSender.d.ts","sourceRoot":"","sources":["../../src/hooks/useRecordingSender.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"useRecordingSender.d.ts","sourceRoot":"","sources":["../../src/hooks/useRecordingSender.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C,UAAU,yBAAyB,CAAC,KAAK;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;IACjC,UAAU,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC/C;AAGD,QAAA,MAAM,kBAAkB,GAAI,KAAK,GAAG,OAAO,EAAE,SAAS,yBAAyB,CAAC,KAAK,CAAC;;CA0DrF,CAAC;AAGF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useVoiceRecorder.d.ts","sourceRoot":"","sources":["../../src/hooks/useVoiceRecorder.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,OAAO,KAAK,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAGhF,iBAAS,gBAAgB,CAAC,KAAK,GAAG,OAAO,EAAE,KAAK,EAAE,uBAAuB,CAAC,KAAK,CAAC,GAAG,sBAAsB,
|
|
1
|
+
{"version":3,"file":"useVoiceRecorder.d.ts","sourceRoot":"","sources":["../../src/hooks/useVoiceRecorder.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,OAAO,KAAK,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAGhF,iBAAS,gBAAgB,CAAC,KAAK,GAAG,OAAO,EAAE,KAAK,EAAE,uBAAuB,CAAC,KAAK,CAAC,GAAG,sBAAsB,CAuMxG;AAGD,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @author: exode <hello@exode.ru>
|
|
5
5
|
*/
|
|
6
|
-
import
|
|
6
|
+
import type { UploadStrategy } from '../types';
|
|
7
7
|
interface UseVoiceRecorderInputOptions {
|
|
8
8
|
uploader?: UploadStrategy<unknown>;
|
|
9
9
|
onUploaded?: (file: unknown) => void | Promise<void>;
|
|
@@ -14,7 +14,6 @@ interface UseVoiceRecorderInputOptions {
|
|
|
14
14
|
autoStart?: boolean;
|
|
15
15
|
mimeType?: string;
|
|
16
16
|
fileName?: string;
|
|
17
|
-
space?: StorageSpace;
|
|
18
17
|
}
|
|
19
18
|
declare const useVoiceRecorderInput: (options: UseVoiceRecorderInputOptions) => {
|
|
20
19
|
recorder: import("../types").UseVoiceRecorderResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useVoiceRecorderInput.d.ts","sourceRoot":"","sources":["../../src/hooks/useVoiceRecorderInput.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,
|
|
1
|
+
{"version":3,"file":"useVoiceRecorderInput.d.ts","sourceRoot":"","sources":["../../src/hooks/useVoiceRecorderInput.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C,UAAU,4BAA4B;IAClC,QAAQ,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IACnC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC9C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAGD,QAAA,MAAM,qBAAqB,GAAI,SAAS,4BAA4B;;;;;;;;;;CA6MnE,CAAC;AAGF,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -587,7 +587,7 @@ const useRecorderVisualization = () => {
|
|
|
587
587
|
* @author: exode <hello@exode.ru>
|
|
588
588
|
*/
|
|
589
589
|
const useRecordingSender = (options) => {
|
|
590
|
-
const {
|
|
590
|
+
const { uploader, fileName, mimeType, uploadId, audioBlob, onUploaded, onRecordingError, deleteRecording, autoResetAfterUpload, } = options;
|
|
591
591
|
const sendRecording = React.useCallback(async () => {
|
|
592
592
|
if (!audioBlob) {
|
|
593
593
|
const error = new Error('Voice recording is not available');
|
|
@@ -603,7 +603,7 @@ const useRecordingSender = (options) => {
|
|
|
603
603
|
const file = new File([audioBlob], fileName, {
|
|
604
604
|
type: audioBlob.type || mimeType,
|
|
605
605
|
});
|
|
606
|
-
const uploaded = await uploader(file, {
|
|
606
|
+
const uploaded = await uploader(file, { uploadId });
|
|
607
607
|
await onUploaded(uploaded);
|
|
608
608
|
if (autoResetAfterUpload) {
|
|
609
609
|
deleteRecording();
|
|
@@ -614,7 +614,6 @@ const useRecordingSender = (options) => {
|
|
|
614
614
|
throw error;
|
|
615
615
|
}
|
|
616
616
|
}, [
|
|
617
|
-
space,
|
|
618
617
|
uploadId,
|
|
619
618
|
uploader,
|
|
620
619
|
fileName,
|
|
@@ -634,7 +633,7 @@ const useRecordingSender = (options) => {
|
|
|
634
633
|
* @author: exode <hello@exode.ru>
|
|
635
634
|
*/
|
|
636
635
|
function useVoiceRecorder(props) {
|
|
637
|
-
const {
|
|
636
|
+
const { uploadId, uploader, onUploaded, onRecordingStop, onRecordingStart, onRecordingError, onRecordingDelete, onPermissionDenied, fileName = 'record.webm', mimeType = 'audio/webm', autoResetAfterUpload = true, } = props;
|
|
638
637
|
const [audioBlob, setAudioBlob] = React.useState(null);
|
|
639
638
|
const { audioURL, isPlaying, mountBlob, playbackTime, stopPlayback, resetPlayback, togglePlayback: _togglePlayback, playbackDuration, } = useAudioPlayback();
|
|
640
639
|
const { audioLevels, previewLevels, resetAudioLevels, stopVisualization, resetPreviewLevels, resumeVisualization, cleanupVisualization, generatePreviewLevels, initializeVisualization, } = useRecorderVisualization();
|
|
@@ -664,7 +663,6 @@ function useVoiceRecorder(props) {
|
|
|
664
663
|
audioBlob,
|
|
665
664
|
fileName,
|
|
666
665
|
mimeType,
|
|
667
|
-
space,
|
|
668
666
|
uploadId,
|
|
669
667
|
uploader,
|
|
670
668
|
autoResetAfterUpload,
|
|
@@ -784,6 +782,7 @@ const useAudioBlobLoader = (options) => {
|
|
|
784
782
|
const audioRef = React.useRef(null);
|
|
785
783
|
const objectUrlRef = React.useRef(null);
|
|
786
784
|
const abortControllerRef = React.useRef(null);
|
|
785
|
+
const failedSrcRef = React.useRef(null);
|
|
787
786
|
const callbacksRef = React.useRef(playbackCallbacks);
|
|
788
787
|
callbacksRef.current = playbackCallbacks;
|
|
789
788
|
const createAudioFromBlob = React.useCallback((blob) => {
|
|
@@ -820,7 +819,7 @@ const useAudioBlobLoader = (options) => {
|
|
|
820
819
|
}, [waveformData, createAudioFromBlob]);
|
|
821
820
|
const ensureAudioLoaded = React.useCallback(async () => {
|
|
822
821
|
var _a;
|
|
823
|
-
if (audioRef.current) {
|
|
822
|
+
if (audioRef.current || failedSrcRef.current === src) {
|
|
824
823
|
return;
|
|
825
824
|
}
|
|
826
825
|
if (preloadedBlob) {
|
|
@@ -851,6 +850,7 @@ const useAudioBlobLoader = (options) => {
|
|
|
851
850
|
if (error instanceof DOMException && error.name === 'AbortError') {
|
|
852
851
|
return;
|
|
853
852
|
}
|
|
853
|
+
failedSrcRef.current = src;
|
|
854
854
|
console.warn('[voice-player] Failed to load audio', error);
|
|
855
855
|
}
|
|
856
856
|
finally {
|
|
@@ -861,6 +861,7 @@ const useAudioBlobLoader = (options) => {
|
|
|
861
861
|
}, [src, waveformData, preloadedBlob, mountFromBlob, createAudioFromBlob]);
|
|
862
862
|
/** Cleanup on src change or unmount */
|
|
863
863
|
React.useEffect(() => {
|
|
864
|
+
failedSrcRef.current = null;
|
|
864
865
|
return () => {
|
|
865
866
|
var _a;
|
|
866
867
|
(_a = abortControllerRef.current) === null || _a === void 0 ? void 0 : _a.abort();
|
|
@@ -1190,7 +1191,6 @@ const useAudioRecorderHandlers = (options) => {
|
|
|
1190
1191
|
const Container = styled.div `
|
|
1191
1192
|
position: relative;
|
|
1192
1193
|
width: 100%;
|
|
1193
|
-
padding: 16px;
|
|
1194
1194
|
transition: color 200ms ease, background-color 200ms ease;
|
|
1195
1195
|
color: var(--text_primary, #0a0a0a);
|
|
1196
1196
|
`;
|
|
@@ -1275,29 +1275,28 @@ const Wrapper$1 = styled.div `
|
|
|
1275
1275
|
gap: 12px;
|
|
1276
1276
|
padding: 10px 14px;
|
|
1277
1277
|
border-radius: 9999px;
|
|
1278
|
-
background: var(--
|
|
1279
|
-
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text_primary, #0a0a0a) 6%, transparent);
|
|
1278
|
+
background: var(--background_hover, color-mix(in srgb, var(--text_primary, #0a0a0a) 6%, transparent));
|
|
1280
1279
|
`;
|
|
1281
1280
|
const CancelButton$1 = styled.button `
|
|
1282
|
-
width:
|
|
1283
|
-
height:
|
|
1281
|
+
width: 38px;
|
|
1282
|
+
height: 38px;
|
|
1284
1283
|
display: inline-flex;
|
|
1285
1284
|
align-items: center;
|
|
1286
1285
|
justify-content: center;
|
|
1287
|
-
border-radius:
|
|
1288
|
-
background: transparent;
|
|
1286
|
+
border-radius: 19px;
|
|
1287
|
+
background: color-mix(in srgb, var(--exode_red) 10%, transparent);
|
|
1289
1288
|
border: 0;
|
|
1289
|
+
flex-shrink: 0;
|
|
1290
1290
|
color: color-mix(in srgb, var(--text_primary, #0a0a0a) 54%, transparent);
|
|
1291
1291
|
cursor: pointer;
|
|
1292
|
-
transition:
|
|
1292
|
+
transition: transform 160ms ease;
|
|
1293
1293
|
|
|
1294
|
-
&:hover {
|
|
1295
|
-
|
|
1296
|
-
color: color-mix(in srgb, var(--text_primary, #0a0a0a) 76%, transparent);
|
|
1294
|
+
&:hover:not(:disabled) {
|
|
1295
|
+
transform: translateY(-1px);
|
|
1297
1296
|
}
|
|
1298
1297
|
|
|
1299
|
-
&:active {
|
|
1300
|
-
|
|
1298
|
+
&:active:not(:disabled) {
|
|
1299
|
+
transform: translateY(0);
|
|
1301
1300
|
}
|
|
1302
1301
|
`;
|
|
1303
1302
|
const Track = styled.div `
|
|
@@ -1305,7 +1304,7 @@ const Track = styled.div `
|
|
|
1305
1304
|
display: flex;
|
|
1306
1305
|
align-items: center;
|
|
1307
1306
|
gap: 12px;
|
|
1308
|
-
padding: 8px
|
|
1307
|
+
padding: 8px 10px;
|
|
1309
1308
|
border-radius: 9999px;
|
|
1310
1309
|
background: color-mix(in srgb, var(--text_primary, #0a0a0a) 10%, transparent);
|
|
1311
1310
|
`;
|
|
@@ -1320,7 +1319,7 @@ const CircleButton = styled.button `
|
|
|
1320
1319
|
cursor: pointer;
|
|
1321
1320
|
transition: transform 160ms ease, color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
|
|
1322
1321
|
flex-shrink: 0;
|
|
1323
|
-
background:
|
|
1322
|
+
background: var(--background_content, #ffffff);
|
|
1324
1323
|
|
|
1325
1324
|
color: ${({ $variant }) => {
|
|
1326
1325
|
if ($variant === 'record') {
|
|
@@ -1469,7 +1468,9 @@ const RecordingShell = (props) => {
|
|
|
1469
1468
|
return formatTime(0);
|
|
1470
1469
|
}, [formatTime, hasRecording, isPlaying, playbackDuration, playbackTime, recordingTime]);
|
|
1471
1470
|
const recordButtonDisabled = isSending;
|
|
1472
|
-
const recordButtonIcon = !isRecording || isPaused
|
|
1471
|
+
const recordButtonIcon = !isRecording || isPaused
|
|
1472
|
+
? jsxRuntime.jsx(icons.Icon16Microphone, { width: 24, height: 24 })
|
|
1473
|
+
: jsxRuntime.jsx(icons.Icon16Pause, { width: 24, height: 24 });
|
|
1473
1474
|
const recordButtonVariant = !isRecording || isPaused ? 'resume' : 'record';
|
|
1474
1475
|
const recordButtonAria = !isRecording
|
|
1475
1476
|
? startAriaLabel
|
|
@@ -1478,14 +1479,16 @@ const RecordingShell = (props) => {
|
|
|
1478
1479
|
: pauseRecordingAriaLabel || stopAriaLabel;
|
|
1479
1480
|
const canShowPlayback = !isRecording || isPaused;
|
|
1480
1481
|
const playbackDisabled = !hasRecording && !isRecording;
|
|
1481
|
-
const playbackIcon = isPlaying
|
|
1482
|
+
const playbackIcon = isPlaying
|
|
1483
|
+
? jsxRuntime.jsx(icons.Icon16Pause, { width: 24, height: 24 })
|
|
1484
|
+
: jsxRuntime.jsx(icons.Icon16Play, { width: 24, height: 24 });
|
|
1482
1485
|
const playbackAria = isPlaying ? pausePlaybackAriaLabel : playAriaLabel;
|
|
1483
1486
|
const sendDisabled = isSending || (!hasRecording && !isRecording);
|
|
1484
|
-
return (jsxRuntime.jsxs(Wrapper$1, { children: [jsxRuntime.jsx(CancelButton$1, { type: "button", onClick: onCancel, "aria-label": cancelAriaLabel, children: jsxRuntime.jsx(icons.
|
|
1487
|
+
return (jsxRuntime.jsxs(Wrapper$1, { children: [jsxRuntime.jsx(CancelButton$1, { type: "button", onClick: onCancel, "aria-label": cancelAriaLabel, children: jsxRuntime.jsx(icons.Icon28DeleteOutlineAndroid, { fill: "var(--exode_red)", width: 24, height: 24, style: { minWidth: 24 } }) }), jsxRuntime.jsxs(Track, { children: [jsxRuntime.jsx(CircleButton, { type: "button", "$variant": recordButtonVariant, onClick: onRecordToggle, "aria-label": recordButtonAria, disabled: recordButtonDisabled, children: recordButtonIcon }), !canShowPlayback ? null : (jsxRuntime.jsx(CircleButton, { type: "button", "$variant": "play", onClick: onTogglePlayback, "aria-label": playbackAria, disabled: playbackDisabled, children: playbackIcon })), jsxRuntime.jsx(Waveform, { "$expanded": canShowPlayback, children: jsxRuntime.jsx(WaveformBars, { values: waveformValues, divider: 100, scale: 42, minHeight: 6, styleInterpolator: ({ normalized }) => ({
|
|
1485
1488
|
height: `${12 + normalized / 2}px`,
|
|
1486
1489
|
maxHeight: '34px',
|
|
1487
1490
|
opacity: 0.38 + Math.min(0.5, normalized / 120),
|
|
1488
|
-
}) }) }), jsxRuntime.jsx(Timer$1, { children: displayTime })] }), jsxRuntime.jsx(SendButton$1, { type: "button", onClick: onSend, disabled: sendDisabled, "aria-label": sendAriaLabel, children: isSending ? (jsxRuntime.jsx(SpinnerSlot, { children: jsxRuntime.jsx(Spinner, {}) })) : (jsxRuntime.jsx(icons.Icon28SendOutline, { width:
|
|
1491
|
+
}) }) }), jsxRuntime.jsx(Timer$1, { children: displayTime })] }), jsxRuntime.jsx(SendButton$1, { type: "button", onClick: onSend, disabled: sendDisabled, "aria-label": sendAriaLabel, children: isSending ? (jsxRuntime.jsx(SpinnerSlot, { children: jsxRuntime.jsx(Spinner, {}) })) : (jsxRuntime.jsx(icons.Icon28SendOutline, { width: 24, height: 24 })) })] }));
|
|
1489
1492
|
};
|
|
1490
1493
|
|
|
1491
1494
|
/**
|
|
@@ -1533,24 +1536,12 @@ const mergeMessages = (custom) => {
|
|
|
1533
1536
|
};
|
|
1534
1537
|
};
|
|
1535
1538
|
|
|
1536
|
-
/**
|
|
1537
|
-
* Upload types
|
|
1538
|
-
*
|
|
1539
|
-
* @author: exode <hello@exode.ru>
|
|
1540
|
-
*/
|
|
1541
|
-
const StorageSpaceEnum = {
|
|
1542
|
-
User: 'user',
|
|
1543
|
-
Shared: 'shared',
|
|
1544
|
-
System: 'system',
|
|
1545
|
-
};
|
|
1546
|
-
|
|
1547
1539
|
const AudioRecorder = (props) => {
|
|
1548
|
-
const {
|
|
1540
|
+
const { fileName, uploadId, mimeType, className, uploader, onUploaded, onUploadError, onRecordingStop, onRecordingError, onRecordingStart, onRecordingDelete, onPermissionDenied, autoResetAfterUpload, messages: customMessages, } = props;
|
|
1549
1541
|
const messages = React.useMemo(() => mergeMessages(customMessages), [customMessages]);
|
|
1550
1542
|
const [resolvedUploadId] = React.useState(() => uploadId !== null && uploadId !== void 0 ? uploadId : (typeof crypto !== 'undefined' && 'randomUUID' in crypto
|
|
1551
1543
|
? crypto.randomUUID()
|
|
1552
1544
|
: `upload-${Date.now()}`));
|
|
1553
|
-
const resolvedSpace = space !== null && space !== void 0 ? space : StorageSpaceEnum.User;
|
|
1554
1545
|
const handleRecorderError = React.useCallback((error) => {
|
|
1555
1546
|
onRecordingError === null || onRecordingError === void 0 ? void 0 : onRecordingError(error);
|
|
1556
1547
|
onUploadError === null || onUploadError === void 0 ? void 0 : onUploadError(error);
|
|
@@ -1568,7 +1559,6 @@ const AudioRecorder = (props) => {
|
|
|
1568
1559
|
onRecordingDelete,
|
|
1569
1560
|
onPermissionDenied,
|
|
1570
1561
|
autoResetAfterUpload,
|
|
1571
|
-
space: resolvedSpace,
|
|
1572
1562
|
uploader,
|
|
1573
1563
|
uploadId: resolvedUploadId,
|
|
1574
1564
|
onRecordingError: handleRecorderError,
|
|
@@ -1591,7 +1581,7 @@ const AudioRecorder = (props) => {
|
|
|
1591
1581
|
* @author: exode <hello@exode.ru>
|
|
1592
1582
|
*/
|
|
1593
1583
|
const useVoiceRecorderInput = (options) => {
|
|
1594
|
-
const { onSend, onError, onCancel, uploader, onUploaded, onPermissionDenied, autoStart = true,
|
|
1584
|
+
const { onSend, onError, onCancel, uploader, onUploaded, onPermissionDenied, autoStart = true, mimeType = 'audio/webm', fileName = 'voice-message.webm', } = options;
|
|
1595
1585
|
const [isSending, setIsSending] = React.useState(false);
|
|
1596
1586
|
const [timelineLevels, setTimelineLevels] = React.useState([]);
|
|
1597
1587
|
const audioBlobRef = React.useRef(null);
|
|
@@ -1612,7 +1602,6 @@ const useVoiceRecorderInput = (options) => {
|
|
|
1612
1602
|
}
|
|
1613
1603
|
}, []);
|
|
1614
1604
|
const recorder = useVoiceRecorder({
|
|
1615
|
-
space,
|
|
1616
1605
|
fileName,
|
|
1617
1606
|
mimeType,
|
|
1618
1607
|
uploadId,
|
|
@@ -1745,8 +1734,8 @@ const useVoiceRecorderInput = (options) => {
|
|
|
1745
1734
|
|
|
1746
1735
|
const PreviewBars = (props) => {
|
|
1747
1736
|
var _a, _b;
|
|
1748
|
-
const { isPlaying, playbackTime, lastDuration, previewLevels, recordingTime, timelineLevels,
|
|
1749
|
-
const maxBars =
|
|
1737
|
+
const { isPlaying, playbackTime, lastDuration, previewLevels, recordingTime, timelineLevels, visibleBarsCount, } = props;
|
|
1738
|
+
const maxBars = visibleBarsCount;
|
|
1750
1739
|
const sourceLevels = timelineLevels.length > 0
|
|
1751
1740
|
? timelineLevels
|
|
1752
1741
|
: previewLevels;
|
|
@@ -1790,8 +1779,8 @@ const PreviewBars = (props) => {
|
|
|
1790
1779
|
};
|
|
1791
1780
|
|
|
1792
1781
|
const TimelineBars = (props) => {
|
|
1793
|
-
const { timelineLevels,
|
|
1794
|
-
const maxBars =
|
|
1782
|
+
const { timelineLevels, visibleBarsCount } = props;
|
|
1783
|
+
const maxBars = visibleBarsCount;
|
|
1795
1784
|
const visible = timelineLevels.slice(-maxBars);
|
|
1796
1785
|
const padded = [
|
|
1797
1786
|
...visible,
|
|
@@ -1836,15 +1825,11 @@ const CancelButton = styled.button `
|
|
|
1836
1825
|
border-radius: 16px;
|
|
1837
1826
|
background: transparent;
|
|
1838
1827
|
border: 0;
|
|
1828
|
+
margin-right: 4px;
|
|
1839
1829
|
flex-shrink: 0;
|
|
1840
1830
|
color: color-mix(in srgb, var(--text_primary, #0a0a0a) 45%, transparent);
|
|
1841
1831
|
cursor: pointer;
|
|
1842
1832
|
transition: color 160ms ease, background-color 160ms ease;
|
|
1843
|
-
|
|
1844
|
-
&:hover {
|
|
1845
|
-
background-color: color-mix(in srgb, var(--text_primary, #0a0a0a) 8%, transparent);
|
|
1846
|
-
color: color-mix(in srgb, var(--text_primary, #0a0a0a) 72%, transparent);
|
|
1847
|
-
}
|
|
1848
1833
|
`;
|
|
1849
1834
|
const RecordTrack = styled.div `
|
|
1850
1835
|
flex: 1;
|
|
@@ -1860,7 +1845,8 @@ const RecordTrack = styled.div `
|
|
|
1860
1845
|
const ButtonSlot = styled.div `
|
|
1861
1846
|
display: flex;
|
|
1862
1847
|
align-items: center;
|
|
1863
|
-
gap:
|
|
1848
|
+
gap: 4px;
|
|
1849
|
+
padding: 2px;
|
|
1864
1850
|
flex-shrink: 0;
|
|
1865
1851
|
`;
|
|
1866
1852
|
const StopButton = styled.button `
|
|
@@ -1942,14 +1928,10 @@ const MicIndicator = styled.button `
|
|
|
1942
1928
|
border: 0;
|
|
1943
1929
|
flex-shrink: 0;
|
|
1944
1930
|
cursor: pointer;
|
|
1945
|
-
background:
|
|
1946
|
-
color: var(--
|
|
1931
|
+
background: var(--background_content, #ffffff);
|
|
1932
|
+
color: color-mix(in srgb, var(--accent, #3f8ae0) 86%, white 14%);
|
|
1947
1933
|
transition: background-color 140ms ease, transform 120ms ease;
|
|
1948
1934
|
|
|
1949
|
-
&:hover {
|
|
1950
|
-
background: color-mix(in srgb, var(--exode_red, #ed1c24) 22%, transparent);
|
|
1951
|
-
}
|
|
1952
|
-
|
|
1953
1935
|
&:active {
|
|
1954
1936
|
transform: scale(0.94);
|
|
1955
1937
|
}
|
|
@@ -1997,19 +1979,39 @@ const VoiceRecorderInput = (props) => {
|
|
|
1997
1979
|
const waveformRef = React.useRef(null);
|
|
1998
1980
|
const { recorder, isSending, isPreview, timelineLevels, lastDurationRef, handleResume, handlePause, handleCancel, handleSendRequest, } = useVoiceRecorderInput(inputOptions);
|
|
1999
1981
|
const { isPlaying, isRecording, recordingTime, hasRecording, previewLevels, playbackTime, formatTime, togglePlayback, } = recorder;
|
|
2000
|
-
const
|
|
1982
|
+
const [visibleBarsCount, setVisibleBarsCount] = React.useState(0);
|
|
1983
|
+
const measureBars = () => {
|
|
2001
1984
|
const el = waveformRef.current;
|
|
2002
1985
|
if (!el) {
|
|
2003
|
-
return
|
|
1986
|
+
return;
|
|
2004
1987
|
}
|
|
2005
|
-
|
|
1988
|
+
setVisibleBarsCount(Math.floor(el.clientWidth / (TIMELINE_BAR_WIDTH + TIMELINE_BAR_GAP)));
|
|
1989
|
+
};
|
|
1990
|
+
/** Sync recalc before paint — catches layout shifts from button changes */
|
|
1991
|
+
React.useLayoutEffect(measureBars);
|
|
1992
|
+
/** ResizeObserver for external size changes (window resize, container resize) */
|
|
1993
|
+
React.useEffect(() => {
|
|
1994
|
+
const el = waveformRef.current;
|
|
1995
|
+
if (!el) {
|
|
1996
|
+
return;
|
|
1997
|
+
}
|
|
1998
|
+
let rafId = 0;
|
|
1999
|
+
const observer = new ResizeObserver(() => {
|
|
2000
|
+
cancelAnimationFrame(rafId);
|
|
2001
|
+
rafId = requestAnimationFrame(measureBars);
|
|
2002
|
+
});
|
|
2003
|
+
observer.observe(el);
|
|
2004
|
+
return () => {
|
|
2005
|
+
cancelAnimationFrame(rafId);
|
|
2006
|
+
observer.disconnect();
|
|
2007
|
+
};
|
|
2006
2008
|
}, []);
|
|
2007
2009
|
const displayTime = (isPreview && isPlaying)
|
|
2008
2010
|
? formatTime(playbackTime)
|
|
2009
2011
|
: formatTime(recordingTime || lastDurationRef.current);
|
|
2010
|
-
return (jsxRuntime.jsxs(Wrapper, { className: className, children: [jsxRuntime.jsx(CancelButton, { type: "button", onClick: handleCancel, "aria-label": "Cancel", children: jsxRuntime.jsx(icons.
|
|
2012
|
+
return (jsxRuntime.jsxs(Wrapper, { className: className, children: [jsxRuntime.jsx(CancelButton, { type: "button", onClick: handleCancel, "aria-label": "Cancel", children: jsxRuntime.jsx(icons.Icon28DeleteOutlineAndroid, { fill: "var(--exode_red)", width: 28, height: 28, style: { minWidth: 28 } }) }), jsxRuntime.jsxs(RecordTrack, { children: [jsxRuntime.jsx(ButtonSlot, { children: isPreview ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(MicIndicator, { type: "button", onClick: handleResume, "aria-label": "Resume recording", children: jsxRuntime.jsx(icons.Icon20Voice, { width: 14, height: 14 }) }), jsxRuntime.jsx(PlayPauseButton, { type: "button", onClick: togglePlayback, "aria-label": isPlaying ? 'Pause' : 'Play', children: isPlaying
|
|
2011
2013
|
? jsxRuntime.jsx(icons.Icon16Pause, { width: 14, height: 14 })
|
|
2012
|
-
: jsxRuntime.jsx(icons.Icon16Play, { width: 14, height: 14 }) })] })) : (jsxRuntime.jsx(StopButton, { type: "button", onClick: handlePause, "aria-label": "Pause recording", children: jsxRuntime.jsx(icons.
|
|
2014
|
+
: jsxRuntime.jsx(icons.Icon16Play, { width: 14, height: 14 }) })] })) : (jsxRuntime.jsx(StopButton, { type: "button", onClick: handlePause, "aria-label": "Pause recording", children: jsxRuntime.jsx(icons.Icon16Pause, { width: 14, height: 14 }) })) }), jsxRuntime.jsx(WaveformArea, { ref: waveformRef, children: isPreview ? (jsxRuntime.jsx(PreviewBars, { timelineLevels: timelineLevels, previewLevels: previewLevels, isPlaying: isPlaying, playbackTime: playbackTime, recordingTime: recordingTime, lastDuration: lastDurationRef.current, visibleBarsCount: visibleBarsCount })) : (jsxRuntime.jsx(TimelineBars, { timelineLevels: timelineLevels, visibleBarsCount: visibleBarsCount })) }), jsxRuntime.jsx(Timer, { children: displayTime })] }), jsxRuntime.jsx(SendButton, { type: "button", onClick: handleSendRequest, disabled: isSending || (!hasRecording && !isRecording), "aria-label": "Send", children: isSending ? (jsxRuntime.jsx(SpinnerIcon, {})) : (jsxRuntime.jsx(icons.Icon28SendOutline, {})) })] }));
|
|
2013
2015
|
};
|
|
2014
2016
|
|
|
2015
2017
|
/**
|
|
@@ -2185,11 +2187,29 @@ const VoiceMessagePlayer = React.forwardRef((props, ref) => {
|
|
|
2185
2187
|
return VoicePlaybackChain.register(chainId, () => play());
|
|
2186
2188
|
}
|
|
2187
2189
|
}, [chainId, play]);
|
|
2188
|
-
|
|
2189
|
-
React.useLayoutEffect(() => {
|
|
2190
|
+
const measureTrackWidth = () => {
|
|
2190
2191
|
if (trackRef.current) {
|
|
2191
2192
|
setTrackWidth(trackRef.current.clientWidth);
|
|
2192
2193
|
}
|
|
2194
|
+
};
|
|
2195
|
+
/** Sync recalc before paint — catches layout shifts */
|
|
2196
|
+
React.useLayoutEffect(measureTrackWidth);
|
|
2197
|
+
/** ResizeObserver for external size changes (window resize, container resize) */
|
|
2198
|
+
React.useEffect(() => {
|
|
2199
|
+
const el = trackRef.current;
|
|
2200
|
+
if (!el) {
|
|
2201
|
+
return;
|
|
2202
|
+
}
|
|
2203
|
+
let rafId = 0;
|
|
2204
|
+
const observer = new ResizeObserver(() => {
|
|
2205
|
+
cancelAnimationFrame(rafId);
|
|
2206
|
+
rafId = requestAnimationFrame(measureTrackWidth);
|
|
2207
|
+
});
|
|
2208
|
+
observer.observe(el);
|
|
2209
|
+
return () => {
|
|
2210
|
+
cancelAnimationFrame(rafId);
|
|
2211
|
+
observer.disconnect();
|
|
2212
|
+
};
|
|
2193
2213
|
}, []);
|
|
2194
2214
|
const displayTime = isPlaying
|
|
2195
2215
|
? formatTime(currentTime)
|
|
@@ -2276,7 +2296,6 @@ const VoiceBlobCache = new VoiceBlobCacheClass();
|
|
|
2276
2296
|
|
|
2277
2297
|
exports.AUDIO_LEVEL_BARS = AUDIO_LEVEL_BARS;
|
|
2278
2298
|
exports.AudioRecorder = AudioRecorder;
|
|
2279
|
-
exports.StorageSpaceEnum = StorageSpaceEnum;
|
|
2280
2299
|
exports.VoiceBlobCache = VoiceBlobCache;
|
|
2281
2300
|
exports.VoiceMessagePlayer = VoiceMessagePlayer;
|
|
2282
2301
|
exports.VoicePlaybackChain = VoicePlaybackChain;
|