@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
|
@@ -5,5 +5,8 @@ export { useToolTip } from './useToolTip/useToolTip';
|
|
|
5
5
|
export { type KeyboardShortcut, type KeyboardShortcuts, useKeyboardShortcuts, } from './useKeyboardShortcuts/useKeyboardShortcuts';
|
|
6
6
|
export { useLastUpdated } from './useLastUpdated/useLastUpdated';
|
|
7
7
|
export { useLocalStore } from './useLocalStore/useLocalStore';
|
|
8
|
+
export { useMDStreamBuffer } from './useMdStreamBuffer/useMdStreamBuffer';
|
|
9
|
+
export { useMicrophone } from './useMicrophone/useMicrophone';
|
|
10
|
+
export { useAudioRecorder } from './useAudioRecorder/useAudioRecorder';
|
|
8
11
|
export { useWindow, FormFactor, type BreakPoints, type WindowGeolocation, type WindowGeolocationError, } from './useWindow/useWindow';
|
|
9
12
|
export { useObserveResize } from './useObserveResize/useObserveResize';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
type UseStreamToMp3Return = {
|
|
3
|
+
audioBlob: RefObject<Blob | null>;
|
|
4
|
+
error: Error | null;
|
|
5
|
+
isRecording: boolean;
|
|
6
|
+
recordingSizeMb: number;
|
|
7
|
+
mimeType: string | null;
|
|
8
|
+
resetRecording: () => void;
|
|
9
|
+
startRecording: () => void;
|
|
10
|
+
stopRecording: () => Promise<Blob | null>;
|
|
11
|
+
};
|
|
12
|
+
type AudioRecorderSource = MediaStream | MediaStreamTrack | RefObject<MediaStream | MediaStreamTrack | null> | null | undefined;
|
|
13
|
+
export declare function useAudioRecorder(audioStream: AudioRecorderSource): UseStreamToMp3Return;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { MarkdownStreamBufferOptions, MarkdownStreamBufferSnapshot } from '../../utils';
|
|
2
|
+
export declare function useMDStreamBuffer(options?: MarkdownStreamBufferOptions): {
|
|
3
|
+
raw: string;
|
|
4
|
+
healthy: string;
|
|
5
|
+
isComplete: boolean;
|
|
6
|
+
append: (value: string) => void;
|
|
7
|
+
flush: () => MarkdownStreamBufferSnapshot | undefined;
|
|
8
|
+
complete: () => MarkdownStreamBufferSnapshot | undefined;
|
|
9
|
+
reset: () => void;
|
|
10
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
type UseMicrophoneReturn = {
|
|
3
|
+
micStream: RefObject<MediaStream | null>;
|
|
4
|
+
micTrack: RefObject<MediaStreamTrack | null>;
|
|
5
|
+
muted: boolean;
|
|
6
|
+
isSupported: boolean;
|
|
7
|
+
isRequesting: boolean;
|
|
8
|
+
error: Error | null;
|
|
9
|
+
microphones: MediaDeviceInfo[];
|
|
10
|
+
requestMicrophone: () => Promise<MediaStream | null>;
|
|
11
|
+
stopMicrophone: () => void;
|
|
12
|
+
muteMic: () => boolean;
|
|
13
|
+
unmuteMic: () => boolean;
|
|
14
|
+
toggleMute: () => void;
|
|
15
|
+
refreshMicrophones: () => Promise<MediaDeviceInfo[]>;
|
|
16
|
+
setMicrophone: (deviceId: string) => Promise<void>;
|
|
17
|
+
};
|
|
18
|
+
export declare function useMicrophone(startMuted?: boolean, microphoneDeviceId?: string): UseMicrophoneReturn;
|
|
19
|
+
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,7 +2,9 @@ export type { ToolTip, ToolTipInfo } from './components/sharedTypes';
|
|
|
2
2
|
export { ToolTipType } from './components/sharedTypes';
|
|
3
3
|
export { light, dark, lightTheme, darkTheme, motion, elevations, Elevation, } from './theme';
|
|
4
4
|
export type { SliceTheme, Colors, Type, Corners, Elevations, } from './theme';
|
|
5
|
-
export { type KeyboardShortcut, type KeyboardShortcuts, type BreakPoints, type WindowGeolocation, type WindowGeolocationError, useKeyboardShortcuts, useTheme, useObserveTheme, useToolTip, useLastUpdated, useLocalStore, useWindow, useDoubleClick, useObserveResize, } from './hooks';
|
|
5
|
+
export { type KeyboardShortcut, type KeyboardShortcuts, type BreakPoints, type WindowGeolocation, type WindowGeolocationError, useKeyboardShortcuts, useTheme, useObserveTheme, useToolTip, useLastUpdated, useLocalStore, useMDStreamBuffer, useAudioRecorder, useMicrophone, useWindow, useDoubleClick, useObserveResize, } from './hooks';
|
|
6
|
+
export { AudioBubble } from './components/AudioBubble/index';
|
|
7
|
+
export type { AudioBubbleProps } from './components/AudioBubble/index';
|
|
6
8
|
export { Avatar } from './components/Avatar/index';
|
|
7
9
|
export type { AvatarProps } from './components/Avatar/index';
|
|
8
10
|
export { AvatarGroup } from './components/AvatarGroup';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { copyToClipboard, hexToRgb } from './functions/misc';
|
|
2
2
|
export { debounce } from './functions/debounce';
|
|
3
3
|
export * from './functions/colors';
|
|
4
|
-
export { IndexedDB, SSEConnection, WSConnection } from './objects';
|
|
5
|
-
export type { IndexedDBOptions, SSECustomEvent, SSEConnectionCloseOption, SSEConnectionOptions, SSEEventMap, SSEUnifiedBuiltInMessage, SSEUnifiedCustomMessage, SSEUnifiedMessage, UnifiedMessageEvent, WSConnectionOptions, } from './objects';
|
|
4
|
+
export { AudioVisualizer, IndexedDB, MdBuffer, SSEConnection, WSConnection, } from './objects';
|
|
5
|
+
export type { AudioVisualizerOptions, AudioVisualizerSource, IndexedDBOptions, MarkdownAutoCloseRule, MarkdownStreamBufferOptions, MarkdownStreamBufferSnapshot, SSECustomEvent, SSEConnectionCloseOption, SSEConnectionOptions, SSEEventMap, SSEUnifiedBuiltInMessage, SSEUnifiedCustomMessage, SSEUnifiedMessage, UnifiedMessageEvent, WSConnectionOptions, } from './objects';
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { MarkdownStreamBufferOptions, MarkdownStreamBufferSnapshot } from './_types';
|
|
2
|
+
/**
|
|
3
|
+
* Buffer streamed Markdown and emit parser-safe snapshots on animation frames.
|
|
4
|
+
*/
|
|
5
|
+
export declare class MdBuffer {
|
|
6
|
+
private readonly endOfStreamToken?;
|
|
7
|
+
private readonly htmlHandling;
|
|
8
|
+
private readonly includeLinksAndImages;
|
|
9
|
+
private readonly onFlush?;
|
|
10
|
+
private readonly requestFrame;
|
|
11
|
+
private readonly cancelFrame;
|
|
12
|
+
private readonly watchedMarkers;
|
|
13
|
+
private committedRaw;
|
|
14
|
+
private activeRaw;
|
|
15
|
+
private frameHandle;
|
|
16
|
+
private completeSignal;
|
|
17
|
+
constructor(options?: MarkdownStreamBufferOptions);
|
|
18
|
+
/**
|
|
19
|
+
* The raw Markdown accumulated so far.
|
|
20
|
+
*/
|
|
21
|
+
get raw(): string;
|
|
22
|
+
/**
|
|
23
|
+
* The current parser-safe preview derived from the raw buffer.
|
|
24
|
+
*/
|
|
25
|
+
get healthy(): string;
|
|
26
|
+
/**
|
|
27
|
+
* Append a streamed Markdown token and schedule a frame flush.
|
|
28
|
+
*/
|
|
29
|
+
append(chunk: string): MarkdownStreamBufferSnapshot | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Emit the current snapshot immediately.
|
|
32
|
+
*/
|
|
33
|
+
flush(reason?: MarkdownStreamBufferSnapshot['reason']): MarkdownStreamBufferSnapshot;
|
|
34
|
+
/**
|
|
35
|
+
* Mark the stream as complete and flush one final snapshot.
|
|
36
|
+
*/
|
|
37
|
+
complete(): MarkdownStreamBufferSnapshot;
|
|
38
|
+
/**
|
|
39
|
+
* Clear the buffered state and cancel any pending frame.
|
|
40
|
+
*/
|
|
41
|
+
reset(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Cancel future work and release the retained state.
|
|
44
|
+
*/
|
|
45
|
+
dispose(): void;
|
|
46
|
+
private handleEndOfStreamToken;
|
|
47
|
+
private scheduleFlush;
|
|
48
|
+
private commitStableLines;
|
|
49
|
+
private buildHealthyOutput;
|
|
50
|
+
private buildHealthyTail;
|
|
51
|
+
private closeInlineMarkdown;
|
|
52
|
+
private closeLinksAndImages;
|
|
53
|
+
private getPairedRules;
|
|
54
|
+
private closeSymmetricPairedMarkers;
|
|
55
|
+
private closeAsymmetricPairedMarkers;
|
|
56
|
+
private closeLineMarkers;
|
|
57
|
+
private closeTrailingLink;
|
|
58
|
+
private closeTrailingImage;
|
|
59
|
+
private closeTrailingImageSignal;
|
|
60
|
+
private findTrailingLink;
|
|
61
|
+
private findTrailingImage;
|
|
62
|
+
private findTrailingInlineConstruct;
|
|
63
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface MarkdownStreamBufferSnapshot {
|
|
2
|
+
raw: string;
|
|
3
|
+
healthy: string;
|
|
4
|
+
reason: 'raf' | 'manual' | 'complete';
|
|
5
|
+
isComplete: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface MarkdownAutoCloseRule {
|
|
8
|
+
name?: string;
|
|
9
|
+
open: string;
|
|
10
|
+
close: string;
|
|
11
|
+
mode?: 'paired' | 'line';
|
|
12
|
+
linePattern?: RegExp;
|
|
13
|
+
partialLinePattern?: RegExp;
|
|
14
|
+
requiresLineStart?: boolean;
|
|
15
|
+
requiresContent?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface MarkdownStreamBufferOptions {
|
|
18
|
+
endOfStreamToken?: string;
|
|
19
|
+
htmlHandling?: 'ignore' | 'strip';
|
|
20
|
+
includeLinksAndImages?: boolean;
|
|
21
|
+
onFlush?: (snapshot: MarkdownStreamBufferSnapshot) => void;
|
|
22
|
+
requestFrame?: (callback: FrameRequestCallback) => number;
|
|
23
|
+
cancelFrame?: (handle: number) => void;
|
|
24
|
+
watchedMarkers?: MarkdownAutoCloseRule[];
|
|
25
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { WebRTCConnectionOptions } from './_types';
|
|
2
|
+
export declare class WebRTCConnection {
|
|
3
|
+
private readonly peerConnection;
|
|
4
|
+
private readonly RTCSenderAudioTrack?;
|
|
5
|
+
private readonly RTCSenderVideoTrack?;
|
|
6
|
+
private RTCScreenShareTrack;
|
|
7
|
+
private RTCScreenShareSender;
|
|
8
|
+
private readonly RTCReceiverAudioStream;
|
|
9
|
+
private readonly RTCReceiverVideoTracks;
|
|
10
|
+
private readonly RTCReceiverAudioTracks;
|
|
11
|
+
private readonly RTCDataChannels;
|
|
12
|
+
private readonly connectionUrl;
|
|
13
|
+
private connectionOffer;
|
|
14
|
+
private audioElement;
|
|
15
|
+
private readonly autoPlayAudio;
|
|
16
|
+
private readonly onRemoteAudioStream?;
|
|
17
|
+
private readonly onRemoteVideoStream?;
|
|
18
|
+
private readonly onDataChannelEvent?;
|
|
19
|
+
private iceTimer?;
|
|
20
|
+
private offerOptions?;
|
|
21
|
+
private bearerToken?;
|
|
22
|
+
/**
|
|
23
|
+
* Create the base instance
|
|
24
|
+
*/
|
|
25
|
+
constructor(rtcConnectionInfo: WebRTCConnectionOptions);
|
|
26
|
+
/**
|
|
27
|
+
* Initialize the RTC connection
|
|
28
|
+
*/
|
|
29
|
+
initialize(offerOptions?: RTCOfferOptions, bearerToken?: string): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Start an optional screen share stream and renegotiate if already connected
|
|
32
|
+
*/
|
|
33
|
+
startScreenShare(): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Stop the optional screen share stream and renegotiate if already connected
|
|
36
|
+
*/
|
|
37
|
+
stopScreenShare(stopTrack?: boolean): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Create an offer, wait for ICE gathering, POST SDP, and apply the answer
|
|
40
|
+
*/
|
|
41
|
+
private negotiate;
|
|
42
|
+
/**
|
|
43
|
+
* Send a JSON-serializable payload over a named data channel
|
|
44
|
+
*/
|
|
45
|
+
sendMessage(channelName: string, data: string | number | boolean | object | null): void;
|
|
46
|
+
/**
|
|
47
|
+
* Mute or unmute all incoming audio playback
|
|
48
|
+
*/
|
|
49
|
+
muteAllAudio(muted: boolean): void;
|
|
50
|
+
/**
|
|
51
|
+
* Mute or unmute a specific incoming audio track
|
|
52
|
+
*/
|
|
53
|
+
muteAudioTrack(trackId: string, muted: boolean): void;
|
|
54
|
+
/**
|
|
55
|
+
* Set the playback volume for the incoming audio element
|
|
56
|
+
*/
|
|
57
|
+
setAudioVolume(volume: number): void;
|
|
58
|
+
/**
|
|
59
|
+
* Create an audio source node from the unified incoming audio stream
|
|
60
|
+
*/
|
|
61
|
+
createIncomingAudioSource(audioContext: AudioContext): MediaStreamAudioSourceNode;
|
|
62
|
+
/**
|
|
63
|
+
* Handle track events adding them to the unified audio and video streams
|
|
64
|
+
*/
|
|
65
|
+
private onTrack;
|
|
66
|
+
/**
|
|
67
|
+
* Create a local audio element and set its source to the rtc incoming media stream
|
|
68
|
+
*/
|
|
69
|
+
private setupIncomingAudioStream;
|
|
70
|
+
/**
|
|
71
|
+
* Set up a local stream with mic and video tracks and add to peer connection
|
|
72
|
+
*/
|
|
73
|
+
private setupOutgoingMediaStream;
|
|
74
|
+
/**
|
|
75
|
+
* Setup data channels
|
|
76
|
+
*/
|
|
77
|
+
private setupDataChannels;
|
|
78
|
+
/**
|
|
79
|
+
* Add listeners for data events and push through callback
|
|
80
|
+
*/
|
|
81
|
+
private setupDataChannelEventListeners;
|
|
82
|
+
/**
|
|
83
|
+
* Wait for the ICE gathering to be complete
|
|
84
|
+
*/
|
|
85
|
+
private waitForIceGathering;
|
|
86
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface WebRTCConnectionOptions {
|
|
2
|
+
connectionUrl?: string;
|
|
3
|
+
audioElement?: HTMLAudioElement;
|
|
4
|
+
autoPlayAudio?: boolean;
|
|
5
|
+
dataChannels?: string | string[];
|
|
6
|
+
micMediaTrack: MediaStreamTrack;
|
|
7
|
+
videoMediaTrack?: MediaStreamTrack;
|
|
8
|
+
onRemoteVideoStream?: (streams: Map<string, MediaStream>) => void;
|
|
9
|
+
onRemoteAudioStream?: (streams: Map<string, MediaStream>) => void;
|
|
10
|
+
onDataChannelEvent?: (channel: string, eventType: 'message' | 'open' | 'close' | 'error', eventData: MessageEvent | Event | RTCErrorEvent) => void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
type AudioVisualizerSource = MediaStream | MediaStreamTrack;
|
|
2
|
+
type AudioVisualizerOptions = {
|
|
3
|
+
fftSize?: number;
|
|
4
|
+
intensityMultiplier?: number;
|
|
5
|
+
maxScale?: number;
|
|
6
|
+
minScale?: number;
|
|
7
|
+
onUpdate?: (state: {
|
|
8
|
+
intensity: number;
|
|
9
|
+
scale: number;
|
|
10
|
+
}) => void;
|
|
11
|
+
peakIntensity?: number;
|
|
12
|
+
releasePerSecond?: number;
|
|
13
|
+
risePerSecond?: number;
|
|
14
|
+
};
|
|
15
|
+
export declare class AudioVisualizer {
|
|
16
|
+
private readonly fftSize;
|
|
17
|
+
private readonly intensityMultiplier;
|
|
18
|
+
private readonly maxScale;
|
|
19
|
+
private readonly minScale;
|
|
20
|
+
private readonly onUpdate?;
|
|
21
|
+
private readonly peakIntensity;
|
|
22
|
+
private readonly releasePerSecond;
|
|
23
|
+
private readonly risePerSecond;
|
|
24
|
+
private readonly source;
|
|
25
|
+
private analyser;
|
|
26
|
+
private animationFrameId;
|
|
27
|
+
private audioContext;
|
|
28
|
+
private currentIntensity;
|
|
29
|
+
private lastFrameTime;
|
|
30
|
+
private sourceNode;
|
|
31
|
+
private timeDomainData;
|
|
32
|
+
constructor(source: AudioVisualizerSource, options?: AudioVisualizerOptions);
|
|
33
|
+
start(): void;
|
|
34
|
+
stop(): void;
|
|
35
|
+
dispose(): void;
|
|
36
|
+
getIntensity(): number;
|
|
37
|
+
getScale(): number;
|
|
38
|
+
private readonly onFrame;
|
|
39
|
+
}
|
|
40
|
+
export type { AudioVisualizerOptions, AudioVisualizerSource };
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export { IndexedDB } from './IndexedDB/IndexedDB';
|
|
2
2
|
export type { IndexedDBOptions } from './IndexedDB/IndexedDB';
|
|
3
|
+
export { AudioVisualizer } from './audioVisualizer/audioVisualizer';
|
|
4
|
+
export type { AudioVisualizerOptions, AudioVisualizerSource, } from './audioVisualizer/audioVisualizer';
|
|
5
|
+
export { MdBuffer } from './MDStreamBuffer/MdStreamBuffer';
|
|
6
|
+
export type { MarkdownAutoCloseRule, MarkdownStreamBufferOptions, MarkdownStreamBufferSnapshot, } from './MDStreamBuffer/_types';
|
|
3
7
|
export { SSEConnection } from './SSEConnection/SSEConnection';
|
|
4
8
|
export { WSConnection } from './WSConnection/WSConnection';
|
|
5
9
|
export type { SSECustomEvent, SSEConnectionCloseOption, SSEConnectionOptions, SSEEventMap, SSEUnifiedBuiltInMessage, SSEUnifiedCustomMessage, SSEUnifiedMessage, } from './SSEConnection/SSEConnection';
|