@peerbots/face 0.2.0 → 0.4.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/dist/{VizijFaceView-DEMuLMAb.d.ts → VizijFaceView-BYbSP1sU.d.ts} +3 -0
- package/dist/chunk-5RYQRTO6.js +415 -0
- package/dist/chunk-5RYQRTO6.js.map +1 -0
- package/dist/{chunk-EAYBAWGE.js → chunk-7C57IP5B.js} +253 -11
- package/dist/chunk-7C57IP5B.js.map +1 -0
- package/dist/{chunk-ZEXL2QPJ.js → chunk-ZTKYMU5B.js} +4 -1
- package/dist/chunk-ZTKYMU5B.js.map +1 -0
- package/dist/index.cjs +677 -201
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +123 -6
- package/dist/index.js +91 -45
- package/dist/index.js.map +1 -1
- package/dist/pixi.cjs +455 -59
- package/dist/pixi.cjs.map +1 -1
- package/dist/pixi.js +21 -44
- package/dist/pixi.js.map +1 -1
- package/dist/vizij.cjs +242 -10
- package/dist/vizij.cjs.map +1 -1
- package/dist/vizij.d.ts +1 -1
- package/dist/vizij.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-EAYBAWGE.js.map +0 -1
- package/dist/chunk-QGFC2GUD.js +0 -211
- package/dist/chunk-QGFC2GUD.js.map +0 -1
- package/dist/chunk-ZEXL2QPJ.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { PeerbotsColor, Emotion } from '@peerbots/core';
|
|
|
2
2
|
export { PeerbotsColor } from '@peerbots/core';
|
|
3
3
|
import { VizijAssetBundle } from '@vizij/runtime-react';
|
|
4
4
|
import * as react from 'react';
|
|
5
|
-
import { ReactNode } from 'react';
|
|
6
|
-
import { F as FaceUiLabels } from './VizijFaceView-
|
|
7
|
-
export { D as DEFAULT_FACE_UI_LABELS, V as VizijFaceViewProps, r as resolveFaceUiLabels } from './VizijFaceView-
|
|
5
|
+
import { ReactNode, RefObject } from 'react';
|
|
6
|
+
import { F as FaceUiLabels } from './VizijFaceView-BYbSP1sU.js';
|
|
7
|
+
export { D as DEFAULT_FACE_UI_LABELS, V as VizijFaceViewProps, r as resolveFaceUiLabels } from './VizijFaceView-BYbSP1sU.js';
|
|
8
8
|
import { PixiElements } from '@pixi/react';
|
|
9
9
|
export { PixiElements } from '@pixi/react';
|
|
10
10
|
import { StateCreator, StoreApi } from 'zustand';
|
|
@@ -80,6 +80,7 @@ interface PixiSettings {
|
|
|
80
80
|
emotionDisplay: "emoticon" | "emoji" | "none";
|
|
81
81
|
}
|
|
82
82
|
type SpeechQueueMode = "interrupt" | "queue";
|
|
83
|
+
type CaptionStyle = "pill" | "outline";
|
|
83
84
|
interface CaptionSettings {
|
|
84
85
|
enabled: boolean;
|
|
85
86
|
fontSize: number;
|
|
@@ -87,6 +88,7 @@ interface CaptionSettings {
|
|
|
87
88
|
x: number;
|
|
88
89
|
y: number;
|
|
89
90
|
};
|
|
91
|
+
style?: CaptionStyle;
|
|
90
92
|
}
|
|
91
93
|
interface FaceSettings {
|
|
92
94
|
zoom: number;
|
|
@@ -251,16 +253,104 @@ declare function findMatchingVoice<T extends {
|
|
|
251
253
|
declare function isWebGLAvailable(): boolean;
|
|
252
254
|
declare function isHeadlessOrTestEnvironment(): boolean;
|
|
253
255
|
|
|
256
|
+
/**
|
|
257
|
+
* Cross-browser Fullscreen API helpers supporting standard and vendor-prefixed
|
|
258
|
+
* (`webkit`, `moz`, `ms`) implementations without unsafe `any` casts.
|
|
259
|
+
*/
|
|
260
|
+
interface VendorFullscreenElement extends Element {
|
|
261
|
+
webkitRequestFullscreen?: () => Promise<void> | void;
|
|
262
|
+
mozRequestFullScreen?: () => Promise<void> | void;
|
|
263
|
+
msRequestFullscreen?: () => Promise<void> | void;
|
|
264
|
+
}
|
|
265
|
+
interface VendorFullscreenDocument extends Document {
|
|
266
|
+
webkitFullscreenElement?: Element | null;
|
|
267
|
+
mozFullScreenElement?: Element | null;
|
|
268
|
+
msFullscreenElement?: Element | null;
|
|
269
|
+
webkitFullscreenEnabled?: boolean;
|
|
270
|
+
mozFullScreenEnabled?: boolean;
|
|
271
|
+
msFullscreenEnabled?: boolean;
|
|
272
|
+
webkitExitFullscreen?: () => Promise<void> | void;
|
|
273
|
+
mozCancelFullScreen?: () => Promise<void> | void;
|
|
274
|
+
msExitFullscreen?: () => Promise<void> | void;
|
|
275
|
+
}
|
|
276
|
+
declare function getFullscreenElement(doc?: Document | undefined): Element | null;
|
|
277
|
+
declare function isNativeFullscreenSupported(element?: Element | null, doc?: Document | undefined): boolean;
|
|
278
|
+
declare function requestNativeFullscreen(element: Element): Promise<void>;
|
|
279
|
+
declare function exitNativeFullscreen(doc?: Document | undefined): Promise<void>;
|
|
280
|
+
declare function addFullscreenChangeListener(listener: EventListener, doc?: Document | undefined): () => void;
|
|
281
|
+
|
|
282
|
+
interface AudioAnalyzerConnectOptions {
|
|
283
|
+
/** Override the iOS Safari bypass (primarily for testing). */
|
|
284
|
+
force?: boolean;
|
|
285
|
+
}
|
|
254
286
|
declare class AudioAnalyzer {
|
|
255
287
|
private ctx;
|
|
256
288
|
private analyzer;
|
|
257
289
|
private data;
|
|
258
290
|
private readonly connectedElements;
|
|
259
|
-
|
|
291
|
+
getContext(): AudioContext | null;
|
|
292
|
+
resumeContext(): Promise<boolean>;
|
|
293
|
+
connect(audio: HTMLAudioElement, options?: AudioAnalyzerConnectOptions): boolean;
|
|
260
294
|
getAmplitude(): number;
|
|
261
295
|
}
|
|
262
296
|
declare const audioAnalyzer: AudioAnalyzer;
|
|
263
297
|
|
|
298
|
+
/**
|
|
299
|
+
* Minimal 44-byte silent PCM WAV (8kHz, 8-bit mono, 1 silent sample) encoded
|
|
300
|
+
* as a data URI. Playing this inside a user gesture whitelists the persistent
|
|
301
|
+
* HTMLAudioElement on Mobile Safari / iOS WebKit for subsequent async play().
|
|
302
|
+
*/
|
|
303
|
+
declare const SILENT_WAV_DATA_URI = "data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA";
|
|
304
|
+
interface NavigatorLike {
|
|
305
|
+
userAgent?: string;
|
|
306
|
+
platform?: string;
|
|
307
|
+
maxTouchPoints?: number;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Returns true on iPhone, iPad, iPod, and iPadOS 13+ (which reports
|
|
311
|
+
* `platform === "MacIntel"` with `maxTouchPoints > 1`).
|
|
312
|
+
*/
|
|
313
|
+
declare function isIOSDevice(nav?: NavigatorLike): boolean;
|
|
314
|
+
/**
|
|
315
|
+
* Returns true on Mobile Safari running on iOS / iPadOS.
|
|
316
|
+
*/
|
|
317
|
+
declare function isMobileSafari(nav?: NavigatorLike): boolean;
|
|
318
|
+
interface AudioUnlockOptions {
|
|
319
|
+
/** Optional AudioContext to resume during the user gesture. */
|
|
320
|
+
audioContext?: AudioContext | null;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Manages a single persistent HTMLAudioElement and centralizes mobile audio
|
|
324
|
+
* unlocking (silent WAV priming, AudioContext resumption, and safe
|
|
325
|
+
* speechSynthesis priming without whitespace utterances).
|
|
326
|
+
*/
|
|
327
|
+
declare class AudioManager {
|
|
328
|
+
private audioElement;
|
|
329
|
+
private registeredContexts;
|
|
330
|
+
private unlocked;
|
|
331
|
+
isUnlocked(): boolean;
|
|
332
|
+
/**
|
|
333
|
+
* Registers an AudioContext so `unlock()` automatically resumes it during a
|
|
334
|
+
* user gesture.
|
|
335
|
+
*/
|
|
336
|
+
registerAudioContext(ctx: AudioContext): void;
|
|
337
|
+
/**
|
|
338
|
+
* Returns the single persistent HTMLAudioElement configured for inline
|
|
339
|
+
* cross-origin playback on iOS / Mobile Safari.
|
|
340
|
+
*/
|
|
341
|
+
getAudioElement(): HTMLAudioElement | null;
|
|
342
|
+
/**
|
|
343
|
+
* Unlocks audio playback on iOS / Mobile Safari. MUST be called synchronously
|
|
344
|
+
* inside a user-gesture event handler (e.g. click or touchstart).
|
|
345
|
+
*/
|
|
346
|
+
unlock(options?: AudioUnlockOptions): Promise<boolean>;
|
|
347
|
+
/**
|
|
348
|
+
* Resets internal state (primarily for unit testing).
|
|
349
|
+
*/
|
|
350
|
+
reset(): void;
|
|
351
|
+
}
|
|
352
|
+
declare const audioManager: AudioManager;
|
|
353
|
+
|
|
264
354
|
interface TtsCacheKeyParams {
|
|
265
355
|
voiceId: string;
|
|
266
356
|
engine?: string;
|
|
@@ -327,12 +417,35 @@ declare function useMessageVisualState(isSpeaking: boolean, config?: MessageVisu
|
|
|
327
417
|
update: (ms: number) => void;
|
|
328
418
|
};
|
|
329
419
|
|
|
420
|
+
interface UseFullscreenOptions {
|
|
421
|
+
/** Called whenever fullscreen state changes (native or CSS pseudo-fullscreen). */
|
|
422
|
+
onFullscreenChange?: (isFullscreen: boolean) => void;
|
|
423
|
+
}
|
|
424
|
+
interface FullscreenState {
|
|
425
|
+
/** Whether the target is currently fullscreen (either native or pseudo-fullscreen). */
|
|
426
|
+
isFullscreen: boolean;
|
|
427
|
+
/** Whether CSS pseudo-fullscreen fallback is currently active. */
|
|
428
|
+
isPseudoFullscreen: boolean;
|
|
429
|
+
enterFullscreen: () => Promise<void>;
|
|
430
|
+
exitFullscreen: () => Promise<void>;
|
|
431
|
+
toggleFullscreen: () => Promise<void>;
|
|
432
|
+
}
|
|
433
|
+
declare const FaceFullscreenContext: react.Context<FullscreenState | null>;
|
|
434
|
+
declare function useFaceFullscreenContext(): FullscreenState | null;
|
|
435
|
+
/**
|
|
436
|
+
* Manages fullscreen state for a target container element with automatic
|
|
437
|
+
* fallback to CSS pseudo-fullscreen when native Fullscreen API is unavailable
|
|
438
|
+
* (e.g. iPhone Safari) or rejected.
|
|
439
|
+
*/
|
|
440
|
+
declare function useFullscreen(targetRef: RefObject<HTMLElement | null>, options?: UseFullscreenOptions): FullscreenState;
|
|
441
|
+
|
|
330
442
|
interface FaceSpeechSliceOptions {
|
|
331
443
|
initialMessage?: FaceMessage;
|
|
332
444
|
isSilent?: boolean;
|
|
333
445
|
speechAdapter?: SpeechSynthesizerAdapter | null;
|
|
334
446
|
ttsCache?: TtsAudioCache | false;
|
|
335
447
|
audioAnalyzer?: AudioAnalyzer;
|
|
448
|
+
audioManager?: AudioManager;
|
|
336
449
|
utteranceDeferMs?: number;
|
|
337
450
|
}
|
|
338
451
|
interface QueuedSpeechItem {
|
|
@@ -352,6 +465,8 @@ interface FaceSpeechSlice {
|
|
|
352
465
|
speechStartTime: number | null;
|
|
353
466
|
speechQueue: QueuedSpeechItem[];
|
|
354
467
|
setSpeechAllowed: (allowed: boolean) => void;
|
|
468
|
+
/** Unlocks mobile audio playback (persistent HTMLAudioElement, AudioContext, and safe speechSynthesis priming), marks speechAllowed true, and refreshes voices. */
|
|
469
|
+
unlockAudio: () => Promise<boolean>;
|
|
355
470
|
setAvailableVoices: (voices: FaceVoice[]) => void;
|
|
356
471
|
refreshVoices: () => Promise<FaceVoice[]>;
|
|
357
472
|
getSelectedVoice: () => FaceVoice;
|
|
@@ -448,8 +563,10 @@ interface FaceViewProps {
|
|
|
448
563
|
registry?: FaceRendererRegistry;
|
|
449
564
|
labels?: Partial<FaceUiLabels>;
|
|
450
565
|
className?: string;
|
|
566
|
+
/** Called whenever fullscreen state changes (native or CSS pseudo-fullscreen). */
|
|
567
|
+
onFullscreenChange?: (isFullscreen: boolean) => void;
|
|
451
568
|
}
|
|
452
|
-
declare function FaceView({ isPreview, frozen, renderMode, showStaticSprites, registry, labels, className, }?: FaceViewProps): react.JSX.Element;
|
|
569
|
+
declare function FaceView({ isPreview, frozen, renderMode, showStaticSprites, registry, labels, className, onFullscreenChange, }?: FaceViewProps): react.JSX.Element;
|
|
453
570
|
|
|
454
571
|
declare function FaceCaption(): react.JSX.Element | null;
|
|
455
572
|
|
|
@@ -554,4 +671,4 @@ declare function FaceTesterSection({ defaultOpen, collapsible, headingLevel, lab
|
|
|
554
671
|
|
|
555
672
|
declare function AmplitudeGraph(): react.JSX.Element;
|
|
556
673
|
|
|
557
|
-
export { AmplitudeGraph, 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, FaceTester, type FaceTesterProps, FaceTesterSection, type FaceTesterSectionProps, 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, getGlobalFaceStore, getLanguageName, globalFaceStore, hexToRgb, hexToRgba, includedVizijFaces, interpolateColor, isHeadlessOrTestEnvironment, isWebGLAvailable, mapVisemeToVizijTarget, mergeFaceSettings, normalizeAssetBaseUrl, pixiFaceRendererStrategy, pollyVisemeToVizijPath, possiblePollyVisemes, rbgToRgba, rgbToRgba, rgbaToHex, setGlobalFaceStore, stopNativeSpeechSynthesis, useFaceStore, useFaceStoreInstance, useMessageVisualState, vizijFaceRendererStrategy };
|
|
674
|
+
export { AmplitudeGraph, type AmplitudePoint, AudioAnalyzer, type AudioAnalyzerConnectOptions, AudioManager, type AudioUnlockOptions, CONNECTION_FACE_MESSAGE, type CaptionSettings, type CaptionStyle, 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, FaceFullscreenContext, 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, FaceTester, type FaceTesterProps, FaceTesterSection, type FaceTesterSectionProps, FaceUiLabels, FaceView, type FaceViewProps, FaceViewSkeleton, type FaceViewSkeletonProps, type FaceVoice, FieldGroup, type FieldGroupProps, type FullscreenState, type MessageVisualStateConfig, type NavigatorLike, 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, SILENT_WAV_DATA_URI, type SpeechQueueMode, type SpeechSynthesizerAdapter, StaticFaceFallback, type StaticFaceFallbackProps, type SynthesizeSpeechOptions, type SynthesizedSpeechResult, type TimedViseme, TtsAudioCache, type TtsAudioCacheEntry, type TtsAudioCacheOptions, type TtsCacheKeyParams, type UseFaceStoreHook, type UseFullscreenOptions, type VendorFullscreenDocument, type VendorFullscreenElement, type VisualState, type VizijFace, type VizijSettings, VoiceSelector, type VoiceSelectorProps, addFullscreenChangeListener, audioAnalyzer, audioManager, availableFaces, blobToArrayBuffer, buildTtsCacheKey, builtInFaces, color_mapping, createBuiltInFaces, createBuiltInPixiFaces, createCustomVizijFace, createDefaultFaceRendererRegistry, createFaceRenderingSlice, createFaceSpeechSlice, createIncludedVizijFaces, createPeerbotsFaceStore, customFace, deconstructRgba, defaultFace, defaultFaceRendererRegistry, defaultFaceSettings, defaultTtsAudioCache, emotion_mapping, estimateVisemesFromText, exitNativeFullscreen, findMatchingVoice, font_color_mapping, formatRbga, formatRgba, formatVoiceDisplayName, getEmotionEyeSpritePaths, getEmotionIconPath, getFaceCapabilities, getFullscreenElement, getGlobalFaceStore, getLanguageName, globalFaceStore, hexToRgb, hexToRgba, includedVizijFaces, interpolateColor, isHeadlessOrTestEnvironment, isIOSDevice, isMobileSafari, isNativeFullscreenSupported, isWebGLAvailable, mapVisemeToVizijTarget, mergeFaceSettings, normalizeAssetBaseUrl, pixiFaceRendererStrategy, pollyVisemeToVizijPath, possiblePollyVisemes, rbgToRgba, requestNativeFullscreen, rgbToRgba, rgbaToHex, setGlobalFaceStore, stopNativeSpeechSynthesis, useFaceFullscreenContext, useFaceStore, useFaceStoreInstance, useFullscreen, useMessageVisualState, vizijFaceRendererStrategy };
|