@mihe-dev/react 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +68 -2
- package/dist/card.d.ts +21 -0
- package/dist/card.d.ts.map +1 -0
- package/dist/card.js +74 -0
- package/dist/card.js.map +1 -0
- package/dist/hooks.d.ts +189 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +302 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/launcher-icon.d.ts +19 -0
- package/dist/launcher-icon.d.ts.map +1 -0
- package/dist/launcher-icon.js +36 -0
- package/dist/launcher-icon.js.map +1 -0
- package/dist/mark.d.ts +18 -0
- package/dist/mark.d.ts.map +1 -0
- package/dist/mark.js +15 -0
- package/dist/mark.js.map +1 -0
- package/dist/orb.d.ts +56 -0
- package/dist/orb.d.ts.map +1 -0
- package/dist/orb.js +578 -0
- package/dist/orb.js.map +1 -0
- package/dist/provider.d.ts +28 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +52 -0
- package/dist/provider.js.map +1 -0
- package/dist/widget.d.ts +105 -0
- package/dist/widget.d.ts.map +1 -0
- package/dist/widget.js +414 -0
- package/dist/widget.js.map +1 -0
- package/package.json +42 -4
package/dist/orb.js
ADDED
|
@@ -0,0 +1,578 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* The orb: the widget as a circle, and voice shown in the circle itself
|
|
4
|
+
* (amendment 61).
|
|
5
|
+
*
|
|
6
|
+
* Tapping it opens a small menu, chat and whichever voice modes the app
|
|
7
|
+
* allows, or goes straight to chat when chat is the only one. Chat opens the
|
|
8
|
+
* panel. Voice stays in the orb, which is the point of it: with the panel out
|
|
9
|
+
* of the way, the user watches their own page being navigated, highlighted and
|
|
10
|
+
* changed, instead of reading about it in a transcript.
|
|
11
|
+
*
|
|
12
|
+
* Two things the orb must still show, because collapsing the panel is not a
|
|
13
|
+
* licence to hide them:
|
|
14
|
+
*
|
|
15
|
+
* - **The confirmation card**, anchored to the orb, rendered from the proposal
|
|
16
|
+
* payload exactly as the panel renders it. High-risk actions need that tap
|
|
17
|
+
* in every mode.
|
|
18
|
+
* - **Refusals and errors**, in a bubble above it.
|
|
19
|
+
*
|
|
20
|
+
* Live captions are not shown. Streamed transcript text never kept pace with
|
|
21
|
+
* the voice, and a caption that lags what you hear reads as broken. Finished
|
|
22
|
+
* lines still land in the conversation, and `voice.caption` is still exposed
|
|
23
|
+
* for a host that wants to draw its own.
|
|
24
|
+
*
|
|
25
|
+
* Tap, hold and drag share one element, so a press is read like this:
|
|
26
|
+
*
|
|
27
|
+
* | Mode | Tap | Hold | Drag past 8px |
|
|
28
|
+
* |--------------|--------------------------|--------------------------|--------------------------|
|
|
29
|
+
* | Idle | menu, or chat | nothing | moves it, if draggable |
|
|
30
|
+
* | Menu open | closes it | nothing | nothing |
|
|
31
|
+
* | Hands-free | ends the session | nothing | moves it, if draggable |
|
|
32
|
+
* | Push-to-talk | nothing | records, release sends | discards, then moves it |
|
|
33
|
+
*
|
|
34
|
+
* Push-to-talk records from the moment the finger goes down, so the first word
|
|
35
|
+
* is not lost. On a draggable orb the first 150ms are held on the device
|
|
36
|
+
* rather than sent: still, they are sent and recording carries on; moved, they
|
|
37
|
+
* are dropped and never leave the browser.
|
|
38
|
+
*/
|
|
39
|
+
import { useCallback, useEffect, useRef, useState, } from "react";
|
|
40
|
+
import { ConfirmationCard } from "./card.js";
|
|
41
|
+
import { LAUNCHER_BG, LAUNCHER_INK, LAUNCHER_VOICE, LauncherIcon } from "./launcher-icon.js";
|
|
42
|
+
import { useAssistant } from "./provider.js";
|
|
43
|
+
const SIZE = 56;
|
|
44
|
+
const MARGIN = 20;
|
|
45
|
+
const DRAG_THRESHOLD = 8;
|
|
46
|
+
/** How long a press is held on the device before it counts as speech. */
|
|
47
|
+
const HOLD_WINDOW_MS = 150;
|
|
48
|
+
const POSITION_KEY = "mihe:orb-position";
|
|
49
|
+
const HINT_KEY = "mihe:hold-hint-done";
|
|
50
|
+
function readRest() {
|
|
51
|
+
try {
|
|
52
|
+
const raw = window.localStorage.getItem(POSITION_KEY);
|
|
53
|
+
if (!raw)
|
|
54
|
+
return null;
|
|
55
|
+
const parsed = JSON.parse(raw);
|
|
56
|
+
if ((parsed.side === "left" || parsed.side === "right") && typeof parsed.y === "number") {
|
|
57
|
+
return parsed;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
// Private windows and blocked storage: fall back to the corner.
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
function writeRest(rest) {
|
|
66
|
+
try {
|
|
67
|
+
window.localStorage.setItem(POSITION_KEY, JSON.stringify(rest));
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
// Remembering is a convenience; forgetting is fine.
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function hintDone() {
|
|
74
|
+
try {
|
|
75
|
+
return window.localStorage.getItem(HINT_KEY) === "1";
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function markHintDone() {
|
|
82
|
+
try {
|
|
83
|
+
window.localStorage.setItem(HINT_KEY, "1");
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
// Shown again next time, which is harmless.
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function useViewport() {
|
|
90
|
+
const read = () => ({
|
|
91
|
+
width: typeof window === "undefined" ? 1024 : window.innerWidth,
|
|
92
|
+
height: typeof window === "undefined" ? 768 : window.innerHeight,
|
|
93
|
+
});
|
|
94
|
+
const [size, setSize] = useState(read);
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
const onResize = () => setSize(read());
|
|
97
|
+
window.addEventListener("resize", onResize);
|
|
98
|
+
return () => window.removeEventListener("resize", onResize);
|
|
99
|
+
}, []);
|
|
100
|
+
return size;
|
|
101
|
+
}
|
|
102
|
+
function usePrefersReducedMotion() {
|
|
103
|
+
const [reduced, setReduced] = useState(false);
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
if (typeof window === "undefined" || !window.matchMedia)
|
|
106
|
+
return;
|
|
107
|
+
const query = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
108
|
+
setReduced(query.matches);
|
|
109
|
+
const onChange = () => setReduced(query.matches);
|
|
110
|
+
query.addEventListener?.("change", onChange);
|
|
111
|
+
return () => query.removeEventListener?.("change", onChange);
|
|
112
|
+
}, []);
|
|
113
|
+
return reduced;
|
|
114
|
+
}
|
|
115
|
+
export function Orb({ heading, launcherIcon, draggable, corner, voiceModes, showOrb, renderPanel, }) {
|
|
116
|
+
const { isOpen, open, voice, proposals, respondToProposal, lastError, connection, launcherIconUrl, } = useAssistant();
|
|
117
|
+
const viewport = useViewport();
|
|
118
|
+
const reducedMotion = usePrefersReducedMotion();
|
|
119
|
+
const [menuOpen, setMenuOpen] = useState(false);
|
|
120
|
+
const [rest, setRest] = useState(null);
|
|
121
|
+
const [drag, setDrag] = useState(null);
|
|
122
|
+
const [showHint, setShowHint] = useState(false);
|
|
123
|
+
const orbRef = useRef(null);
|
|
124
|
+
const ringRef = useRef(null);
|
|
125
|
+
const menuRef = useRef(null);
|
|
126
|
+
// Read after mount, not during render: storage is a browser thing, and a
|
|
127
|
+
// server-rendered first paint must match the client's.
|
|
128
|
+
useEffect(() => {
|
|
129
|
+
if (draggable)
|
|
130
|
+
setRest(readRest());
|
|
131
|
+
setShowHint(!hintDone());
|
|
132
|
+
}, [draggable]);
|
|
133
|
+
const voiceLive = voice.state !== "idle" && voice.state !== "error";
|
|
134
|
+
const handsFree = voiceLive && voice.handsFree;
|
|
135
|
+
const holdToTalk = voiceLive && !voice.handsFree;
|
|
136
|
+
const allowed = voice.available ? voiceModes : [];
|
|
137
|
+
const menuItems = [
|
|
138
|
+
{ key: "chat", label: "Chat" },
|
|
139
|
+
...(allowed.includes("hands-free") ? [{ key: "hands-free", label: "Talk" }] : []),
|
|
140
|
+
...(allowed.includes("hold") ? [{ key: "hold", label: "Hold to talk" }] : []),
|
|
141
|
+
];
|
|
142
|
+
// ------------------------------------------------------------ position
|
|
143
|
+
const restingLeft = (side) => side === "left" ? MARGIN : viewport.width - MARGIN - SIZE;
|
|
144
|
+
const clampTop = (top) => Math.min(Math.max(MARGIN, top), Math.max(MARGIN, viewport.height - MARGIN - SIZE));
|
|
145
|
+
const side = drag
|
|
146
|
+
? drag.left + SIZE / 2 < viewport.width / 2
|
|
147
|
+
? "left"
|
|
148
|
+
: "right"
|
|
149
|
+
: (rest?.side ?? (corner === "bottom-left" ? "left" : "right"));
|
|
150
|
+
const left = drag ? drag.left : restingLeft(side);
|
|
151
|
+
const top = drag
|
|
152
|
+
? drag.top
|
|
153
|
+
: clampTop(rest ? rest.y * viewport.height : viewport.height - MARGIN - SIZE);
|
|
154
|
+
/** Which way is into the page, from the orb. */
|
|
155
|
+
const inward = side === "right" ? -1 : 1;
|
|
156
|
+
/** Whether things open above the orb, or below it when it sits high. */
|
|
157
|
+
const above = top + SIZE / 2 > viewport.height / 2;
|
|
158
|
+
// ------------------------------------------------------------ the ring
|
|
159
|
+
// Follows the voice level without re-rendering: a level arrives tens of
|
|
160
|
+
// times a second, and each one only needs to move one element.
|
|
161
|
+
useEffect(() => {
|
|
162
|
+
if (!voiceLive || reducedMotion) {
|
|
163
|
+
if (ringRef.current)
|
|
164
|
+
ringRef.current.style.transform = "scale(1)";
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
let target = 0;
|
|
168
|
+
let current = 0;
|
|
169
|
+
let frame = 0;
|
|
170
|
+
const unsubscribe = voice.onLevel((source, level) => {
|
|
171
|
+
// Only the side whose turn it is moves the ring.
|
|
172
|
+
if (source === "user" && (voice.state === "recording" || voice.handsFree))
|
|
173
|
+
target = level;
|
|
174
|
+
if (source === "assistant")
|
|
175
|
+
target = level;
|
|
176
|
+
});
|
|
177
|
+
const tick = () => {
|
|
178
|
+
// Quick to rise, slow to fall, which reads as breathing rather than
|
|
179
|
+
// flicker.
|
|
180
|
+
current += (target - current) * (target > current ? 0.45 : 0.12);
|
|
181
|
+
target *= 0.92;
|
|
182
|
+
if (ringRef.current) {
|
|
183
|
+
ringRef.current.style.transform = `scale(${1 + current * 0.38})`;
|
|
184
|
+
}
|
|
185
|
+
frame = requestAnimationFrame(tick);
|
|
186
|
+
};
|
|
187
|
+
frame = requestAnimationFrame(tick);
|
|
188
|
+
return () => {
|
|
189
|
+
unsubscribe();
|
|
190
|
+
cancelAnimationFrame(frame);
|
|
191
|
+
};
|
|
192
|
+
}, [voiceLive, reducedMotion, voice]);
|
|
193
|
+
// ------------------------------------------------------------ the hint
|
|
194
|
+
// "Hold to talk" stays until the first recording that reached the model,
|
|
195
|
+
// which is the moment a recording goes to `thinking`.
|
|
196
|
+
const previousState = useRef(voice.state);
|
|
197
|
+
useEffect(() => {
|
|
198
|
+
if (previousState.current === "recording" && voice.state === "thinking") {
|
|
199
|
+
markHintDone();
|
|
200
|
+
setShowHint(false);
|
|
201
|
+
}
|
|
202
|
+
previousState.current = voice.state;
|
|
203
|
+
}, [voice.state]);
|
|
204
|
+
// ------------------------------------------------------------ the bubble
|
|
205
|
+
const bubble = voice.state === "connecting"
|
|
206
|
+
? { text: "Setting up the microphone…", tone: "quiet" }
|
|
207
|
+
: lastError && (voiceLive || voice.state === "error")
|
|
208
|
+
? { text: lastError, tone: "error" }
|
|
209
|
+
: voice.notice
|
|
210
|
+
? { text: voice.notice, tone: "quiet" }
|
|
211
|
+
: holdToTalk && showHint && voice.state === "listening"
|
|
212
|
+
? { text: "Hold to talk", tone: "quiet" }
|
|
213
|
+
: null;
|
|
214
|
+
// ------------------------------------------------------------ the menu
|
|
215
|
+
useEffect(() => {
|
|
216
|
+
if (!menuOpen)
|
|
217
|
+
return;
|
|
218
|
+
// Focus moves into the menu so the arrow keys and Esc work at once.
|
|
219
|
+
const first = menuRef.current?.querySelector("button");
|
|
220
|
+
first?.focus();
|
|
221
|
+
const onPointerDown = (event) => {
|
|
222
|
+
const target = event.target;
|
|
223
|
+
if (!menuRef.current?.contains(target) && !orbRef.current?.contains(target)) {
|
|
224
|
+
setMenuOpen(false);
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
document.addEventListener("pointerdown", onPointerDown);
|
|
228
|
+
return () => document.removeEventListener("pointerdown", onPointerDown);
|
|
229
|
+
}, [menuOpen]);
|
|
230
|
+
const choose = (key) => {
|
|
231
|
+
setMenuOpen(false);
|
|
232
|
+
if (key === "chat") {
|
|
233
|
+
open();
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
// Entering a voice mode asks for the microphone now, so the browser's
|
|
237
|
+
// permission prompt does not swallow the first hold.
|
|
238
|
+
voice.start({ handsFree: key === "hands-free", openPanel: false });
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
const onMenuKeyDown = (event) => {
|
|
242
|
+
const buttons = Array.from(menuRef.current?.querySelectorAll("button") ?? []);
|
|
243
|
+
const index = buttons.indexOf(document.activeElement);
|
|
244
|
+
if (event.key === "Escape") {
|
|
245
|
+
event.preventDefault();
|
|
246
|
+
setMenuOpen(false);
|
|
247
|
+
orbRef.current?.focus();
|
|
248
|
+
}
|
|
249
|
+
else if (event.key === "ArrowDown" || event.key === "ArrowRight") {
|
|
250
|
+
event.preventDefault();
|
|
251
|
+
buttons[(index + 1) % buttons.length]?.focus();
|
|
252
|
+
}
|
|
253
|
+
else if (event.key === "ArrowUp" || event.key === "ArrowLeft") {
|
|
254
|
+
event.preventDefault();
|
|
255
|
+
buttons[(index - 1 + buttons.length) % buttons.length]?.focus();
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
// ------------------------------------------------------------ the orb itself
|
|
259
|
+
const tap = useCallback(() => {
|
|
260
|
+
if (menuOpen) {
|
|
261
|
+
setMenuOpen(false);
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
if (handsFree) {
|
|
265
|
+
// Tapping stops rather than pauses: a hands-free session is billed for
|
|
266
|
+
// every second it is open, so a pause that kept it open would still cost.
|
|
267
|
+
voice.stop();
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
if (holdToTalk)
|
|
271
|
+
return; // a tap in push-to-talk is too short to be speech
|
|
272
|
+
if (menuItems.length === 1)
|
|
273
|
+
open();
|
|
274
|
+
else
|
|
275
|
+
setMenuOpen(true);
|
|
276
|
+
}, [menuOpen, handsFree, holdToTalk, menuItems.length, open, voice]);
|
|
277
|
+
const press = useRef(null);
|
|
278
|
+
const onPointerDown = (event) => {
|
|
279
|
+
if (event.button !== 0)
|
|
280
|
+
return;
|
|
281
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
282
|
+
const state = {
|
|
283
|
+
x: event.clientX,
|
|
284
|
+
y: event.clientY,
|
|
285
|
+
offsetX: event.clientX - left,
|
|
286
|
+
offsetY: event.clientY - top,
|
|
287
|
+
dragging: false,
|
|
288
|
+
recording: null,
|
|
289
|
+
timer: null,
|
|
290
|
+
};
|
|
291
|
+
press.current = state;
|
|
292
|
+
if (holdToTalk && (voice.state === "listening" || voice.state === "speaking")) {
|
|
293
|
+
if (draggable) {
|
|
294
|
+
// Held on the device until it is clear this is speech, not a drag.
|
|
295
|
+
voice.press({ hold: true });
|
|
296
|
+
state.recording = "held";
|
|
297
|
+
state.timer = setTimeout(() => {
|
|
298
|
+
if (press.current === state && !state.dragging) {
|
|
299
|
+
voice.confirm();
|
|
300
|
+
state.recording = "live";
|
|
301
|
+
}
|
|
302
|
+
}, HOLD_WINDOW_MS);
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
voice.press();
|
|
306
|
+
state.recording = "live";
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
const onPointerMove = (event) => {
|
|
311
|
+
const state = press.current;
|
|
312
|
+
if (!state || !draggable || menuOpen)
|
|
313
|
+
return;
|
|
314
|
+
// Once a recording is live, the finger is holding a microphone, not the orb.
|
|
315
|
+
if (state.recording === "live")
|
|
316
|
+
return;
|
|
317
|
+
const moved = Math.hypot(event.clientX - state.x, event.clientY - state.y);
|
|
318
|
+
if (!state.dragging && moved > DRAG_THRESHOLD) {
|
|
319
|
+
state.dragging = true;
|
|
320
|
+
if (state.recording === "held") {
|
|
321
|
+
if (state.timer)
|
|
322
|
+
clearTimeout(state.timer);
|
|
323
|
+
voice.discard();
|
|
324
|
+
state.recording = null;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
if (state.dragging) {
|
|
328
|
+
setDrag({
|
|
329
|
+
left: Math.min(Math.max(0, event.clientX - state.offsetX), viewport.width - SIZE),
|
|
330
|
+
top: Math.min(Math.max(0, event.clientY - state.offsetY), viewport.height - SIZE),
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
const finish = (cancelled) => {
|
|
335
|
+
const state = press.current;
|
|
336
|
+
press.current = null;
|
|
337
|
+
if (!state)
|
|
338
|
+
return;
|
|
339
|
+
if (state.timer)
|
|
340
|
+
clearTimeout(state.timer);
|
|
341
|
+
if (state.dragging && drag) {
|
|
342
|
+
// Snap to the nearer side, and keep the height.
|
|
343
|
+
const next = {
|
|
344
|
+
side: drag.left + SIZE / 2 < viewport.width / 2 ? "left" : "right",
|
|
345
|
+
y: clampTop(drag.top) / viewport.height,
|
|
346
|
+
};
|
|
347
|
+
setRest(next);
|
|
348
|
+
writeRest(next);
|
|
349
|
+
setDrag(null);
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
setDrag(null);
|
|
353
|
+
if (state.recording) {
|
|
354
|
+
// Released: a held press that never moved is speech too.
|
|
355
|
+
voice.release();
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
if (!cancelled)
|
|
359
|
+
tap();
|
|
360
|
+
};
|
|
361
|
+
const onKeyDown = (event) => {
|
|
362
|
+
if (event.repeat)
|
|
363
|
+
return;
|
|
364
|
+
if (holdToTalk && event.key === " ") {
|
|
365
|
+
event.preventDefault();
|
|
366
|
+
if (voice.state === "listening" || voice.state === "speaking")
|
|
367
|
+
voice.press();
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
371
|
+
event.preventDefault();
|
|
372
|
+
tap();
|
|
373
|
+
}
|
|
374
|
+
if (event.key === "Escape" && voiceLive) {
|
|
375
|
+
event.preventDefault();
|
|
376
|
+
voice.stop();
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
const onKeyUp = (event) => {
|
|
380
|
+
if (holdToTalk && event.key === " ") {
|
|
381
|
+
event.preventDefault();
|
|
382
|
+
voice.release();
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
// Chat open: the panel takes the orb's place, on the orb's side.
|
|
386
|
+
if (isOpen) {
|
|
387
|
+
return (_jsx(_Fragment, { children: renderPanel({
|
|
388
|
+
position: "fixed",
|
|
389
|
+
bottom: MARGIN,
|
|
390
|
+
[side]: MARGIN,
|
|
391
|
+
width: `min(380px, calc(100vw - ${MARGIN * 2}px))`,
|
|
392
|
+
height: `min(560px, calc(100vh - ${MARGIN * 2}px))`,
|
|
393
|
+
zIndex: 2147482000,
|
|
394
|
+
}) }));
|
|
395
|
+
}
|
|
396
|
+
if (!showOrb)
|
|
397
|
+
return null;
|
|
398
|
+
const ringState = !voiceLive
|
|
399
|
+
? "idle"
|
|
400
|
+
: voice.state === "connecting"
|
|
401
|
+
? "connecting"
|
|
402
|
+
: voice.state === "thinking"
|
|
403
|
+
? "thinking"
|
|
404
|
+
: voice.state === "recording"
|
|
405
|
+
? "recording"
|
|
406
|
+
: voice.state === "speaking"
|
|
407
|
+
? "speaking"
|
|
408
|
+
: "listening";
|
|
409
|
+
const label = handsFree
|
|
410
|
+
? `Stop talking to ${heading}`
|
|
411
|
+
: holdToTalk
|
|
412
|
+
? voice.state === "recording"
|
|
413
|
+
? "Release to send"
|
|
414
|
+
: "Hold to talk"
|
|
415
|
+
: menuItems.length === 1
|
|
416
|
+
? `Open ${heading}`
|
|
417
|
+
: `${heading}: choose chat or voice`;
|
|
418
|
+
// Floating things open beside the orb, towards the page and away from the
|
|
419
|
+
// nearer edge, so nothing is drawn off-screen wherever it has been dragged.
|
|
420
|
+
const popover = {
|
|
421
|
+
position: "fixed",
|
|
422
|
+
[side]: MARGIN,
|
|
423
|
+
...(above
|
|
424
|
+
? { bottom: viewport.height - top + 12 }
|
|
425
|
+
: { top: top + SIZE + 12 }),
|
|
426
|
+
maxWidth: `min(340px, calc(100vw - ${MARGIN * 2}px))`,
|
|
427
|
+
zIndex: 2147482001,
|
|
428
|
+
};
|
|
429
|
+
return (_jsxs(_Fragment, { children: [_jsx("style", { children: ORB_KEYFRAMES }), menuOpen && (_jsx("div", { ref: menuRef, role: "menu", "aria-label": heading, onKeyDown: onMenuKeyDown, style: {
|
|
430
|
+
...popover,
|
|
431
|
+
display: "flex",
|
|
432
|
+
flexDirection: above ? "column-reverse" : "column",
|
|
433
|
+
alignItems: side === "right" ? "flex-end" : "flex-start",
|
|
434
|
+
gap: 8,
|
|
435
|
+
}, children: menuItems.map((item) => (_jsxs("button", { type: "button", role: "menuitem", onClick: () => choose(item.key), style: styles.menuItem, children: [_jsx("span", { "aria-hidden": "true", style: styles.menuIcon, children: item.key === "chat" ? _jsx(ChatIcon, {}) : item.key === "hold" ? _jsx(MicIcon, {}) : _jsx(WaveIcon, {}) }), item.label] }, item.key))) })), !menuOpen && proposals.length > 0 && (
|
|
436
|
+
// The card, out of the orb. The session waits for this tap, and the
|
|
437
|
+
// card is the same component the panel draws, from the same payload.
|
|
438
|
+
_jsx("div", { style: { ...popover, display: "flex", flexDirection: "column", gap: 8, width: 320 }, children: proposals.map((proposal) => (_jsx(ConfirmationCard, { proposal: proposal, onRespond: respondToProposal }, proposal.proposalId))) })), !menuOpen && proposals.length === 0 && bubble && (_jsx("div", { role: "status", "aria-live": "polite", style: {
|
|
439
|
+
...popover,
|
|
440
|
+
...styles.bubble,
|
|
441
|
+
...(bubble.tone === "error" ? styles.bubbleError : null),
|
|
442
|
+
}, children: bubble.text })), _jsxs("button", { ref: orbRef, type: "button", "aria-label": label, "aria-haspopup": menuItems.length > 1 && !voiceLive ? "menu" : undefined, "aria-expanded": menuItems.length > 1 && !voiceLive ? menuOpen : undefined, "aria-pressed": holdToTalk ? voice.state === "recording" : undefined, "aria-busy": voice.state === "connecting", disabled: connection !== "open" && !voiceLive, onPointerDown: onPointerDown, onPointerMove: onPointerMove, onPointerUp: () => finish(false), onPointerCancel: () => finish(true), onKeyDown: onKeyDown, onKeyUp: onKeyUp, onContextMenu: (event) => event.preventDefault(), style: {
|
|
443
|
+
...styles.orb,
|
|
444
|
+
left,
|
|
445
|
+
top,
|
|
446
|
+
cursor: drag ? "grabbing" : "pointer",
|
|
447
|
+
transition: drag ? "none" : "left 180ms ease, top 180ms ease",
|
|
448
|
+
}, children: [_jsx("span", { ref: ringRef, "aria-hidden": "true", className: `mihe-orb-ring mihe-orb-${ringState}`, style: {
|
|
449
|
+
...styles.ring,
|
|
450
|
+
...(ringState === "idle" ? styles.ringIdle : null),
|
|
451
|
+
...(ringState === "recording" ? styles.ringRecording : null),
|
|
452
|
+
...(ringState === "thinking" || ringState === "connecting"
|
|
453
|
+
? styles.ringDashed
|
|
454
|
+
: null),
|
|
455
|
+
} }), _jsx("span", { style: styles.face, children: launcherIcon ?? _jsx(LauncherIcon, { url: launcherIconUrl }) })] }), voiceLive && (
|
|
456
|
+
// Always a visible way out that is not a gesture. It ends the
|
|
457
|
+
// session in either mode.
|
|
458
|
+
_jsx("button", { type: "button", "aria-label": "End voice", onClick: () => voice.stop(), style: {
|
|
459
|
+
...styles.stop,
|
|
460
|
+
left: left + (inward === -1 ? -52 : SIZE + 8),
|
|
461
|
+
top: top + (SIZE - 44) / 2,
|
|
462
|
+
}, children: _jsx("span", { "aria-hidden": "true", style: styles.stopSquare }) }))] }));
|
|
463
|
+
}
|
|
464
|
+
function ChatIcon() {
|
|
465
|
+
return (_jsx("svg", { viewBox: "0 0 20 20", width: "18", height: "18", fill: "none", stroke: "currentColor", strokeWidth: "1.7", strokeLinejoin: "round", children: _jsx("path", { d: "M4 4.5h12a1.5 1.5 0 0 1 1.5 1.5v7a1.5 1.5 0 0 1-1.5 1.5H9l-4 3v-3H4A1.5 1.5 0 0 1 2.5 13V6A1.5 1.5 0 0 1 4 4.5Z" }) }));
|
|
466
|
+
}
|
|
467
|
+
function MicIcon() {
|
|
468
|
+
return (_jsxs("svg", { viewBox: "0 0 20 20", width: "18", height: "18", fill: "none", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round", children: [_jsx("rect", { x: "7", y: "2.5", width: "6", height: "10", rx: "3" }), _jsx("path", { d: "M4.5 9.5a5.5 5.5 0 0 0 11 0M10 15v2.5" })] }));
|
|
469
|
+
}
|
|
470
|
+
function WaveIcon() {
|
|
471
|
+
return (_jsx("svg", { viewBox: "0 0 20 20", width: "18", height: "18", fill: "none", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round", children: _jsx("path", { d: "M3 10v0M6.5 7v6M10 4v12M13.5 7v6M17 10v0" }) }));
|
|
472
|
+
}
|
|
473
|
+
/*
|
|
474
|
+
* Inline styles cannot declare keyframes, so the few the ring needs are here.
|
|
475
|
+
* Reduced motion drops them: a colour and the dashed border still say what
|
|
476
|
+
* the ring would have shown moving.
|
|
477
|
+
*/
|
|
478
|
+
const ORB_KEYFRAMES = `
|
|
479
|
+
@keyframes mihe-orb-breathe { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
|
|
480
|
+
@keyframes mihe-orb-spin { to { rotate: 360deg; } }
|
|
481
|
+
.mihe-orb-listening { animation: mihe-orb-breathe 2.4s ease-in-out infinite; }
|
|
482
|
+
.mihe-orb-thinking { animation: mihe-orb-spin 1.2s linear infinite; }
|
|
483
|
+
.mihe-orb-connecting { animation: mihe-orb-spin 2.4s linear infinite; }
|
|
484
|
+
@media (prefers-reduced-motion: reduce) {
|
|
485
|
+
.mihe-orb-ring { animation: none !important; transform: none !important; }
|
|
486
|
+
}
|
|
487
|
+
`;
|
|
488
|
+
const FONT = "system-ui, -apple-system, 'Segoe UI', sans-serif";
|
|
489
|
+
const styles = {
|
|
490
|
+
orb: {
|
|
491
|
+
position: "fixed",
|
|
492
|
+
width: SIZE,
|
|
493
|
+
height: SIZE,
|
|
494
|
+
padding: 0,
|
|
495
|
+
border: "none",
|
|
496
|
+
borderRadius: "50%",
|
|
497
|
+
background: LAUNCHER_BG,
|
|
498
|
+
color: LAUNCHER_INK,
|
|
499
|
+
boxShadow: "0 8px 24px rgba(15,23,42,0.25)",
|
|
500
|
+
zIndex: 2147482000,
|
|
501
|
+
// Holding a finger down must record, not select text or open a menu.
|
|
502
|
+
touchAction: "none",
|
|
503
|
+
userSelect: "none",
|
|
504
|
+
WebkitUserSelect: "none",
|
|
505
|
+
WebkitTouchCallout: "none",
|
|
506
|
+
WebkitTapHighlightColor: "transparent",
|
|
507
|
+
},
|
|
508
|
+
face: {
|
|
509
|
+
position: "absolute",
|
|
510
|
+
inset: 0,
|
|
511
|
+
display: "grid",
|
|
512
|
+
placeItems: "center",
|
|
513
|
+
borderRadius: "50%",
|
|
514
|
+
overflow: "hidden",
|
|
515
|
+
pointerEvents: "none",
|
|
516
|
+
},
|
|
517
|
+
// Around the icon, not the icon itself: an uploaded icon could be anything.
|
|
518
|
+
ring: {
|
|
519
|
+
position: "absolute",
|
|
520
|
+
inset: -6,
|
|
521
|
+
borderRadius: "50%",
|
|
522
|
+
border: `2px solid ${LAUNCHER_VOICE}`,
|
|
523
|
+
pointerEvents: "none",
|
|
524
|
+
transformOrigin: "center",
|
|
525
|
+
willChange: "transform",
|
|
526
|
+
},
|
|
527
|
+
ringIdle: { borderColor: "transparent" },
|
|
528
|
+
ringRecording: { borderColor: "#e5484d", borderWidth: 3 },
|
|
529
|
+
ringDashed: { borderStyle: "dashed" },
|
|
530
|
+
stop: {
|
|
531
|
+
position: "fixed",
|
|
532
|
+
width: 44,
|
|
533
|
+
height: 44,
|
|
534
|
+
borderRadius: "50%",
|
|
535
|
+
border: "1px solid rgba(15,23,42,0.12)",
|
|
536
|
+
background: "#fff",
|
|
537
|
+
boxShadow: "0 4px 14px rgba(15,23,42,0.18)",
|
|
538
|
+
display: "grid",
|
|
539
|
+
placeItems: "center",
|
|
540
|
+
cursor: "pointer",
|
|
541
|
+
zIndex: 2147482000,
|
|
542
|
+
},
|
|
543
|
+
stopSquare: { width: 12, height: 12, borderRadius: 2, background: "#0f172a" },
|
|
544
|
+
menuItem: {
|
|
545
|
+
display: "inline-flex",
|
|
546
|
+
alignItems: "center",
|
|
547
|
+
gap: 10,
|
|
548
|
+
minHeight: 44,
|
|
549
|
+
padding: "0 16px 0 6px",
|
|
550
|
+
borderRadius: 999,
|
|
551
|
+
border: "1px solid rgba(15,23,42,0.1)",
|
|
552
|
+
background: "#fff",
|
|
553
|
+
color: "#0f172a",
|
|
554
|
+
boxShadow: "0 6px 18px rgba(15,23,42,0.16)",
|
|
555
|
+
cursor: "pointer",
|
|
556
|
+
font: `500 14px ${FONT}`,
|
|
557
|
+
},
|
|
558
|
+
menuIcon: {
|
|
559
|
+
display: "grid",
|
|
560
|
+
placeItems: "center",
|
|
561
|
+
width: 34,
|
|
562
|
+
height: 34,
|
|
563
|
+
borderRadius: "50%",
|
|
564
|
+
background: LAUNCHER_BG,
|
|
565
|
+
color: LAUNCHER_VOICE,
|
|
566
|
+
},
|
|
567
|
+
bubble: {
|
|
568
|
+
padding: "8px 12px",
|
|
569
|
+
borderRadius: 12,
|
|
570
|
+
background: "#fff",
|
|
571
|
+
color: "#0f172a",
|
|
572
|
+
border: "1px solid rgba(15,23,42,0.1)",
|
|
573
|
+
boxShadow: "0 6px 18px rgba(15,23,42,0.16)",
|
|
574
|
+
font: `14px/1.45 ${FONT}`,
|
|
575
|
+
},
|
|
576
|
+
bubbleError: { background: "#fef2f2", color: "#991b1b", borderColor: "#fecaca" },
|
|
577
|
+
};
|
|
578
|
+
//# sourceMappingURL=orb.js.map
|
package/dist/orb.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orb.js","sourceRoot":"","sources":["../../../react/src/orb.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,EACL,WAAW,EACX,SAAS,EACT,MAAM,EACN,QAAQ,GAKT,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAoB1C,MAAM,IAAI,GAAG,EAAE,CAAC;AAChB,MAAM,MAAM,GAAG,EAAE,CAAC;AAClB,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,yEAAyE;AACzE,MAAM,cAAc,GAAG,GAAG,CAAC;AAE3B,MAAM,YAAY,GAAG,mBAAmB,CAAC;AACzC,MAAM,QAAQ,GAAG,qBAAqB,CAAC;AASvC,SAAS,QAAQ;IACf,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACtD,IAAI,CAAC,GAAG;YAAE,OAAO,IAAI,CAAC;QACtB,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAS,CAAC;QACvC,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,MAAM,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,CAAC,IAAI,OAAO,MAAM,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;YACxF,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,aAAa;QACtB,UAAU,EAAE,QAAQ;QACpB,GAAG,EAAE,EAAE;QACP,SAAS,EAAE,EAAE;QACb,OAAO,EAAE,cAAc;QACvB,YAAY,EAAE,GAAG;QACjB,MAAM,EAAE,8BAA8B;QACtC,UAAU,EAAE,MAAM;QAClB,KAAK,EAAE,SAAS;QAChB,SAAS,EAAE,gCAAgC;QAC3C,MAAM,EAAE,SAAS;QACjB,IAAI,EAAE,YAAY,IAAI,EAAE;KACzB;IACD,QAAQ,EAAE;QACR,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,QAAQ;QACpB,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,YAAY,EAAE,KAAK;QACnB,UAAU,EAAE,WAAW;QACvB,KAAK,EAAE,cAAc;KACtB;IACD,MAAM,EAAE;QACN,OAAO,EAAE,UAAU;QACnB,YAAY,EAAE,EAAE;QAChB,UAAU,EAAE,MAAM;QAClB,KAAK,EAAE,SAAS;QAChB,MAAM,EAAE,8BAA8B;QACtC,SAAS,EAAE,gCAAgC;QAC3C,IAAI,EAAE,aAAa,IAAI,EAAE;KAC1B;IACD,WAAW,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE;CACzC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `AssistantProvider` — the React binding of `Mihe` (doc 08).
|
|
3
|
+
*
|
|
4
|
+
* Everything the assistant does — the session, the screen publishing, the
|
|
5
|
+
* commands, the cards, voice — lives in `@mihe-dev/js`. This file only holds one
|
|
6
|
+
* `Mihe` for the tree and reads its state with `useSyncExternalStore`, so
|
|
7
|
+
* the React SDK and the JavaScript one cannot behave differently.
|
|
8
|
+
*/
|
|
9
|
+
import { type ReactNode } from "react";
|
|
10
|
+
import { type AssistantStore, type MiheOptions, type MiheState } from "@mihe-dev/js";
|
|
11
|
+
export { SDK_VERSION, ASSISTANT_PANEL_ID } from "@mihe-dev/js";
|
|
12
|
+
export type { ChatMessage, VoiceControls } from "@mihe-dev/js";
|
|
13
|
+
export interface AssistantContextValue extends MiheState {
|
|
14
|
+
store: AssistantStore;
|
|
15
|
+
send: (text: string) => void;
|
|
16
|
+
respondToProposal: (proposalId: string, confirmed: boolean) => void;
|
|
17
|
+
open: () => void;
|
|
18
|
+
close: () => void;
|
|
19
|
+
toggle: () => void;
|
|
20
|
+
}
|
|
21
|
+
export interface AssistantProviderProps extends MiheOptions {
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
}
|
|
24
|
+
export declare function AssistantProvider({ url, publicKey, getUserToken, navigate, openModal, onActionComplete, debug, children, }: AssistantProviderProps): import("react").JSX.Element;
|
|
25
|
+
export declare function useAssistant(): AssistantContextValue;
|
|
26
|
+
/** Non-throwing variant, for hooks that should no-op outside the provider. */
|
|
27
|
+
export declare function useOptionalAssistant(): AssistantContextValue | null;
|
|
28
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../react/src/provider.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC/D,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE/D,MAAM,WAAW,qBAAsB,SAAQ,SAAS;IACtD,KAAK,EAAE,cAAc,CAAC;IACtB,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,iBAAiB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACpE,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAID,MAAM,WAAW,sBAAuB,SAAQ,WAAW;IACzD,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,iBAAiB,CAAC,EAChC,GAAG,EACH,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,KAAa,EACb,QAAQ,GACT,EAAE,sBAAsB,+BAkCxB;AAED,wBAAgB,YAAY,IAAI,qBAAqB,CAQpD;AAED,8EAA8E;AAC9E,wBAAgB,oBAAoB,IAAI,qBAAqB,GAAG,IAAI,CAEnE"}
|