@ephia/dova-sdk 1.0.0
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 +89 -0
- package/dist/EphiaBinding-BvRmlqqC.d.ts +36 -0
- package/dist/EphiaFloatingButton-CxiF86VW.d.ts +65 -0
- package/dist/EphiaTextarea-B4_CAVUg.d.ts +183 -0
- package/dist/NativeBinding-ChG0GeSz.d.ts +53 -0
- package/dist/TargetBinding-BKGQwUMc.d.ts +89 -0
- package/dist/TiptapBinding-B-agfV2H.d.ts +45 -0
- package/dist/Transport-zdeA4Pou.d.ts +63 -0
- package/dist/audio-state-kZ3KSvux.d.ts +39 -0
- package/dist/chunk-35AJK2IO.js +1 -0
- package/dist/chunk-35AJK2IO.js.map +1 -0
- package/dist/chunk-3LXZODL4.js +886 -0
- package/dist/chunk-3LXZODL4.js.map +1 -0
- package/dist/chunk-5IK5TLSK.js +67 -0
- package/dist/chunk-5IK5TLSK.js.map +1 -0
- package/dist/chunk-7E43RY75.js +9 -0
- package/dist/chunk-7E43RY75.js.map +1 -0
- package/dist/chunk-A5UEXJ5R.js +183 -0
- package/dist/chunk-A5UEXJ5R.js.map +1 -0
- package/dist/chunk-AEE554FT.js +51 -0
- package/dist/chunk-AEE554FT.js.map +1 -0
- package/dist/chunk-DIEWY3IT.js +1332 -0
- package/dist/chunk-DIEWY3IT.js.map +1 -0
- package/dist/chunk-EGIAN7FH.js +18 -0
- package/dist/chunk-EGIAN7FH.js.map +1 -0
- package/dist/chunk-EMOEAPVU.js +486 -0
- package/dist/chunk-EMOEAPVU.js.map +1 -0
- package/dist/chunk-IDC7FHIZ.js +40 -0
- package/dist/chunk-IDC7FHIZ.js.map +1 -0
- package/dist/chunk-ITJFN3VM.js +601 -0
- package/dist/chunk-ITJFN3VM.js.map +1 -0
- package/dist/chunk-K24GNU27.js +22 -0
- package/dist/chunk-K24GNU27.js.map +1 -0
- package/dist/chunk-LXMCRXXF.js +778 -0
- package/dist/chunk-LXMCRXXF.js.map +1 -0
- package/dist/chunk-MJCEOOLW.js +122 -0
- package/dist/chunk-MJCEOOLW.js.map +1 -0
- package/dist/chunk-N7U5M3VZ.js +33 -0
- package/dist/chunk-N7U5M3VZ.js.map +1 -0
- package/dist/chunk-PSYX674B.js +27 -0
- package/dist/chunk-PSYX674B.js.map +1 -0
- package/dist/chunk-RFQRV7ML.js +33 -0
- package/dist/chunk-RFQRV7ML.js.map +1 -0
- package/dist/chunk-THNHRV2B.js +18 -0
- package/dist/chunk-THNHRV2B.js.map +1 -0
- package/dist/chunk-VSLGR64U.js +62 -0
- package/dist/chunk-VSLGR64U.js.map +1 -0
- package/dist/chunk-W2ZP674X.js +346 -0
- package/dist/chunk-W2ZP674X.js.map +1 -0
- package/dist/chunk-YWZUMUYE.js +695 -0
- package/dist/chunk-YWZUMUYE.js.map +1 -0
- package/dist/client-options-Uo6jXO8k.d.ts +64 -0
- package/dist/connection-state-Bk33YprE.d.ts +32 -0
- package/dist/core/bindings/index.d.ts +24 -0
- package/dist/core/bindings/index.js +1025 -0
- package/dist/core/bindings/index.js.map +1 -0
- package/dist/core/index.d.ts +383 -0
- package/dist/core/index.js +1284 -0
- package/dist/core/index.js.map +1 -0
- package/dist/createEphiaClient-BhdZ183V.d.ts +69 -0
- package/dist/devices/speechmike/index.d.ts +148 -0
- package/dist/devices/speechmike/index.js +40 -0
- package/dist/devices/speechmike/index.js.map +1 -0
- package/dist/headless/index.d.ts +10 -0
- package/dist/headless/index.js +25 -0
- package/dist/headless/index.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +119 -0
- package/dist/index.js.map +1 -0
- package/dist/react/index.d.ts +38 -0
- package/dist/react/index.js +70 -0
- package/dist/react/index.js.map +1 -0
- package/dist/rich-editor/index.d.ts +46 -0
- package/dist/rich-editor/index.js +13 -0
- package/dist/rich-editor/index.js.map +1 -0
- package/dist/schema-B2ycPlNB.d.ts +87 -0
- package/dist/session-APaXR48R.d.ts +12 -0
- package/dist/shared/index.d.ts +16 -0
- package/dist/shared/index.js +30 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/style.css +1093 -0
- package/dist/testing/index.d.ts +84 -0
- package/dist/testing/index.js +36 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/types-D5SXPSwR.d.ts +32 -0
- package/dist/ui/index.d.ts +30 -0
- package/dist/ui/index.js +34 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/useEphiaSpeechMike-CjD7DWnh.d.ts +64 -0
- package/package.json +110 -0
- package/src/core/audio/audio-worklet-source.ts +30 -0
- package/src/core/audio/index.ts +3 -0
- package/src/core/audio/voice-level-meter.test.ts +27 -0
- package/src/core/audio/voice-level-meter.ts +270 -0
- package/src/core/bindings/EphiaBinding.ts +41 -0
- package/src/core/bindings/SegmentBindingBridge.test.ts +422 -0
- package/src/core/bindings/SegmentBindingBridge.ts +377 -0
- package/src/core/bindings/TargetBinding.ts +142 -0
- package/src/core/bindings/adapters/NativeAdapter.test.ts +85 -0
- package/src/core/bindings/adapters/NativeAdapter.ts +216 -0
- package/src/core/bindings/adapters/ProseMirrorAdapter.ts +231 -0
- package/src/core/bindings/adapters/index.ts +2 -0
- package/src/core/bindings/binding-factory.ts +78 -0
- package/src/core/bindings/detect-editor-type.ts +87 -0
- package/src/core/bindings/index.ts +13 -0
- package/src/core/bindings/insertion-boundary.test.ts +38 -0
- package/src/core/bindings/insertion-boundary.ts +26 -0
- package/src/core/bindings/native/NativeBinding.test.ts +277 -0
- package/src/core/bindings/native/NativeBinding.ts +239 -0
- package/src/core/bindings/resolver.ts +18 -0
- package/src/core/bindings/targets/codemirror.binding.ts +293 -0
- package/src/core/bindings/targets/contenteditable.binding.ts +452 -0
- package/src/core/bindings/targets/index.ts +10 -0
- package/src/core/bindings/targets/monaco.binding.ts +315 -0
- package/src/core/bindings/targets/tiptap.binding.test.ts +417 -0
- package/src/core/bindings/targets/tiptap.binding.ts +1192 -0
- package/src/core/bindings/tiptap/TiptapBinding.test.ts +63 -0
- package/src/core/bindings/tiptap/TiptapBinding.ts +464 -0
- package/src/core/bindings/types.ts +41 -0
- package/src/core/client/EphiaAudioClient.ts +654 -0
- package/src/core/client/audio-capture.ts +263 -0
- package/src/core/client/client-options.ts +39 -0
- package/src/core/client/client-state.ts +18 -0
- package/src/core/client/constants.ts +23 -0
- package/src/core/client/session-api.ts +415 -0
- package/src/core/connection/connection-state.ts +78 -0
- package/src/core/connection/index.ts +6 -0
- package/src/core/index.ts +47 -0
- package/src/core/operations/textToDocumentOperations.test.ts +69 -0
- package/src/core/operations/textToDocumentOperations.ts +92 -0
- package/src/core/runtime/DictationRuntime.test.ts +578 -0
- package/src/core/runtime/DictationRuntime.ts +434 -0
- package/src/core/runtime/TranscriptApplier.test.ts +355 -0
- package/src/core/runtime/TranscriptApplier.ts +229 -0
- package/src/core/runtime/index.ts +18 -0
- package/src/core/session/index.ts +2 -0
- package/src/core/session/session-machine.test.ts +16 -0
- package/src/core/session/session-machine.ts +59 -0
- package/src/core/targets/EditorContextCollector.ts +71 -0
- package/src/core/targets/TargetManager.test.ts +194 -0
- package/src/core/targets/TargetManager.ts +194 -0
- package/src/core/targets/index.ts +10 -0
- package/src/core/text-processing/index.ts +11 -0
- package/src/core/text-processing/overlap.test.ts +35 -0
- package/src/core/text-processing/overlap.ts +101 -0
- package/src/core/text-processing/voice-formatting.normalizer.test.ts +132 -0
- package/src/core/text-processing/voice-formatting.normalizer.ts +284 -0
- package/src/core/transcript/client-transcript.reducer.ts +366 -0
- package/src/core/transcript/client-transcript.state.ts +25 -0
- package/src/core/transcript/index.ts +19 -0
- package/src/core/transcript/transcript.assembler.test.ts +205 -0
- package/src/core/transcript/transcript.assembler.ts +152 -0
- package/src/core/transcript/transcript.reducer.test.ts +199 -0
- package/src/core/transcript/transcript.reducer.ts +771 -0
- package/src/core/transcript/transcript.state.ts +123 -0
- package/src/core/transport/LiveKitTransport.publish.test.ts +226 -0
- package/src/core/transport/LiveKitTransport.ts +459 -0
- package/src/core/transport/MockTransport.ts +231 -0
- package/src/core/transport/Transport.ts +82 -0
- package/src/debug/sdk-debug-collector.ts +79 -0
- package/src/devices/index.ts +2 -0
- package/src/devices/speechmike/__tests__/EphiaSpeechMikeProvider.test.tsx +99 -0
- package/src/devices/speechmike/__tests__/speechmike-audio-resolver.test.ts +96 -0
- package/src/devices/speechmike/__tests__/speechmike-button-router.test.ts +66 -0
- package/src/devices/speechmike/__tests__/speechmike-device-manager.test.ts +201 -0
- package/src/devices/speechmike/__tests__/speechmike-led-controller.test.ts +68 -0
- package/src/devices/speechmike/browser.ts +80 -0
- package/src/devices/speechmike/constants.ts +74 -0
- package/src/devices/speechmike/dictation-support-loader.ts +81 -0
- package/src/devices/speechmike/index.ts +11 -0
- package/src/devices/speechmike/react/EphiaSpeechMikeContext.ts +34 -0
- package/src/devices/speechmike/react/EphiaSpeechMikeProvider.tsx +287 -0
- package/src/devices/speechmike/react/useEphiaSpeechMike.ts +26 -0
- package/src/devices/speechmike/speechmike-audio-resolver.ts +58 -0
- package/src/devices/speechmike/speechmike-button-router.ts +73 -0
- package/src/devices/speechmike/speechmike-device-manager.ts +461 -0
- package/src/devices/speechmike/speechmike-led-controller.ts +78 -0
- package/src/devices/speechmike/types.ts +96 -0
- package/src/dictation_support.d.ts +31 -0
- package/src/global.d.ts +10 -0
- package/src/headless/createEphiaClient.ts +220 -0
- package/src/headless/index.ts +18 -0
- package/src/index.ts +89 -0
- package/src/react/EphiaAuto.tsx +87 -0
- package/src/react/components/EphiaDictationButton.tsx +88 -0
- package/src/react/components/EphiaStatusBar.tsx +59 -0
- package/src/react/components/EphiaTextarea.tsx +295 -0
- package/src/react/ephia-react.css +318 -0
- package/src/react/hooks/targets/index.ts +3 -0
- package/src/react/hooks/targets/useEphiaCodemirror.ts +35 -0
- package/src/react/hooks/targets/useEphiaMonaco.ts +35 -0
- package/src/react/hooks/targets/useEphiaTiptap.ts +23 -0
- package/src/react/hooks/useEphia.lifecycle.test.tsx +389 -0
- package/src/react/hooks/useEphia.ts +367 -0
- package/src/react/hooks/useEphiaDiscardTarget.ts +53 -0
- package/src/react/hooks/useEphiaServerEvent.ts +33 -0
- package/src/react/hooks/useEphiaTarget.ts +47 -0
- package/src/react/hooks/useEphiaTranscript.ts +22 -0
- package/src/react/index.ts +58 -0
- package/src/react/provider/EphiaContext.ts +63 -0
- package/src/react/provider/EphiaInternalContext.ts +32 -0
- package/src/react/provider/EphiaProvider.tsx +373 -0
- package/src/react/registry/binding-factory.ts +7 -0
- package/src/react/registry/detect-editor-type.ts +2 -0
- package/src/react/registry/events.ts +37 -0
- package/src/react/registry/registries/CodeMirrorInstanceRegistry.ts +24 -0
- package/src/react/registry/registries/MonacoInstanceRegistry.ts +23 -0
- package/src/react/registry/registries/TargetRegistry.ts +327 -0
- package/src/react/registry/registries/TiptapInstanceRegistry.ts +43 -0
- package/src/react/registry/registries/index.ts +5 -0
- package/src/react/store/create-ephia-store.ts +36 -0
- package/src/react/store/types.ts +41 -0
- package/src/react/utils/flash-range.ts +24 -0
- package/src/react/utils/index.ts +1 -0
- package/src/rich-editor/adapters/tiptap.test.ts +86 -0
- package/src/rich-editor/adapters/tiptap.ts +23 -0
- package/src/rich-editor/index.ts +3 -0
- package/src/rich-editor/types.ts +24 -0
- package/src/rich-editor/use-ephia-rich-editor.test.tsx +202 -0
- package/src/rich-editor/use-ephia-rich-editor.ts +47 -0
- package/src/shared/config/endpoint.test.ts +45 -0
- package/src/shared/config/endpoint.ts +39 -0
- package/src/shared/config/schema.ts +32 -0
- package/src/shared/effective-text.ts +13 -0
- package/src/shared/errors/EphiaSdkError.ts +54 -0
- package/src/shared/errors/messages.ts +40 -0
- package/src/shared/index.ts +27 -0
- package/src/shared/state/audio-state.ts +45 -0
- package/src/shared/state/index.ts +2 -0
- package/src/shared/store/document-store.ts +32 -0
- package/src/shared/store/index.ts +2 -0
- package/src/shared/types/editors.ts +28 -0
- package/src/shared/types/session.ts +12 -0
- package/src/style.css +2 -0
- package/src/testing/index.tsx +60 -0
- package/src/ui/assets/ephia-logo.svg +4 -0
- package/src/ui/components/EphiaLogo.tsx +77 -0
- package/src/ui/index.ts +24 -0
- package/src/ui/primitives/Button.tsx +53 -0
- package/src/ui/primitives/Spinner.tsx +21 -0
- package/src/ui/primitives/index.ts +5 -0
- package/src/ui/recorder/EphiaFloatingButton.tsx +489 -0
- package/src/ui/recorder/MinimalProcessingBars.tsx +122 -0
- package/src/ui/recorder/StandardIntensityVisualizer.tsx +148 -0
- package/src/ui/recorder/appearance.ts +9 -0
- package/src/ui/recorder/index.ts +8 -0
- package/src/ui/theme.css +775 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useLayoutEffect, useReducer, useRef } from "react";
|
|
4
|
+
|
|
5
|
+
/** Fenêtre d'échantillonnage (ms) : moyenne du niveau vocal puis ajout d'une barre. */
|
|
6
|
+
export const INTENSITY_SAMPLE_MS = 300;
|
|
7
|
+
|
|
8
|
+
const BAR_WIDTH_PX = 3;
|
|
9
|
+
const BAR_GAP_PX = 2;
|
|
10
|
+
const MIN_BAR_HEIGHT_RATIO = 0.1;
|
|
11
|
+
|
|
12
|
+
export type StandardIntensityVisualizerProps = {
|
|
13
|
+
enabled: boolean;
|
|
14
|
+
/** Niveau instantané 0..1 (alimenté par le micro, ~33 ms). */
|
|
15
|
+
level: number;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
function clamp01(value: number): number {
|
|
19
|
+
return Math.max(0, Math.min(1, value));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function barHeightRatio(level: number): number {
|
|
23
|
+
const v = clamp01(level);
|
|
24
|
+
return MIN_BAR_HEIGHT_RATIO + v * (1 - MIN_BAR_HEIGHT_RATIO);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function barStepPx(): number {
|
|
28
|
+
return BAR_WIDTH_PX + BAR_GAP_PX;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function scrollSpeedPxPerSec(): number {
|
|
32
|
+
return barStepPx() / (INTENSITY_SAMPLE_MS / 1000);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Historique de barres : une barre toutes les INTENSITY_SAMPLE_MS (moyenne),
|
|
37
|
+
* défilement continu vers la gauche, fondu sur les bords du cadre.
|
|
38
|
+
*/
|
|
39
|
+
export function StandardIntensityVisualizer({ enabled, level }: StandardIntensityVisualizerProps) {
|
|
40
|
+
const rectRef = useRef<HTMLSpanElement>(null);
|
|
41
|
+
const trackRef = useRef<HTMLSpanElement>(null);
|
|
42
|
+
const bucketRef = useRef({ sum: 0, count: 0 });
|
|
43
|
+
const scrollOffsetRef = useRef(0);
|
|
44
|
+
const barsRef = useRef<number[]>([]);
|
|
45
|
+
const maxBarsRef = useRef(48);
|
|
46
|
+
const [barRevision, bumpBars] = useReducer((n: number) => n + 1, 0);
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (!enabled) return;
|
|
50
|
+
const v = clamp01(level);
|
|
51
|
+
bucketRef.current.sum += v;
|
|
52
|
+
bucketRef.current.count += 1;
|
|
53
|
+
}, [enabled, level]);
|
|
54
|
+
|
|
55
|
+
useLayoutEffect(() => {
|
|
56
|
+
const rect = rectRef.current;
|
|
57
|
+
if (!rect) return;
|
|
58
|
+
const updateMax = () => {
|
|
59
|
+
const w = rect.clientWidth;
|
|
60
|
+
if (w > 0) {
|
|
61
|
+
maxBarsRef.current = Math.max(12, Math.ceil(w / barStepPx()) + 4);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
updateMax();
|
|
65
|
+
const ro = new ResizeObserver(updateMax);
|
|
66
|
+
ro.observe(rect);
|
|
67
|
+
return () => ro.disconnect();
|
|
68
|
+
}, [enabled]);
|
|
69
|
+
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
if (!enabled) {
|
|
72
|
+
barsRef.current = [];
|
|
73
|
+
bucketRef.current = { sum: 0, count: 0 };
|
|
74
|
+
scrollOffsetRef.current = 0;
|
|
75
|
+
if (trackRef.current) trackRef.current.style.transform = "translateX(0)";
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
let rafId = 0;
|
|
80
|
+
let lastTs = performance.now();
|
|
81
|
+
|
|
82
|
+
const consumeBucket = (): number => {
|
|
83
|
+
const { sum, count } = bucketRef.current;
|
|
84
|
+
bucketRef.current = { sum: 0, count: 0 };
|
|
85
|
+
return count > 0 ? sum / count : 0;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const pushBar = () => {
|
|
89
|
+
const avg = consumeBucket();
|
|
90
|
+
const next = [...barsRef.current, avg];
|
|
91
|
+
const max = maxBarsRef.current;
|
|
92
|
+
barsRef.current = next.length > max ? next.slice(-max) : next;
|
|
93
|
+
bumpBars();
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const tick = (now: number) => {
|
|
97
|
+
const track = trackRef.current;
|
|
98
|
+
if (!track) {
|
|
99
|
+
rafId = requestAnimationFrame(tick);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const dt = Math.min(0.05, (now - lastTs) / 1000);
|
|
104
|
+
lastTs = now;
|
|
105
|
+
const step = barStepPx();
|
|
106
|
+
|
|
107
|
+
scrollOffsetRef.current += scrollSpeedPxPerSec() * dt;
|
|
108
|
+
while (scrollOffsetRef.current >= step) {
|
|
109
|
+
scrollOffsetRef.current -= step;
|
|
110
|
+
pushBar();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
track.style.transform = `translate3d(${-scrollOffsetRef.current}px, 0, 0)`;
|
|
114
|
+
rafId = requestAnimationFrame(tick);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
rafId = requestAnimationFrame(tick);
|
|
118
|
+
return () => {
|
|
119
|
+
cancelAnimationFrame(rafId);
|
|
120
|
+
barsRef.current = [];
|
|
121
|
+
bucketRef.current = { sum: 0, count: 0 };
|
|
122
|
+
scrollOffsetRef.current = 0;
|
|
123
|
+
if (trackRef.current) trackRef.current.style.transform = "translateX(0)";
|
|
124
|
+
};
|
|
125
|
+
}, [enabled]);
|
|
126
|
+
|
|
127
|
+
if (!enabled) return null;
|
|
128
|
+
|
|
129
|
+
const bars = barsRef.current;
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<span className="ephia-transcribe-standard-placeholder" data-ephia-ui="standard-intensity" aria-hidden>
|
|
133
|
+
<span ref={rectRef} className="ephia-transcribe-standard-placeholder__rect">
|
|
134
|
+
<span className="ephia-transcribe-standard-placeholder__viewport">
|
|
135
|
+
<span ref={trackRef} className="ephia-transcribe-standard-placeholder__track">
|
|
136
|
+
{bars.map((barLevel, index) => (
|
|
137
|
+
<span
|
|
138
|
+
key={`${barRevision}-${index}`}
|
|
139
|
+
className="ephia-transcribe-standard-placeholder__history-bar"
|
|
140
|
+
style={{ height: `${barHeightRatio(barLevel) * 100}%` }}
|
|
141
|
+
/>
|
|
142
|
+
))}
|
|
143
|
+
</span>
|
|
144
|
+
</span>
|
|
145
|
+
</span>
|
|
146
|
+
</span>
|
|
147
|
+
);
|
|
148
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Border radius presets for {@link EphiaFloatingButton}. */
|
|
2
|
+
export type EphiaFloatingButtonBorderRadius = "sm" | "md" | "lg" | "full";
|
|
3
|
+
|
|
4
|
+
export const EPHIA_FLOATING_BUTTON_RADIUS_CSS: Record<EphiaFloatingButtonBorderRadius, string> = {
|
|
5
|
+
sm: "0.375rem",
|
|
6
|
+
md: "0.625rem",
|
|
7
|
+
lg: "1rem",
|
|
8
|
+
full: "9999px",
|
|
9
|
+
};
|