@peerbots/face 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/README.md +30 -2
- package/dist/VizijFaceView-3fvAa51G.d.ts +57 -0
- package/dist/chunk-AT25NYX2.js +211 -0
- package/dist/chunk-AT25NYX2.js.map +1 -0
- package/dist/chunk-T7QJ6B66.js +1475 -0
- package/dist/chunk-T7QJ6B66.js.map +1 -0
- package/dist/chunk-XHICGN32.js +62 -0
- package/dist/chunk-XHICGN32.js.map +1 -0
- package/dist/index.cjs +4353 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +525 -0
- package/dist/index.js +1408 -0
- package/dist/index.js.map +1 -0
- package/dist/pixi.cjs +2403 -0
- package/dist/pixi.cjs.map +1 -0
- package/dist/pixi.d.ts +9 -0
- package/dist/pixi.js +882 -0
- package/dist/pixi.js.map +1 -0
- package/dist/vizij.cjs +1546 -0
- package/dist/vizij.cjs.map +1 -0
- package/dist/vizij.d.ts +2 -0
- package/dist/vizij.js +193 -0
- package/dist/vizij.js.map +1 -0
- package/package.json +114 -4
- package/public/FaceAssets/Hugo/cheek.png +0 -0
- package/public/FaceAssets/Hugo/concerned_l.png +0 -0
- package/public/FaceAssets/Hugo/concerned_r.png +0 -0
- package/public/FaceAssets/Hugo/happy_l.png +0 -0
- package/public/FaceAssets/Hugo/happy_r.png +0 -0
- package/public/FaceAssets/Hugo/hugo_spritesheet.json +97 -0
- package/public/FaceAssets/Hugo/hugo_spritesheet.png +0 -0
- package/public/FaceAssets/Hugo/neutral_l.png +0 -0
- package/public/FaceAssets/Hugo/neutral_r.png +0 -0
- package/public/FaceAssets/Hugo/sad_l.png +0 -0
- package/public/FaceAssets/Hugo/sad_r.png +0 -0
- package/public/FaceAssets/Hugo/sleepy_l.png +0 -0
- package/public/FaceAssets/Hugo/sleepy_r.png +0 -0
- package/public/FaceAssets/Hugo/surprised_l.png +0 -0
- package/public/FaceAssets/Hugo/surprised_r.png +0 -0
- package/public/FaceAssets/Icons/Concerned.png +0 -0
- package/public/FaceAssets/Icons/Neutral.png +0 -0
- package/public/FaceAssets/Icons/Sad.png +0 -0
- package/public/FaceAssets/Icons/Sleep.png +0 -0
- package/public/FaceAssets/Icons/Surprised.png +0 -0
- package/public/FaceAssets/Misty/misty_spritesheet.json +97 -0
- package/public/FaceAssets/Misty/misty_spritesheet.png +0 -0
- package/public/FaceAssets/Robotic/robotic_spritesheet.json +97 -0
- package/public/FaceAssets/Robotic/robotic_spritesheet.png +0 -0
- package/public/FaceAssets/Vizij/Hugo.glb +0 -0
- package/public/FaceAssets/Vizij/brand.svg +15 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,525 @@
|
|
|
1
|
+
import { PeerbotsColor } from '@peerbots/core';
|
|
2
|
+
export { PeerbotsColor } from '@peerbots/core';
|
|
3
|
+
import { VizijAssetBundle } from '@vizij/runtime-react';
|
|
4
|
+
import * as react from 'react';
|
|
5
|
+
import { ReactNode } from 'react';
|
|
6
|
+
import { F as FaceUiLabels } from './VizijFaceView-3fvAa51G.js';
|
|
7
|
+
export { D as DEFAULT_FACE_UI_LABELS, V as VizijFaceViewProps, r as resolveFaceUiLabels } from './VizijFaceView-3fvAa51G.js';
|
|
8
|
+
import { PixiElements } from '@pixi/react';
|
|
9
|
+
export { PixiElements } from '@pixi/react';
|
|
10
|
+
import { StateCreator, StoreApi } from 'zustand';
|
|
11
|
+
export { PixiFaceViewProps } from './pixi.js';
|
|
12
|
+
|
|
13
|
+
type FaceColor = PeerbotsColor;
|
|
14
|
+
declare const PEERBOTS_COLORS: readonly PeerbotsColor[];
|
|
15
|
+
type PeerbotsEmotion = "Neutral" | "Surprised" | "Happy" | "Sad" | "Concerned" | "Sleepy";
|
|
16
|
+
type FaceEmotion = PeerbotsEmotion;
|
|
17
|
+
declare const PEERBOTS_EMOTIONS: readonly PeerbotsEmotion[];
|
|
18
|
+
interface FaceMessage {
|
|
19
|
+
title: string;
|
|
20
|
+
speech: string;
|
|
21
|
+
color: PeerbotsColor;
|
|
22
|
+
emotion: PeerbotsEmotion;
|
|
23
|
+
metadata?: Record<string, string | number>;
|
|
24
|
+
}
|
|
25
|
+
declare const DEFAULT_FACE_MESSAGE: FaceMessage;
|
|
26
|
+
declare const CONNECTION_FACE_MESSAGE: FaceMessage;
|
|
27
|
+
interface FaceBase {
|
|
28
|
+
kind: string;
|
|
29
|
+
name: string;
|
|
30
|
+
}
|
|
31
|
+
interface TimedViseme {
|
|
32
|
+
time: number;
|
|
33
|
+
type: string;
|
|
34
|
+
value: string;
|
|
35
|
+
}
|
|
36
|
+
interface AmplitudePoint {
|
|
37
|
+
time: number;
|
|
38
|
+
value: number;
|
|
39
|
+
}
|
|
40
|
+
type PixiMouthShape = "Hugo" | "ZigZag" | "Ellipse" | "Beak";
|
|
41
|
+
type PixiAvatar = FaceBase & {
|
|
42
|
+
kind: "PixiFace";
|
|
43
|
+
type: "avatar";
|
|
44
|
+
mouth: PixiMouthShape;
|
|
45
|
+
eyes: {
|
|
46
|
+
kind: "spritesheet";
|
|
47
|
+
path: string;
|
|
48
|
+
};
|
|
49
|
+
cheeks: {
|
|
50
|
+
kind: "texture";
|
|
51
|
+
path: string;
|
|
52
|
+
} | null;
|
|
53
|
+
eyebrows: "Hugo" | null;
|
|
54
|
+
};
|
|
55
|
+
type PixiText = FaceBase & {
|
|
56
|
+
kind: "PixiFace";
|
|
57
|
+
type: "text";
|
|
58
|
+
showEmotion: "emoticon" | "emoji" | "none";
|
|
59
|
+
showText: boolean;
|
|
60
|
+
};
|
|
61
|
+
type PixiFace = PixiAvatar | PixiText;
|
|
62
|
+
type VizijFace = FaceBase & {
|
|
63
|
+
kind: "Vizij";
|
|
64
|
+
assetBundle: VizijAssetBundle;
|
|
65
|
+
};
|
|
66
|
+
type Face = PixiFace | VizijFace;
|
|
67
|
+
interface FaceGaze {
|
|
68
|
+
/** Horizontal normalized gaze target in [-1, 1] */
|
|
69
|
+
x: number;
|
|
70
|
+
/** Vertical normalized gaze target in [-1, 1] */
|
|
71
|
+
y: number;
|
|
72
|
+
}
|
|
73
|
+
interface VizijSettings {
|
|
74
|
+
faceExpressivity: number;
|
|
75
|
+
}
|
|
76
|
+
interface PixiSettings {
|
|
77
|
+
eyeDisplay: "default" | "none";
|
|
78
|
+
mouthDisplay: "default" | "none";
|
|
79
|
+
cheekDisplay: "default" | "none";
|
|
80
|
+
emotionDisplay: "emoticon" | "emoji" | "none";
|
|
81
|
+
}
|
|
82
|
+
type SpeechQueueMode = "interrupt" | "queue";
|
|
83
|
+
interface CaptionSettings {
|
|
84
|
+
enabled: boolean;
|
|
85
|
+
fontSize: number;
|
|
86
|
+
offset: {
|
|
87
|
+
x: number;
|
|
88
|
+
y: number;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
interface FaceSettings {
|
|
92
|
+
zoom: number;
|
|
93
|
+
offset: {
|
|
94
|
+
x: number;
|
|
95
|
+
y: number;
|
|
96
|
+
};
|
|
97
|
+
rotation: number;
|
|
98
|
+
autoRotate: boolean;
|
|
99
|
+
showFullScreenButton: boolean;
|
|
100
|
+
showScrollButton: boolean;
|
|
101
|
+
amplitudeGain: number;
|
|
102
|
+
vizijSettings?: VizijSettings;
|
|
103
|
+
pixiSettings?: PixiSettings;
|
|
104
|
+
selectedLanguage: string | null;
|
|
105
|
+
speechQueueMode?: SpeechQueueMode;
|
|
106
|
+
captions: CaptionSettings;
|
|
107
|
+
}
|
|
108
|
+
declare const defaultFaceSettings: FaceSettings;
|
|
109
|
+
declare function normalizeAssetBaseUrl(assetBaseUrl?: string): string;
|
|
110
|
+
declare function createBuiltInPixiFaces(assetBaseUrl?: string): PixiFace[];
|
|
111
|
+
declare function createCustomVizijFace(glbUrl?: string): VizijFace;
|
|
112
|
+
declare function createIncludedVizijFaces(assetBaseUrl?: string): VizijFace[];
|
|
113
|
+
declare function createBuiltInFaces(assetBaseUrl?: string): Face[];
|
|
114
|
+
declare const builtInFaces: PixiFace[];
|
|
115
|
+
declare const customFace: VizijFace;
|
|
116
|
+
declare const includedVizijFaces: VizijFace[];
|
|
117
|
+
declare const availableFaces: Face[];
|
|
118
|
+
declare const defaultFace: PixiFace;
|
|
119
|
+
interface FaceCapabilities {
|
|
120
|
+
canExpressColor: boolean | string;
|
|
121
|
+
canExpressEmotion: boolean | string;
|
|
122
|
+
canLipSync: boolean | string;
|
|
123
|
+
}
|
|
124
|
+
declare const getFaceCapabilities: (face?: FaceBase) => FaceCapabilities;
|
|
125
|
+
|
|
126
|
+
interface FaceRenderProps<TFace extends FaceBase = FaceBase> {
|
|
127
|
+
face: TFace;
|
|
128
|
+
isPreview?: boolean;
|
|
129
|
+
frozen?: boolean;
|
|
130
|
+
}
|
|
131
|
+
interface FaceRendererStrategy<TFace extends FaceBase = FaceBase> {
|
|
132
|
+
readonly kind: string;
|
|
133
|
+
readonly displayName: string;
|
|
134
|
+
readonly requiresWebGL: boolean;
|
|
135
|
+
getCapabilities?: (face: TFace) => FaceCapabilities;
|
|
136
|
+
render: (props: FaceRenderProps<TFace>) => ReactNode;
|
|
137
|
+
}
|
|
138
|
+
declare class FaceRendererRegistry {
|
|
139
|
+
private readonly strategies;
|
|
140
|
+
constructor(initialStrategies?: readonly FaceRendererStrategy<FaceBase>[]);
|
|
141
|
+
register<TFace extends FaceBase>(strategy: FaceRendererStrategy<TFace>): void;
|
|
142
|
+
unregister(kind: string): boolean;
|
|
143
|
+
get(kind: string): FaceRendererStrategy<FaceBase> | undefined;
|
|
144
|
+
has(kind: string): boolean;
|
|
145
|
+
list(): FaceRendererStrategy<FaceBase>[];
|
|
146
|
+
getCapabilities(face?: FaceBase): FaceCapabilities;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
interface FaceVoice {
|
|
150
|
+
readonly name: string;
|
|
151
|
+
readonly voiceURI: string;
|
|
152
|
+
readonly lang: string;
|
|
153
|
+
readonly default?: boolean;
|
|
154
|
+
readonly localService?: boolean;
|
|
155
|
+
readonly engine?: string;
|
|
156
|
+
}
|
|
157
|
+
interface SynthesizeSpeechOptions {
|
|
158
|
+
engine?: string;
|
|
159
|
+
language?: string | null;
|
|
160
|
+
rate?: number;
|
|
161
|
+
pitch?: number;
|
|
162
|
+
signal?: AbortSignal;
|
|
163
|
+
}
|
|
164
|
+
interface SynthesizedSpeechResult {
|
|
165
|
+
audioUrl?: string;
|
|
166
|
+
audioBlob?: Blob;
|
|
167
|
+
audioBuffer?: ArrayBuffer;
|
|
168
|
+
mimeType?: string;
|
|
169
|
+
visemes?: TimedViseme[];
|
|
170
|
+
amplitudeData?: AmplitudePoint[];
|
|
171
|
+
extrema?: AmplitudePoint[];
|
|
172
|
+
}
|
|
173
|
+
interface SpeechSynthesizerAdapter {
|
|
174
|
+
readonly id: string;
|
|
175
|
+
canHandleVoice?: (voiceUri: string, voice?: FaceVoice) => boolean;
|
|
176
|
+
fetchVoices?: () => Promise<FaceVoice[]>;
|
|
177
|
+
synthesizeSpeech?: (text: string, voiceUri: string, options?: SynthesizeSpeechOptions) => Promise<SynthesizedSpeechResult>;
|
|
178
|
+
}
|
|
179
|
+
interface ExpressOptions {
|
|
180
|
+
silent?: boolean;
|
|
181
|
+
queueMode?: SpeechQueueMode;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
declare module "react" {
|
|
185
|
+
namespace JSX {
|
|
186
|
+
interface IntrinsicElements extends PixiElements {
|
|
187
|
+
pixiContainer: PixiElements["pixiContainer"];
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
type PollyViseme = "@" | "a" | "e" | "E" | "f" | "i" | "k" | "l" | "o" | "O" | "p" | "r" | "s" | "S" | "t" | "T" | "u" | "sil";
|
|
193
|
+
declare const pollyVisemeToVizijPath: Record<PollyViseme, string>;
|
|
194
|
+
declare const possiblePollyVisemes: string[];
|
|
195
|
+
declare function mapVisemeToVizijTarget(viseme: string): string;
|
|
196
|
+
/**
|
|
197
|
+
* Estimates timed Polly-compatible viseme durations (in seconds, matching VizijPoseSetter)
|
|
198
|
+
* for plain text when synthesized speech marks are not provided (e.g., native Web Speech API).
|
|
199
|
+
*/
|
|
200
|
+
declare function estimateVisemesFromText(text: string, msPerChar?: number): TimedViseme[];
|
|
201
|
+
|
|
202
|
+
declare const EMOTION_EMOTICONS: Record<PeerbotsEmotion, string>;
|
|
203
|
+
declare const EMOTION_EMOJIS: Record<PeerbotsEmotion, string>;
|
|
204
|
+
declare const EMOTION_ICON_FILES: Record<PeerbotsEmotion, string>;
|
|
205
|
+
declare function getEmotionIconPath(emotion: PeerbotsEmotion, assetBaseUrl?: string): string;
|
|
206
|
+
declare function getEmotionEyeSpritePaths(emotion: PeerbotsEmotion, character?: "Hugo", assetBaseUrl?: string): {
|
|
207
|
+
left: string;
|
|
208
|
+
right: string;
|
|
209
|
+
};
|
|
210
|
+
declare const emotion_mapping: Record<PeerbotsEmotion, string>;
|
|
211
|
+
|
|
212
|
+
declare const color_mapping: Record<PeerbotsColor, string>;
|
|
213
|
+
declare const font_color_mapping: Record<PeerbotsColor, string>;
|
|
214
|
+
declare function hexToRgb(hex: string): {
|
|
215
|
+
r: number;
|
|
216
|
+
g: number;
|
|
217
|
+
b: number;
|
|
218
|
+
} | null;
|
|
219
|
+
declare const hexToRgba: (color: string, alpha?: number) => string | null;
|
|
220
|
+
declare function rgbaToHex(orig: string): string;
|
|
221
|
+
declare const rgbToRgba: (color: string, alpha?: number) => string;
|
|
222
|
+
/** Legacy alias preserved for compatibility with app.peerbots.org */
|
|
223
|
+
declare const rbgToRgba: (color: string, alpha?: number) => string;
|
|
224
|
+
declare const deconstructRgba: (rgba: string) => number[];
|
|
225
|
+
declare const formatRgba: (color: {
|
|
226
|
+
r: number;
|
|
227
|
+
g: number;
|
|
228
|
+
b: number;
|
|
229
|
+
a: number;
|
|
230
|
+
}) => string;
|
|
231
|
+
/** Legacy alias preserved for compatibility with app.peerbots.org */
|
|
232
|
+
declare const formatRbga: (color: {
|
|
233
|
+
r: number;
|
|
234
|
+
g: number;
|
|
235
|
+
b: number;
|
|
236
|
+
a: number;
|
|
237
|
+
}) => string;
|
|
238
|
+
declare const interpolateColor: (colorA: string, colorB: string, progress: number) => string | null;
|
|
239
|
+
|
|
240
|
+
declare function getLanguageName(code: string): string;
|
|
241
|
+
/**
|
|
242
|
+
* Formats technical or platform-specific voice identifiers into clean, human-readable display names.
|
|
243
|
+
*/
|
|
244
|
+
declare function formatVoiceDisplayName(rawName: string): string;
|
|
245
|
+
declare function findMatchingVoice<T extends {
|
|
246
|
+
name: string;
|
|
247
|
+
voiceURI: string;
|
|
248
|
+
lang?: string;
|
|
249
|
+
}>(voices: readonly T[], target: string | null | undefined): T | undefined;
|
|
250
|
+
|
|
251
|
+
declare function isWebGLAvailable(): boolean;
|
|
252
|
+
declare function isHeadlessOrTestEnvironment(): boolean;
|
|
253
|
+
|
|
254
|
+
declare class AudioAnalyzer {
|
|
255
|
+
private ctx;
|
|
256
|
+
private analyzer;
|
|
257
|
+
private data;
|
|
258
|
+
private readonly connectedElements;
|
|
259
|
+
connect(audio: HTMLAudioElement): void;
|
|
260
|
+
getAmplitude(): number;
|
|
261
|
+
}
|
|
262
|
+
declare const audioAnalyzer: AudioAnalyzer;
|
|
263
|
+
|
|
264
|
+
interface TtsCacheKeyParams {
|
|
265
|
+
voiceId: string;
|
|
266
|
+
engine?: string;
|
|
267
|
+
text: string;
|
|
268
|
+
rate?: number;
|
|
269
|
+
pitch?: number;
|
|
270
|
+
}
|
|
271
|
+
declare function buildTtsCacheKey(params: TtsCacheKeyParams): string;
|
|
272
|
+
interface TtsAudioCacheEntry {
|
|
273
|
+
audioBlob: Blob;
|
|
274
|
+
mimeType: string;
|
|
275
|
+
visemes?: TimedViseme[];
|
|
276
|
+
amplitudeData?: AmplitudePoint[];
|
|
277
|
+
extrema?: AmplitudePoint[];
|
|
278
|
+
createdAt: number;
|
|
279
|
+
}
|
|
280
|
+
interface TtsAudioCacheOptions {
|
|
281
|
+
maxEntries?: number;
|
|
282
|
+
enableIndexedDb?: boolean;
|
|
283
|
+
dbName?: string;
|
|
284
|
+
storeName?: string;
|
|
285
|
+
}
|
|
286
|
+
declare function blobToArrayBuffer(blob: Blob): Promise<ArrayBuffer>;
|
|
287
|
+
/**
|
|
288
|
+
* Two-tier (in-memory LRU + IndexedDB) cache for synthesized TTS audio buffers and viseme marks.
|
|
289
|
+
* Prevents duplicate cloud TTS requests for repeated button presses across sessions.
|
|
290
|
+
*/
|
|
291
|
+
declare class TtsAudioCache {
|
|
292
|
+
private readonly maxEntries;
|
|
293
|
+
private readonly enableIndexedDb;
|
|
294
|
+
private readonly dbName;
|
|
295
|
+
private readonly storeName;
|
|
296
|
+
private readonly memory;
|
|
297
|
+
private dbPromise;
|
|
298
|
+
constructor(options?: TtsAudioCacheOptions);
|
|
299
|
+
get size(): number;
|
|
300
|
+
hasInMemory(key: string): boolean;
|
|
301
|
+
get(key: string): Promise<TtsAudioCacheEntry | undefined>;
|
|
302
|
+
set(key: string, entry: Omit<TtsAudioCacheEntry, "createdAt"> & {
|
|
303
|
+
createdAt?: number;
|
|
304
|
+
}): Promise<void>;
|
|
305
|
+
delete(key: string): Promise<boolean>;
|
|
306
|
+
clear(): Promise<void>;
|
|
307
|
+
createObjectUrl(entry: TtsAudioCacheEntry): string;
|
|
308
|
+
private putInMemory;
|
|
309
|
+
private openDatabase;
|
|
310
|
+
private readFromIndexedDb;
|
|
311
|
+
private writeToIndexedDb;
|
|
312
|
+
private deleteFromIndexedDb;
|
|
313
|
+
private clearIndexedDb;
|
|
314
|
+
}
|
|
315
|
+
declare const defaultTtsAudioCache: TtsAudioCache;
|
|
316
|
+
|
|
317
|
+
type VisualState = "IDLE" | "SHOWING" | "WAITING_FOR_AUDIO" | "PERSISTING" | "PAUSED";
|
|
318
|
+
interface MessageVisualStateConfig {
|
|
319
|
+
msPerChar?: number;
|
|
320
|
+
persistenceDuration?: number;
|
|
321
|
+
pauseBeforeNextMsg?: number;
|
|
322
|
+
}
|
|
323
|
+
declare function useMessageVisualState(isSpeaking: boolean, config?: MessageVisualStateConfig): {
|
|
324
|
+
displayText: string;
|
|
325
|
+
visualState: VisualState;
|
|
326
|
+
queueMessage: (speech: string) => void;
|
|
327
|
+
update: (ms: number) => void;
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
interface FaceSpeechSliceOptions {
|
|
331
|
+
initialMessage?: FaceMessage;
|
|
332
|
+
isSilent?: boolean;
|
|
333
|
+
speechAdapter?: SpeechSynthesizerAdapter | null;
|
|
334
|
+
ttsCache?: TtsAudioCache | false;
|
|
335
|
+
audioAnalyzer?: AudioAnalyzer;
|
|
336
|
+
utteranceDeferMs?: number;
|
|
337
|
+
}
|
|
338
|
+
interface QueuedSpeechItem {
|
|
339
|
+
message: FaceMessage;
|
|
340
|
+
options?: ExpressOptions;
|
|
341
|
+
}
|
|
342
|
+
interface FaceSpeechSlice {
|
|
343
|
+
lastMessage: FaceMessage;
|
|
344
|
+
isSpeaking: boolean;
|
|
345
|
+
speechAllowed: boolean;
|
|
346
|
+
selectedVoiceUri: string | null;
|
|
347
|
+
availableVoices: FaceVoice[];
|
|
348
|
+
spokenVisemes: TimedViseme[] | null;
|
|
349
|
+
amplitudeData: AmplitudePoint[] | null;
|
|
350
|
+
amplitudeExtrema: AmplitudePoint[] | null;
|
|
351
|
+
currentAmplitude: number;
|
|
352
|
+
speechStartTime: number | null;
|
|
353
|
+
speechQueue: QueuedSpeechItem[];
|
|
354
|
+
setSpeechAllowed: (allowed: boolean) => void;
|
|
355
|
+
setAvailableVoices: (voices: FaceVoice[]) => void;
|
|
356
|
+
refreshVoices: () => Promise<FaceVoice[]>;
|
|
357
|
+
getSelectedVoice: () => FaceVoice;
|
|
358
|
+
getDefaultVoice: () => FaceVoice;
|
|
359
|
+
setVoice: (voiceUri: string, options?: {
|
|
360
|
+
silent?: boolean;
|
|
361
|
+
}) => void;
|
|
362
|
+
setSpokenVisemes: (visemes: TimedViseme[] | null) => void;
|
|
363
|
+
setAmplitudeData: (data: AmplitudePoint[] | null, extrema: AmplitudePoint[] | null) => void;
|
|
364
|
+
setIsSpeaking: (isSpeaking: boolean) => void;
|
|
365
|
+
setCurrentAmplitude: (amplitude: number) => void;
|
|
366
|
+
setSpeechAdapter: (adapter: SpeechSynthesizerAdapter | null) => void;
|
|
367
|
+
express: (message: FaceMessage, options?: ExpressOptions) => Promise<void>;
|
|
368
|
+
/** Alias preserved for backward compatibility with app.peerbots.org */
|
|
369
|
+
_express: (message: FaceMessage, options?: ExpressOptions) => Promise<void>;
|
|
370
|
+
stopSpeech: () => void;
|
|
371
|
+
}
|
|
372
|
+
declare function stopNativeSpeechSynthesis(): void;
|
|
373
|
+
declare function createFaceSpeechSlice(sliceOptions?: FaceSpeechSliceOptions): StateCreator<FaceRenderingSlice & FaceSpeechSlice, [], [], FaceSpeechSlice>;
|
|
374
|
+
|
|
375
|
+
interface FaceRenderingSliceOptions {
|
|
376
|
+
assetBaseUrl?: string;
|
|
377
|
+
initialFace?: Face;
|
|
378
|
+
initialSettings?: Partial<FaceSettings>;
|
|
379
|
+
}
|
|
380
|
+
interface FaceRenderingSlice {
|
|
381
|
+
assetBaseUrl: string;
|
|
382
|
+
availableFaces: Face[];
|
|
383
|
+
selectedFace: Face;
|
|
384
|
+
faceSettings: FaceSettings;
|
|
385
|
+
gaze: FaceGaze;
|
|
386
|
+
setFace: (face: Face) => void;
|
|
387
|
+
setFaceByName: (name: string) => void;
|
|
388
|
+
setFaceSettings: (settings: Partial<FaceSettings>) => void;
|
|
389
|
+
resetPositioning: () => void;
|
|
390
|
+
setGaze: (gaze: FaceGaze) => void;
|
|
391
|
+
setLanguage: (lang: string | null) => void;
|
|
392
|
+
setAssetBaseUrl: (assetBaseUrl: string) => void;
|
|
393
|
+
}
|
|
394
|
+
declare function mergeFaceSettings(base: FaceSettings, patch?: Partial<FaceSettings>): FaceSettings;
|
|
395
|
+
declare function createFaceRenderingSlice(options?: FaceRenderingSliceOptions): StateCreator<FaceRenderingSlice & FaceSpeechSlice, [], [], FaceRenderingSlice>;
|
|
396
|
+
|
|
397
|
+
type PeerbotsFaceStore = FaceRenderingSlice & FaceSpeechSlice;
|
|
398
|
+
interface CreatePeerbotsFaceStoreOptions extends FaceRenderingSliceOptions, FaceSpeechSliceOptions {
|
|
399
|
+
/** Optional localStorage key. When omitted, store runs purely in-memory. */
|
|
400
|
+
persistName?: string;
|
|
401
|
+
}
|
|
402
|
+
type PeerbotsFaceStoreApi = StoreApi<PeerbotsFaceStore>;
|
|
403
|
+
declare function createPeerbotsFaceStore(options?: CreatePeerbotsFaceStoreOptions): PeerbotsFaceStoreApi;
|
|
404
|
+
declare const globalFaceStore: PeerbotsFaceStoreApi;
|
|
405
|
+
|
|
406
|
+
declare const FaceStoreContext: react.Context<PeerbotsFaceStoreApi | null>;
|
|
407
|
+
interface FaceStoreProviderProps {
|
|
408
|
+
children: ReactNode;
|
|
409
|
+
store?: PeerbotsFaceStoreApi;
|
|
410
|
+
options?: CreatePeerbotsFaceStoreOptions;
|
|
411
|
+
}
|
|
412
|
+
declare function FaceStoreProvider({ children, store, options, }: FaceStoreProviderProps): react.JSX.Element;
|
|
413
|
+
declare function useFaceStoreInstance(): PeerbotsFaceStoreApi;
|
|
414
|
+
interface UseFaceStoreHook {
|
|
415
|
+
<T>(selector: (state: PeerbotsFaceStore) => T): T;
|
|
416
|
+
getState: () => PeerbotsFaceStore;
|
|
417
|
+
setState: PeerbotsFaceStoreApi["setState"];
|
|
418
|
+
subscribe: PeerbotsFaceStoreApi["subscribe"];
|
|
419
|
+
}
|
|
420
|
+
declare const useFaceStore: UseFaceStoreHook;
|
|
421
|
+
|
|
422
|
+
declare const pixiFaceRendererStrategy: FaceRendererStrategy<PixiFace>;
|
|
423
|
+
declare const vizijFaceRendererStrategy: FaceRendererStrategy<VizijFace>;
|
|
424
|
+
declare function createDefaultFaceRendererRegistry(): FaceRendererRegistry;
|
|
425
|
+
declare const defaultFaceRendererRegistry: FaceRendererRegistry;
|
|
426
|
+
interface FaceViewProps {
|
|
427
|
+
isPreview?: boolean;
|
|
428
|
+
frozen?: boolean;
|
|
429
|
+
/**
|
|
430
|
+
* Controls whether WebGL engines or the accessible StaticFaceFallback render:
|
|
431
|
+
* - "auto" (default): uses WebGL engines in interactive browsers and StaticFaceFallback in headless tests or when WebGL is unavailable.
|
|
432
|
+
* - "static": always renders StaticFaceFallback.
|
|
433
|
+
* - "live": forces the registered strategy renderer.
|
|
434
|
+
*/
|
|
435
|
+
renderMode?: "auto" | "static" | "live";
|
|
436
|
+
showStaticSprites?: boolean;
|
|
437
|
+
registry?: FaceRendererRegistry;
|
|
438
|
+
labels?: Partial<FaceUiLabels>;
|
|
439
|
+
className?: string;
|
|
440
|
+
}
|
|
441
|
+
declare function FaceView({ isPreview, frozen, renderMode, showStaticSprites, registry, labels, className, }?: FaceViewProps): react.JSX.Element;
|
|
442
|
+
|
|
443
|
+
declare function FaceCaption(): react.JSX.Element | null;
|
|
444
|
+
|
|
445
|
+
interface FaceAudioPromptProps {
|
|
446
|
+
className?: string;
|
|
447
|
+
position?: "fixed" | "absolute" | "inline";
|
|
448
|
+
labels?: Partial<FaceUiLabels>;
|
|
449
|
+
onEnable?: () => void;
|
|
450
|
+
}
|
|
451
|
+
declare function FaceAudioPrompt({ className, position, labels, onEnable, }: FaceAudioPromptProps): react.JSX.Element | null;
|
|
452
|
+
|
|
453
|
+
interface FaceViewSkeletonProps {
|
|
454
|
+
label?: string;
|
|
455
|
+
}
|
|
456
|
+
declare function FaceViewSkeleton({ label, }?: FaceViewSkeletonProps): react.JSX.Element;
|
|
457
|
+
|
|
458
|
+
interface StaticFaceFallbackProps {
|
|
459
|
+
showSprites?: boolean;
|
|
460
|
+
className?: string;
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Accessible static Peerbots Face representation used when running in headless test
|
|
464
|
+
* environments (Playwright / Vitest / jsdom / pa11y) or when WebGL is unavailable.
|
|
465
|
+
* Uses canonical Peerbots colors and optional canonical FaceAssets sprites.
|
|
466
|
+
*/
|
|
467
|
+
declare function StaticFaceFallback({ showSprites, className, }: StaticFaceFallbackProps): react.JSX.Element;
|
|
468
|
+
|
|
469
|
+
interface PoweredByVizijProps {
|
|
470
|
+
className?: string;
|
|
471
|
+
poweredByLabel?: string;
|
|
472
|
+
}
|
|
473
|
+
declare function PoweredByVizij({ className, poweredByLabel, }: PoweredByVizijProps): react.JSX.Element;
|
|
474
|
+
|
|
475
|
+
interface FieldGroupProps {
|
|
476
|
+
label?: string;
|
|
477
|
+
icon?: ReactNode;
|
|
478
|
+
description?: string;
|
|
479
|
+
children: ReactNode;
|
|
480
|
+
className?: string;
|
|
481
|
+
id?: string;
|
|
482
|
+
}
|
|
483
|
+
declare function FieldGroup({ label, icon, description, children, className, id: customId, }: FieldGroupProps): react.JSX.Element;
|
|
484
|
+
|
|
485
|
+
interface VoiceSelectorProps {
|
|
486
|
+
voices: readonly FaceVoice[];
|
|
487
|
+
selectedVoiceUri: string | null | undefined;
|
|
488
|
+
selectedLanguage: string | null | undefined;
|
|
489
|
+
onVoiceChange: (voiceUri: string) => void;
|
|
490
|
+
onLanguageChange?: (language: string) => void;
|
|
491
|
+
labels?: Partial<FaceUiLabels>;
|
|
492
|
+
className?: string;
|
|
493
|
+
}
|
|
494
|
+
declare function VoiceSelector({ voices, selectedVoiceUri, selectedLanguage, onVoiceChange, onLanguageChange, labels, className, }: VoiceSelectorProps): react.JSX.Element;
|
|
495
|
+
|
|
496
|
+
interface CharacterSelectionControlsProps {
|
|
497
|
+
enableVizij?: boolean;
|
|
498
|
+
labels?: Partial<FaceUiLabels>;
|
|
499
|
+
}
|
|
500
|
+
declare function CharacterSelectionControls({ enableVizij, labels, }?: CharacterSelectionControlsProps): react.JSX.Element;
|
|
501
|
+
declare const CharacterSelectionSection: typeof CharacterSelectionControls;
|
|
502
|
+
|
|
503
|
+
interface FacePositioningControlsProps {
|
|
504
|
+
labels?: Partial<FaceUiLabels>;
|
|
505
|
+
}
|
|
506
|
+
declare function FacePositioningControls({ labels, }?: FacePositioningControlsProps): react.JSX.Element;
|
|
507
|
+
declare const FacePositioningSection: typeof FacePositioningControls;
|
|
508
|
+
|
|
509
|
+
interface FaceBehaviorControlsProps {
|
|
510
|
+
labels?: Partial<FaceUiLabels>;
|
|
511
|
+
}
|
|
512
|
+
declare function FaceBehaviorControls({ labels, }?: FaceBehaviorControlsProps): react.JSX.Element;
|
|
513
|
+
declare const ControlSettingsSection: typeof FaceBehaviorControls;
|
|
514
|
+
|
|
515
|
+
interface FaceSettingsPanelProps {
|
|
516
|
+
inline?: boolean;
|
|
517
|
+
enableVizij?: boolean;
|
|
518
|
+
columns?: 1 | 3;
|
|
519
|
+
labels?: Partial<FaceUiLabels>;
|
|
520
|
+
className?: string;
|
|
521
|
+
}
|
|
522
|
+
declare function FaceSettingsPanel({ inline, enableVizij, columns, labels, className, }?: FaceSettingsPanelProps): react.JSX.Element;
|
|
523
|
+
declare const FaceSettingsControl: typeof FaceSettingsPanel;
|
|
524
|
+
|
|
525
|
+
export { type AmplitudePoint, AudioAnalyzer, CONNECTION_FACE_MESSAGE, type CaptionSettings, CharacterSelectionControls, type CharacterSelectionControlsProps, CharacterSelectionSection, ControlSettingsSection, type CreatePeerbotsFaceStoreOptions, DEFAULT_FACE_MESSAGE, EMOTION_EMOJIS, EMOTION_EMOTICONS, EMOTION_ICON_FILES, type ExpressOptions, type Face, FaceAudioPrompt, type FaceAudioPromptProps, type FaceBase, FaceBehaviorControls, type FaceBehaviorControlsProps, type FaceCapabilities, FaceCaption, type FaceColor, type FaceEmotion, type FaceGaze, type FaceMessage, FacePositioningControls, type FacePositioningControlsProps, FacePositioningSection, type FaceRenderProps, FaceRendererRegistry, type FaceRendererStrategy, type FaceRenderingSlice, type FaceRenderingSliceOptions, type FaceSettings, FaceSettingsControl, FaceSettingsPanel, type FaceSettingsPanelProps, type FaceSpeechSlice, type FaceSpeechSliceOptions, FaceStoreContext, FaceStoreProvider, type FaceStoreProviderProps, FaceUiLabels, FaceView, type FaceViewProps, FaceViewSkeleton, type FaceViewSkeletonProps, type FaceVoice, FieldGroup, type FieldGroupProps, type MessageVisualStateConfig, PEERBOTS_COLORS, PEERBOTS_EMOTIONS, type PeerbotsEmotion, type PeerbotsFaceStore, type PeerbotsFaceStoreApi, type PixiAvatar, type PixiFace, type PixiMouthShape, type PixiSettings, type PixiText, type PollyViseme, PoweredByVizij, type PoweredByVizijProps, type QueuedSpeechItem, type SpeechQueueMode, type SpeechSynthesizerAdapter, StaticFaceFallback, type StaticFaceFallbackProps, type SynthesizeSpeechOptions, type SynthesizedSpeechResult, type TimedViseme, TtsAudioCache, type TtsAudioCacheEntry, type TtsAudioCacheOptions, type TtsCacheKeyParams, type UseFaceStoreHook, type VisualState, type VizijFace, type VizijSettings, VoiceSelector, type VoiceSelectorProps, audioAnalyzer, availableFaces, blobToArrayBuffer, buildTtsCacheKey, builtInFaces, color_mapping, createBuiltInFaces, createBuiltInPixiFaces, createCustomVizijFace, createDefaultFaceRendererRegistry, createFaceRenderingSlice, createFaceSpeechSlice, createIncludedVizijFaces, createPeerbotsFaceStore, customFace, deconstructRgba, defaultFace, defaultFaceRendererRegistry, defaultFaceSettings, defaultTtsAudioCache, emotion_mapping, estimateVisemesFromText, findMatchingVoice, font_color_mapping, formatRbga, formatRgba, formatVoiceDisplayName, getEmotionEyeSpritePaths, getEmotionIconPath, getFaceCapabilities, getLanguageName, globalFaceStore, hexToRgb, hexToRgba, includedVizijFaces, interpolateColor, isHeadlessOrTestEnvironment, isWebGLAvailable, mapVisemeToVizijTarget, mergeFaceSettings, normalizeAssetBaseUrl, pixiFaceRendererStrategy, pollyVisemeToVizijPath, possiblePollyVisemes, rbgToRgba, rgbToRgba, rgbaToHex, stopNativeSpeechSynthesis, useFaceStore, useFaceStoreInstance, useMessageVisualState, vizijFaceRendererStrategy };
|