talking-head-studio 0.4.0 → 0.4.1

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.
@@ -28,7 +28,7 @@ export interface TalkingHeadVisualizationRef {
28
28
  /**
29
29
  * TalkingHeadVisualization — optimized component for rendering the 3D avatar.
30
30
  *
31
- * On native: uses FilamentAvatar (direct morph writes, no WebView bridge).
31
+ * On native: uses WgpuAvatar (direct morph writes, no WebView bridge).
32
32
  * On web: uses TalkingHead WebView renderer.
33
33
  */
34
34
  export declare const TalkingHeadVisualization: React.ForwardRefExoticComponent<TalkingHeadVisualizationProps & React.RefAttributes<TalkingHeadVisualizationRef>>;
@@ -6,9 +6,9 @@ const jsx_runtime_1 = require("react/jsx-runtime");
6
6
  const react_1 = require("react");
7
7
  const react_native_1 = require("react-native");
8
8
  const TalkingHead_1 = require("./TalkingHead");
9
- const FilamentAvatar_1 = require("./filament/FilamentAvatar");
9
+ const WgpuAvatar_1 = require("./wgpu/WgpuAvatar");
10
10
  const avatarUtils_1 = require("./utils/avatarUtils");
11
- const faceSqueezeAssets_1 = require("./filament/faceSqueezeAssets");
11
+ const faceSqueezeAssets_1 = require("./wgpu/faceSqueezeAssets");
12
12
  // Cached fallback data URI — resolved once, reused across all instances
13
13
  let _fallbackDataUri = null;
14
14
  let _fallbackPromise = null;
@@ -41,16 +41,16 @@ function getLoadingLabel(stage) {
41
41
  /**
42
42
  * TalkingHeadVisualization — optimized component for rendering the 3D avatar.
43
43
  *
44
- * On native: uses FilamentAvatar (direct morph writes, no WebView bridge).
44
+ * On native: uses WgpuAvatar (direct morph writes, no WebView bridge).
45
45
  * On web: uses TalkingHead WebView renderer.
46
46
  */
47
47
  exports.TalkingHeadVisualization = (0, react_1.forwardRef)(({ style, avatarUrl, authToken, cameraView = 'head', cameraDistance = 0.2, accessories, mood: initialMood = 'neutral', aspect, focalLength, visemeSchedule, onVisemeScheduleApplied, vendorBaseUrl }, ref) => {
48
48
  const avatarRef = (0, react_1.useRef)(null);
49
49
  // On native, Filament ref is wired via callback ref — store it here so
50
50
  // scheduleVisemes / sendAmplitude can route to it.
51
- const filamentRef = (0, react_1.useRef)(null);
51
+ const wgpuRef = (0, react_1.useRef)(null);
52
52
  // Unified accessor — Filament on native, WebView on web
53
- const activeAvatar = (0, react_1.useCallback)(() => (filamentRef.current ?? avatarRef.current), []);
53
+ const activeAvatar = (0, react_1.useCallback)(() => (wgpuRef.current ?? avatarRef.current), []);
54
54
  // Fallback local GLB data URI — resolved once on mount
55
55
  const [fallbackUrl, setFallbackUrl] = (0, react_1.useState)(_fallbackDataUri);
56
56
  (0, react_1.useEffect)(() => {
@@ -116,7 +116,7 @@ exports.TalkingHeadVisualization = (0, react_1.forwardRef)(({ style, avatarUrl,
116
116
  const av = activeAvatar();
117
117
  // Filament buffers pending schedules internally — no ready gate needed.
118
118
  // WebView (avatarRef) still needs the ready gate.
119
- if (!av || (!filamentRef.current && !isAvatarReady)) {
119
+ if (!av || (!wgpuRef.current && !isAvatarReady)) {
120
120
  pendingVisemeScheduleRef.current = schedule;
121
121
  return;
122
122
  }
@@ -166,7 +166,7 @@ exports.TalkingHeadVisualization = (0, react_1.forwardRef)(({ style, avatarUrl,
166
166
  ready: isAvatarReady,
167
167
  });
168
168
  const av = activeAvatar();
169
- if (!av || (!filamentRef.current && !isAvatarReady)) {
169
+ if (!av || (!wgpuRef.current && !isAvatarReady)) {
170
170
  pendingVisemeScheduleRef.current = visemeSchedule;
171
171
  return;
172
172
  }
@@ -183,8 +183,8 @@ exports.TalkingHeadVisualization = (0, react_1.forwardRef)(({ style, avatarUrl,
183
183
  }, [isAvatarReady, onVisemeScheduleApplied, visemeSchedule, activeAvatar]);
184
184
  // On native use Filament — direct morph writes, no WebView bridge.
185
185
  if (react_native_1.Platform.OS !== 'web') {
186
- return ((0, jsx_runtime_1.jsx)(FilamentAvatar_1.FilamentAvatar, { focalLength: focalLength, ref: (fr) => {
187
- filamentRef.current = fr;
186
+ return ((0, jsx_runtime_1.jsx)(WgpuAvatar_1.WgpuAvatar, { focalLength: focalLength, ref: (fr) => {
187
+ wgpuRef.current = fr;
188
188
  if (typeof ref === 'function')
189
189
  ref(fr);
190
190
  else if (ref)
@@ -43,8 +43,8 @@ const react_native_1 = require("react-native");
43
43
  const THREE = __importStar(require("three"));
44
44
  const native_1 = require("@react-three/fiber/native");
45
45
  const native_2 = require("@react-three/drei/native");
46
- const morphTables_1 = require("../filament/morphTables");
47
- const useAuthedFilamentUri_1 = require("../filament/useAuthedFilamentUri");
46
+ const morphTables_1 = require("./morphTables");
47
+ const useAuthedFilamentUri_1 = require("./useAuthedFilamentUri");
48
48
  // ---------------------------------------------------------------------------
49
49
  // Camera defaults — match FilamentAvatar constants
50
50
  // ---------------------------------------------------------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "talking-head-studio",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Cross-platform 3D avatar component for React Native & web — lip-sync, gestures, accessories, and LLM integration. Powered by TalkingHead + Three.js.",
5
5
  "main": "dist/index.web.js",
6
6
  "browser": "dist/index.web.js",
@@ -37,16 +37,6 @@
37
37
  "types": "./dist/wardrobe/index.d.ts",
38
38
  "default": "./dist/wardrobe/index.js"
39
39
  },
40
- "./filament": {
41
- "react-native": "./dist/filament/index.js",
42
- "types": "./dist/filament/index.d.ts",
43
- "default": "./dist/filament/index.js"
44
- },
45
- "./filament/editor": {
46
- "react-native": "./dist/filament/editor/index.js",
47
- "types": "./dist/filament/editor/index.d.ts",
48
- "default": "./dist/filament/editor/index.js"
49
- },
50
40
  "./wgpu": {
51
41
  "react-native": "./dist/wgpu/index.js",
52
42
  "types": "./dist/wgpu/index.d.ts",
@@ -114,7 +104,6 @@
114
104
  "expo-file-system": ">=17",
115
105
  "react": ">=18",
116
106
  "react-native": ">=0.73",
117
- "react-native-filament": ">=1",
118
107
  "react-native-webview": ">=13",
119
108
  "react-native-wgpu": ">=0.1",
120
109
  "three": ">=0.170"
@@ -126,9 +115,6 @@
126
115
  "react-native-webview": {
127
116
  "optional": true
128
117
  },
129
- "react-native-filament": {
130
- "optional": true
131
- },
132
118
  "react-native-wgpu": {
133
119
  "optional": true
134
120
  },
@@ -1,41 +0,0 @@
1
- /**
2
- * FilamentAvatar — native Filament-based avatar renderer.
3
- *
4
- * Replaces the TalkingHead WebView on iOS/Android with direct Filament
5
- * morph target writes — no WebView bridge, no JS→native→JS roundtrip,
6
- * visemes applied at 60fps in React Native JS.
7
- *
8
- * Implements the full TalkingHeadRef interface so it can be swapped in
9
- * transparently for the WebView renderer.
10
- */
11
- import React from 'react';
12
- import { ViewStyle, StyleProp } from 'react-native';
13
- import type { TalkingHeadViseme, TalkingHeadVisemeSchedule, TalkingHeadAccessory, TalkingHeadMood } from '../TalkingHead';
14
- export declare const CAMERA_FOCAL_FULL = 50;
15
- export declare const CAMERA_FOCAL_PIP = 85;
16
- export interface FilamentAvatarRef {
17
- sendViseme: (viseme: TalkingHeadViseme, weight?: number) => void;
18
- scheduleVisemes: (schedule: TalkingHeadVisemeSchedule) => void;
19
- clearVisemes: () => void;
20
- sendAmplitude: (amplitude: number) => void;
21
- setMood: (mood: TalkingHeadMood) => void;
22
- setHairColor: (color: string) => void;
23
- setSkinColor: (color: string) => void;
24
- setEyeColor: (color: string) => void;
25
- setAccessories: (accessories: TalkingHeadAccessory[]) => void;
26
- }
27
- interface FilamentAvatarProps {
28
- style?: StyleProp<ViewStyle>;
29
- avatarUrl: string | null;
30
- aspect?: number;
31
- focalLength?: number;
32
- mood?: TalkingHeadMood;
33
- hairColor?: string;
34
- skinColor?: string;
35
- eyeColor?: string;
36
- accessories?: TalkingHeadAccessory[];
37
- onReady?: () => void;
38
- onError?: (message: string) => void;
39
- }
40
- export declare const FilamentAvatar: React.ForwardRefExoticComponent<FilamentAvatarProps & React.RefAttributes<FilamentAvatarRef>>;
41
- export {};