talking-head-studio 0.2.5 → 0.2.7

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.
Files changed (111) hide show
  1. package/README.md +8 -7
  2. package/dist/TalkingHead.d.ts +0 -1
  3. package/dist/TalkingHead.js +31 -29
  4. package/dist/TalkingHead.web.d.ts +1 -3
  5. package/dist/TalkingHead.web.js +72 -43
  6. package/dist/appearance/apply.d.ts +0 -1
  7. package/dist/appearance/apply.js +8 -5
  8. package/dist/appearance/index.d.ts +0 -1
  9. package/dist/appearance/index.js +9 -3
  10. package/dist/appearance/matchers.d.ts +0 -1
  11. package/dist/appearance/matchers.js +4 -1
  12. package/dist/appearance/schema.d.ts +0 -1
  13. package/dist/appearance/schema.js +4 -1
  14. package/dist/editor/AvatarCanvas.d.ts +1 -2
  15. package/dist/editor/AvatarCanvas.js +44 -60
  16. package/dist/editor/AvatarCanvasErrorBoundary.d.ts +1 -2
  17. package/dist/editor/AvatarCanvasErrorBoundary.js +9 -14
  18. package/dist/editor/AvatarModel.d.ts +1 -2
  19. package/dist/editor/AvatarModel.js +17 -13
  20. package/dist/editor/RigidAccessory.d.ts +1 -2
  21. package/dist/editor/RigidAccessory.js +19 -17
  22. package/dist/editor/SkinnedClothing.d.ts +1 -2
  23. package/dist/editor/SkinnedClothing.js +46 -9
  24. package/dist/editor/index.d.ts +0 -1
  25. package/dist/editor/index.js +11 -4
  26. package/dist/editor/types.d.ts +0 -1
  27. package/dist/editor/types.js +2 -1
  28. package/dist/html.d.ts +0 -1
  29. package/dist/html.js +8 -5
  30. package/dist/index.d.ts +0 -1
  31. package/dist/index.js +20 -2
  32. package/dist/index.web.d.ts +0 -1
  33. package/dist/index.web.js +20 -2
  34. package/dist/sketchfab/api.d.ts +0 -1
  35. package/dist/sketchfab/api.js +10 -4
  36. package/dist/sketchfab/categories.d.ts +0 -1
  37. package/dist/sketchfab/categories.js +5 -2
  38. package/dist/sketchfab/index.d.ts +0 -1
  39. package/dist/sketchfab/index.js +13 -3
  40. package/dist/sketchfab/types.d.ts +0 -1
  41. package/dist/sketchfab/types.js +2 -1
  42. package/dist/sketchfab/useSketchfabSearch.d.ts +0 -1
  43. package/dist/sketchfab/useSketchfabSearch.js +20 -17
  44. package/dist/voice/convertToWav.d.ts +0 -1
  45. package/dist/voice/convertToWav.js +4 -1
  46. package/dist/voice/index.d.ts +0 -1
  47. package/dist/voice/index.js +9 -3
  48. package/dist/voice/useAudioPlayer.d.ts +0 -1
  49. package/dist/voice/useAudioPlayer.js +7 -4
  50. package/dist/voice/useAudioRecording.d.ts +0 -1
  51. package/dist/voice/useAudioRecording.js +20 -17
  52. package/package.json +10 -8
  53. package/dist/TalkingHead.d.ts.map +0 -1
  54. package/dist/TalkingHead.web.d.ts.map +0 -1
  55. package/dist/__tests__/TalkingHead.test.d.ts +0 -2
  56. package/dist/__tests__/TalkingHead.test.d.ts.map +0 -1
  57. package/dist/__tests__/TalkingHead.test.js +0 -23
  58. package/dist/__tests__/sketchfab.test.d.ts +0 -2
  59. package/dist/__tests__/sketchfab.test.d.ts.map +0 -1
  60. package/dist/__tests__/sketchfab.test.js +0 -21
  61. package/dist/appearance/apply.d.ts.map +0 -1
  62. package/dist/appearance/index.d.ts.map +0 -1
  63. package/dist/appearance/matchers.d.ts.map +0 -1
  64. package/dist/appearance/schema.d.ts.map +0 -1
  65. package/dist/editor/AvatarCanvas.d.ts.map +0 -1
  66. package/dist/editor/AvatarCanvasErrorBoundary.d.ts.map +0 -1
  67. package/dist/editor/AvatarModel.d.ts.map +0 -1
  68. package/dist/editor/RigidAccessory.d.ts.map +0 -1
  69. package/dist/editor/SkinnedClothing.d.ts.map +0 -1
  70. package/dist/editor/index.d.ts.map +0 -1
  71. package/dist/editor/types.d.ts.map +0 -1
  72. package/dist/html.d.ts.map +0 -1
  73. package/dist/index.d.ts.map +0 -1
  74. package/dist/index.web.d.ts.map +0 -1
  75. package/dist/sketchfab/api.d.ts.map +0 -1
  76. package/dist/sketchfab/categories.d.ts.map +0 -1
  77. package/dist/sketchfab/index.d.ts.map +0 -1
  78. package/dist/sketchfab/types.d.ts.map +0 -1
  79. package/dist/sketchfab/useSketchfabSearch.d.ts.map +0 -1
  80. package/dist/voice/convertToWav.d.ts.map +0 -1
  81. package/dist/voice/index.d.ts.map +0 -1
  82. package/dist/voice/useAudioPlayer.d.ts.map +0 -1
  83. package/dist/voice/useAudioRecording.d.ts.map +0 -1
  84. package/src/TalkingHead.tsx +0 -276
  85. package/src/TalkingHead.web.tsx +0 -220
  86. package/src/__tests__/TalkingHead.test.tsx +0 -32
  87. package/src/__tests__/sketchfab.test.ts +0 -24
  88. package/src/appearance/apply.ts +0 -94
  89. package/src/appearance/index.ts +0 -4
  90. package/src/appearance/matchers.ts +0 -43
  91. package/src/appearance/schema.ts +0 -35
  92. package/src/editor/AvatarCanvas.tsx +0 -167
  93. package/src/editor/AvatarCanvasErrorBoundary.tsx +0 -64
  94. package/src/editor/AvatarModel.tsx +0 -49
  95. package/src/editor/RigidAccessory.tsx +0 -130
  96. package/src/editor/SkinnedClothing.tsx +0 -114
  97. package/src/editor/index.ts +0 -5
  98. package/src/editor/r3f-shim.d.ts +0 -34
  99. package/src/editor/types.ts +0 -30
  100. package/src/html.ts +0 -678
  101. package/src/index.ts +0 -11
  102. package/src/index.web.ts +0 -8
  103. package/src/sketchfab/api.ts +0 -82
  104. package/src/sketchfab/categories.ts +0 -127
  105. package/src/sketchfab/index.ts +0 -6
  106. package/src/sketchfab/types.ts +0 -40
  107. package/src/sketchfab/useSketchfabSearch.ts +0 -110
  108. package/src/voice/convertToWav.ts +0 -87
  109. package/src/voice/index.ts +0 -7
  110. package/src/voice/useAudioPlayer.ts +0 -78
  111. package/src/voice/useAudioRecording.ts +0 -207
@@ -1,5 +1,9 @@
1
- import { Component } from 'react';
2
- export class AvatarCanvasErrorBoundary extends Component {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AvatarCanvasErrorBoundary = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ class AvatarCanvasErrorBoundary extends react_1.Component {
3
7
  constructor() {
4
8
  super(...arguments);
5
9
  this.state = {
@@ -24,18 +28,9 @@ export class AvatarCanvasErrorBoundary extends Component {
24
28
  }
25
29
  render() {
26
30
  if (this.state.hasError) {
27
- return (<div className="flex h-full w-full flex-col items-center justify-center gap-3 p-4 text-center">
28
- <p className="text-sm font-medium text-foreground">3D rendering unavailable</p>
29
- <p className="text-xs text-muted-foreground">
30
- Your device or browser cannot initialize WebGL.
31
- </p>
32
- <button className="rounded-md border px-3 py-1.5 text-xs font-medium hover:bg-muted" onClick={this.handleRetry} type="button">
33
- Retry
34
- </button>
35
- </div>);
31
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "flex h-full w-full flex-col items-center justify-center gap-3 p-4 text-center", children: [(0, jsx_runtime_1.jsx)("p", { className: "text-sm font-medium text-foreground", children: "3D rendering unavailable" }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-muted-foreground", children: "Your device or browser cannot initialize WebGL." }), (0, jsx_runtime_1.jsx)("button", { className: "rounded-md border px-3 py-1.5 text-xs font-medium hover:bg-muted", onClick: this.handleRetry, type: "button", children: "Retry" })] }));
36
32
  }
37
- return (<div className="h-full w-full" key={this.state.retryKey}>
38
- {this.props.children}
39
- </div>);
33
+ return ((0, jsx_runtime_1.jsx)("div", { className: "h-full w-full", children: this.props.children }, this.state.retryKey));
40
34
  }
41
35
  }
36
+ exports.AvatarCanvasErrorBoundary = AvatarCanvasErrorBoundary;
@@ -7,6 +7,5 @@ interface AvatarModelProps {
7
7
  onSkeletonReady?: (skeleton: any) => void;
8
8
  onBoundsReady?: (center: typeof Vector3.prototype, height: number) => void;
9
9
  }
10
- export declare function AvatarModel({ url, appearance, scale, onSkeletonReady, onBoundsReady, }: AvatarModelProps): import("react").JSX.Element;
10
+ export declare function AvatarModel({ url, appearance, scale, onSkeletonReady, onBoundsReady, }: AvatarModelProps): import("react/jsx-runtime").JSX.Element;
11
11
  export {};
12
- //# sourceMappingURL=AvatarModel.d.ts.map
@@ -1,12 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AvatarModel = AvatarModel;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
1
5
  // @ts-nocheck
2
- import { useGLTF } from '@react-three/drei';
3
- import { useEffect, useRef } from 'react';
4
- import { Box3, Vector3 } from 'three';
5
- import { applyAppearanceToObject3D } from '../appearance';
6
- export function AvatarModel({ url, appearance, scale = 1, onSkeletonReady, onBoundsReady, }) {
7
- const { scene } = useGLTF(url);
8
- const groupRef = useRef(null);
9
- useEffect(() => {
6
+ const drei_1 = require("@react-three/drei");
7
+ const react_1 = require("react");
8
+ const three_1 = require("three");
9
+ const appearance_1 = require("../appearance");
10
+ function AvatarModel({ url, appearance, scale = 1, onSkeletonReady, onBoundsReady, }) {
11
+ const { scene } = (0, drei_1.useGLTF)(url);
12
+ const groupRef = (0, react_1.useRef)(null);
13
+ (0, react_1.useEffect)(() => {
10
14
  if (!scene)
11
15
  return;
12
16
  scene.traverse((child) => {
@@ -15,17 +19,17 @@ export function AvatarModel({ url, appearance, scale = 1, onSkeletonReady, onBou
15
19
  }
16
20
  });
17
21
  if (onBoundsReady) {
18
- const box = new Box3().setFromObject(scene);
19
- const center = new Vector3();
22
+ const box = new three_1.Box3().setFromObject(scene);
23
+ const center = new three_1.Vector3();
20
24
  box.getCenter(center);
21
25
  const height = box.max.y - box.min.y;
22
26
  onBoundsReady(center, height);
23
27
  }
24
28
  }, [scene, onSkeletonReady, onBoundsReady]);
25
- useEffect(() => {
29
+ (0, react_1.useEffect)(() => {
26
30
  if (!scene)
27
31
  return;
28
- applyAppearanceToObject3D(scene, appearance ?? { version: 1 });
32
+ (0, appearance_1.applyAppearanceToObject3D)(scene, appearance ?? { version: 1 });
29
33
  }, [scene, appearance]);
30
- return <primitive ref={groupRef} object={scene} scale={scale}/>;
34
+ return (0, jsx_runtime_1.jsx)("primitive", { ref: groupRef, object: scene, scale: scale });
31
35
  }
@@ -10,6 +10,5 @@ interface RigidAccessoryProps {
10
10
  isEditing?: boolean;
11
11
  onPlacementChange?: (assetId: string, placement: AssetPlacement) => void;
12
12
  }
13
- export declare function RigidAccessory({ assetId, url, avatarScene, attachBone, offsetPosition, offsetRotation, scale, isEditing, onPlacementChange, }: RigidAccessoryProps): import("react").JSX.Element | null;
13
+ export declare function RigidAccessory({ assetId, url, avatarScene, attachBone, offsetPosition, offsetRotation, scale, isEditing, onPlacementChange, }: RigidAccessoryProps): import("react/jsx-runtime").JSX.Element | null;
14
14
  export {};
15
- //# sourceMappingURL=RigidAccessory.d.ts.map
@@ -1,13 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RigidAccessory = RigidAccessory;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
1
5
  // @ts-nocheck
2
- import { useGLTF, PivotControls } from '@react-three/drei';
3
- import { useEffect, useMemo, useState } from 'react';
4
- import { Box3, Vector3 } from 'three';
5
- export function RigidAccessory({ assetId, url, avatarScene, attachBone, offsetPosition, offsetRotation, scale = 1, isEditing = false, onPlacementChange, }) {
6
- const { scene } = useGLTF(url);
6
+ const drei_1 = require("@react-three/drei");
7
+ const react_1 = require("react");
8
+ const three_1 = require("three");
9
+ function RigidAccessory({ assetId, url, avatarScene, attachBone, offsetPosition, offsetRotation, scale = 1, isEditing = false, onPlacementChange, }) {
10
+ const { scene } = (0, drei_1.useGLTF)(url);
7
11
  // Clone uniquely for this instance
8
- const clone = useMemo(() => scene.clone(true), [scene]);
9
- const [basePos, setBasePos] = useState(null);
10
- useEffect(() => {
12
+ const clone = (0, react_1.useMemo)(() => scene.clone(true), [scene]);
13
+ const [basePos, setBasePos] = (0, react_1.useState)(null);
14
+ (0, react_1.useEffect)(() => {
11
15
  if (!avatarScene)
12
16
  return;
13
17
  let targetBone = null;
@@ -18,16 +22,16 @@ export function RigidAccessory({ assetId, url, avatarScene, attachBone, offsetPo
18
22
  });
19
23
  if (!targetBone)
20
24
  return;
21
- const box = new Box3().setFromObject(clone);
25
+ const box = new three_1.Box3().setFromObject(clone);
22
26
  const meshMin = box.min;
23
- const meshCenter = new Vector3();
27
+ const meshCenter = new three_1.Vector3();
24
28
  box.getCenter(meshCenter);
25
- const boneWorldPos = new Vector3();
29
+ const boneWorldPos = new three_1.Vector3();
26
30
  targetBone.getWorldPosition(boneWorldPos);
27
- setBasePos(new Vector3(boneWorldPos.x - meshCenter.x, boneWorldPos.y - meshMin.y, boneWorldPos.z - meshCenter.z));
31
+ setBasePos(new three_1.Vector3(boneWorldPos.x - meshCenter.x, boneWorldPos.y - meshMin.y, boneWorldPos.z - meshCenter.z));
28
32
  }, [avatarScene, attachBone, clone]);
29
33
  // Apply transforms live
30
- useEffect(() => {
34
+ (0, react_1.useEffect)(() => {
31
35
  if (!basePos)
32
36
  return;
33
37
  clone.position.copy(basePos);
@@ -68,9 +72,7 @@ export function RigidAccessory({ assetId, url, avatarScene, attachBone, offsetPo
68
72
  if (!basePos)
69
73
  return null;
70
74
  if (isEditing) {
71
- return (<PivotControls anchor={[0, 0, 0]} scale={100} fixed={true} depthTest={false} activeAxes={[true, true, true]} onDragEnd={handleDragEnd} autoTransform={true}>
72
- <primitive object={clone}/>
73
- </PivotControls>);
75
+ return ((0, jsx_runtime_1.jsx)(drei_1.PivotControls, { anchor: [0, 0, 0], scale: 100, fixed: true, depthTest: false, activeAxes: [true, true, true], onDragEnd: handleDragEnd, autoTransform: true, children: (0, jsx_runtime_1.jsx)("primitive", { object: clone }) }));
74
76
  }
75
- return <primitive object={clone}/>;
77
+ return (0, jsx_runtime_1.jsx)("primitive", { object: clone });
76
78
  }
@@ -2,6 +2,5 @@ interface SkinnedClothingProps {
2
2
  url: string;
3
3
  avatarSkeleton: any;
4
4
  }
5
- export declare function SkinnedClothing({ url, avatarSkeleton }: SkinnedClothingProps): import("react").JSX.Element;
5
+ export declare function SkinnedClothing({ url, avatarSkeleton }: SkinnedClothingProps): import("react/jsx-runtime").JSX.Element;
6
6
  export {};
7
- //# sourceMappingURL=SkinnedClothing.d.ts.map
@@ -1,8 +1,45 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.SkinnedClothing = SkinnedClothing;
37
+ const jsx_runtime_1 = require("react/jsx-runtime");
1
38
  // @ts-nocheck
2
- import { useGLTF } from '@react-three/drei';
3
- import { useEffect, useRef } from 'react';
4
- import * as THREE from 'three';
5
- import * as SkeletonUtils from 'three/examples/jsm/utils/SkeletonUtils.js';
39
+ const drei_1 = require("@react-three/drei");
40
+ const react_1 = require("react");
41
+ const THREE = __importStar(require("three"));
42
+ const SkeletonUtils = __importStar(require("three/examples/jsm/utils/SkeletonUtils.js"));
6
43
  /**
7
44
  * Rebind a skinned mesh's bones to the avatar skeleton by matching bone names.
8
45
  * This handles hair packs / clothing that share the same rig convention but
@@ -58,10 +95,10 @@ function rebindToAvatarSkeleton(mesh, avatarSkeleton) {
58
95
  }));
59
96
  mesh.bind(newSkeleton);
60
97
  }
61
- export function SkinnedClothing({ url, avatarSkeleton }) {
62
- const { scene } = useGLTF(url);
63
- const groupRef = useRef(null);
64
- useEffect(() => {
98
+ function SkinnedClothing({ url, avatarSkeleton }) {
99
+ const { scene } = (0, drei_1.useGLTF)(url);
100
+ const groupRef = (0, react_1.useRef)(null);
101
+ (0, react_1.useEffect)(() => {
65
102
  const group = groupRef.current;
66
103
  if (!group || !scene || !avatarSkeleton)
67
104
  return;
@@ -84,5 +121,5 @@ export function SkinnedClothing({ url, avatarSkeleton }) {
84
121
  });
85
122
  };
86
123
  }, [scene, avatarSkeleton]);
87
- return <group ref={groupRef}/>;
124
+ return (0, jsx_runtime_1.jsx)("group", { ref: groupRef });
88
125
  }
@@ -3,4 +3,3 @@ export { AvatarModel } from './AvatarModel';
3
3
  export { RigidAccessory } from './RigidAccessory';
4
4
  export { SkinnedClothing } from './SkinnedClothing';
5
5
  export type { AvatarEditorProps, AssetPlacement, EquippedAsset } from './types';
6
- //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,11 @@
1
- export { AvatarCanvas } from './AvatarCanvas';
2
- export { AvatarModel } from './AvatarModel';
3
- export { RigidAccessory } from './RigidAccessory';
4
- export { SkinnedClothing } from './SkinnedClothing';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SkinnedClothing = exports.RigidAccessory = exports.AvatarModel = exports.AvatarCanvas = void 0;
4
+ var AvatarCanvas_1 = require("./AvatarCanvas");
5
+ Object.defineProperty(exports, "AvatarCanvas", { enumerable: true, get: function () { return AvatarCanvas_1.AvatarCanvas; } });
6
+ var AvatarModel_1 = require("./AvatarModel");
7
+ Object.defineProperty(exports, "AvatarModel", { enumerable: true, get: function () { return AvatarModel_1.AvatarModel; } });
8
+ var RigidAccessory_1 = require("./RigidAccessory");
9
+ Object.defineProperty(exports, "RigidAccessory", { enumerable: true, get: function () { return RigidAccessory_1.RigidAccessory; } });
10
+ var SkinnedClothing_1 = require("./SkinnedClothing");
11
+ Object.defineProperty(exports, "SkinnedClothing", { enumerable: true, get: function () { return SkinnedClothing_1.SkinnedClothing; } });
@@ -25,4 +25,3 @@ export interface AvatarEditorProps {
25
25
  className?: string;
26
26
  style?: React.CSSProperties;
27
27
  }
28
- //# sourceMappingURL=types.d.ts.map
@@ -1 +1,2 @@
1
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/html.d.ts CHANGED
@@ -10,4 +10,3 @@ export type AvatarConfig = {
10
10
  initialEyeColor?: string;
11
11
  };
12
12
  export declare function buildAvatarHtml(config: AvatarConfig): string;
13
- //# sourceMappingURL=html.d.ts.map
package/dist/html.js CHANGED
@@ -1,5 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildAvatarHtml = buildAvatarHtml;
1
4
  const VALID_MOODS = new Set(['neutral', 'happy', 'sad', 'angry', 'excited', 'thinking', 'concerned', 'surprised']);
2
- export function buildAvatarHtml(config) {
5
+ function buildAvatarHtml(config) {
3
6
  // Sanitize mood at build time so the WebView never receives an invalid value
4
7
  const safeMood = VALID_MOODS.has(config.mood) ? config.mood : 'neutral';
5
8
  return `
@@ -27,9 +30,9 @@ export function buildAvatarHtml(config) {
27
30
  <script type="module">
28
31
  const AUTH_TOKEN = ${JSON.stringify(config.authToken ?? null)};
29
32
  const TALKING_HEAD_URL = 'https://cdn.jsdelivr.net/gh/met4citizen/TalkingHead@1.7/modules/talkinghead.mjs';
30
- const HEAD_AUDIO_URL = 'https://cdn.jsdelivr.net/gh/met4citizen/HeadAudio@main/dist/headaudio.min.mjs';
31
- const HEAD_AUDIO_WORKLET = 'https://cdn.jsdelivr.net/gh/met4citizen/HeadAudio@main/dist/headworklet.min.mjs';
32
- const HEAD_AUDIO_MODEL = 'https://cdn.jsdelivr.net/gh/met4citizen/HeadAudio@main/dist/model-en-mixed.bin';
33
+ const HEAD_AUDIO_URL = 'https://cdn.jsdelivr.net/gh/met4citizen/HeadAudio@v0.1.0-alpha/dist/headaudio.min.mjs';
34
+ const HEAD_AUDIO_WORKLET = 'https://cdn.jsdelivr.net/gh/met4citizen/HeadAudio@v0.1.0-alpha/dist/headworklet.min.mjs';
35
+ const HEAD_AUDIO_MODEL = 'https://cdn.jsdelivr.net/gh/met4citizen/HeadAudio@v0.1.0-alpha/dist/model-en-mixed.bin';
33
36
 
34
37
  let AVATAR_URL = ${JSON.stringify(config.avatarUrl)};
35
38
  const INITIAL_MOOD = ${JSON.stringify(safeMood)};
@@ -627,7 +630,7 @@ function onIncomingMessage(event) {
627
630
  if (jawKey !== undefined) jawMorphCache.push({ influences: mesh.morphTargetInfluences, idx: mesh.morphTargetDictionary[jawKey] });
628
631
  }
629
632
  }
630
- const val = Math.min(1, msg.value * 2.5);
633
+ const val = Math.min(1, msg.value * 1.8);
631
634
  amplitudeDecay = Math.max(amplitudeDecay * 0.7, val);
632
635
  for (let i = 0; i < jawMorphCache.length; i++) jawMorphCache[i].influences[jawMorphCache[i].idx] = amplitudeDecay;
633
636
  } else if (msg.type === 'viseme') {
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  export type { TalkingHeadAccessory, TalkingHeadMood, TalkingHeadProps, TalkingHeadRef, TalkingHeadViseme, TalkingHeadVisemeCue, TalkingHeadVisemeSchedule, } from './TalkingHead';
2
2
  export { TalkingHead } from './TalkingHead';
3
3
  export * from './appearance';
4
- //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,2 +1,20 @@
1
- export { TalkingHead } from './TalkingHead';
2
- export * from './appearance';
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.TalkingHead = void 0;
18
+ var TalkingHead_1 = require("./TalkingHead");
19
+ Object.defineProperty(exports, "TalkingHead", { enumerable: true, get: function () { return TalkingHead_1.TalkingHead; } });
20
+ __exportStar(require("./appearance"), exports);
@@ -1,4 +1,3 @@
1
1
  export type { TalkingHeadAccessory, TalkingHeadMood, TalkingHeadProps, TalkingHeadRef, } from './TalkingHead.web';
2
2
  export { TalkingHead } from './TalkingHead.web';
3
3
  export * from './appearance';
4
- //# sourceMappingURL=index.web.d.ts.map
package/dist/index.web.js CHANGED
@@ -1,2 +1,20 @@
1
- export { TalkingHead } from './TalkingHead.web';
2
- export * from './appearance';
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.TalkingHead = void 0;
18
+ var TalkingHead_web_1 = require("./TalkingHead.web");
19
+ Object.defineProperty(exports, "TalkingHead", { enumerable: true, get: function () { return TalkingHead_web_1.TalkingHead; } });
20
+ __exportStar(require("./appearance"), exports);
@@ -9,4 +9,3 @@ export declare function searchSketchfab(options: SketchfabSearchOptions): Promis
9
9
  export declare function getDownloadUrl(uid: string, apiKey: string): Promise<string | null>;
10
10
  export declare function downloadModel(uid: string, name: string, apiKey: string): Promise<File>;
11
11
  export declare function getBestThumbnail(thumbnails: SketchfabModel['thumbnails'], targetWidth?: number): string;
12
- //# sourceMappingURL=api.d.ts.map
@@ -1,6 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.searchSketchfab = searchSketchfab;
4
+ exports.getDownloadUrl = getDownloadUrl;
5
+ exports.downloadModel = downloadModel;
6
+ exports.getBestThumbnail = getBestThumbnail;
1
7
  const SKETCHFAB_API_BASE = 'https://api.sketchfab.com/v3';
2
8
  const PAGE_SIZE = 24;
3
- export async function searchSketchfab(options) {
9
+ async function searchSketchfab(options) {
4
10
  const { apiKey, query = 'character humanoid avatar', cursor, count = PAGE_SIZE } = options;
5
11
  const params = new URLSearchParams({
6
12
  type: 'models',
@@ -20,7 +26,7 @@ export async function searchSketchfab(options) {
20
26
  }
21
27
  return response.json();
22
28
  }
23
- export async function getDownloadUrl(uid, apiKey) {
29
+ async function getDownloadUrl(uid, apiKey) {
24
30
  const response = await fetch(`${SKETCHFAB_API_BASE}/models/${uid}/download`, {
25
31
  headers: { Authorization: `Token ${apiKey}` },
26
32
  });
@@ -30,7 +36,7 @@ export async function getDownloadUrl(uid, apiKey) {
30
36
  const data = (await response.json());
31
37
  return data?.glb?.url ?? data?.gltf?.url ?? null;
32
38
  }
33
- export async function downloadModel(uid, name, apiKey) {
39
+ async function downloadModel(uid, name, apiKey) {
34
40
  const url = await getDownloadUrl(uid, apiKey);
35
41
  if (!url) {
36
42
  throw new Error(`No download URL available for model ${uid}`);
@@ -43,7 +49,7 @@ export async function downloadModel(uid, name, apiKey) {
43
49
  const cleanName = name.replace(/[^\w\s-]/g, '').trim() || 'model';
44
50
  return new File([blob], `${cleanName}.glb`, { type: 'model/gltf-binary' });
45
51
  }
46
- export function getBestThumbnail(thumbnails, targetWidth = 280) {
52
+ function getBestThumbnail(thumbnails, targetWidth = 280) {
47
53
  if (!thumbnails?.images?.length) {
48
54
  return '';
49
55
  }
@@ -2,4 +2,3 @@ import type { AccessoryCategory } from './types';
2
2
  export declare const ACCESSORY_CATEGORIES: AccessoryCategory[];
3
3
  /** Tags indicating a humanoid / character model (for badge display in avatar browsers) */
4
4
  export declare const HUMANOID_TAGS: readonly ["character", "humanoid", "human", "anime", "avatar", "person", "figure", "girl", "boy", "woman", "man"];
5
- //# sourceMappingURL=categories.d.ts.map
@@ -1,4 +1,7 @@
1
- export const ACCESSORY_CATEGORIES = [
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HUMANOID_TAGS = exports.ACCESSORY_CATEGORIES = void 0;
4
+ exports.ACCESSORY_CATEGORIES = [
2
5
  {
3
6
  id: 'hair',
4
7
  label: 'Hair',
@@ -109,7 +112,7 @@ export const ACCESSORY_CATEGORIES = [
109
112
  },
110
113
  ];
111
114
  /** Tags indicating a humanoid / character model (for badge display in avatar browsers) */
112
- export const HUMANOID_TAGS = [
115
+ exports.HUMANOID_TAGS = [
113
116
  'character',
114
117
  'humanoid',
115
118
  'human',
@@ -4,4 +4,3 @@ export { useSketchfabSearch } from './useSketchfabSearch';
4
4
  export type { UseSketchfabSearchOptions, UseSketchfabSearchResult } from './useSketchfabSearch';
5
5
  export { ACCESSORY_CATEGORIES, HUMANOID_TAGS } from './categories';
6
6
  export type { SketchfabModel, SketchfabResponse, AccessoryCategory } from './types';
7
- //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,13 @@
1
- export { searchSketchfab, getDownloadUrl, downloadModel, getBestThumbnail } from './api';
2
- export { useSketchfabSearch } from './useSketchfabSearch';
3
- export { ACCESSORY_CATEGORIES, HUMANOID_TAGS } from './categories';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HUMANOID_TAGS = exports.ACCESSORY_CATEGORIES = exports.useSketchfabSearch = exports.getBestThumbnail = exports.downloadModel = exports.getDownloadUrl = exports.searchSketchfab = void 0;
4
+ var api_1 = require("./api");
5
+ Object.defineProperty(exports, "searchSketchfab", { enumerable: true, get: function () { return api_1.searchSketchfab; } });
6
+ Object.defineProperty(exports, "getDownloadUrl", { enumerable: true, get: function () { return api_1.getDownloadUrl; } });
7
+ Object.defineProperty(exports, "downloadModel", { enumerable: true, get: function () { return api_1.downloadModel; } });
8
+ Object.defineProperty(exports, "getBestThumbnail", { enumerable: true, get: function () { return api_1.getBestThumbnail; } });
9
+ var useSketchfabSearch_1 = require("./useSketchfabSearch");
10
+ Object.defineProperty(exports, "useSketchfabSearch", { enumerable: true, get: function () { return useSketchfabSearch_1.useSketchfabSearch; } });
11
+ var categories_1 = require("./categories");
12
+ Object.defineProperty(exports, "ACCESSORY_CATEGORIES", { enumerable: true, get: function () { return categories_1.ACCESSORY_CATEGORIES; } });
13
+ Object.defineProperty(exports, "HUMANOID_TAGS", { enumerable: true, get: function () { return categories_1.HUMANOID_TAGS; } });
@@ -48,4 +48,3 @@ export interface AccessoryCategory {
48
48
  defaultQuery: string;
49
49
  quickTags: string[];
50
50
  }
51
- //# sourceMappingURL=types.d.ts.map
@@ -1 +1,2 @@
1
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -16,4 +16,3 @@ export interface UseSketchfabSearchResult {
16
16
  prevPage: () => void;
17
17
  }
18
18
  export declare function useSketchfabSearch({ apiKey, initialQuery, debounceMs, }: UseSketchfabSearchOptions): UseSketchfabSearchResult;
19
- //# sourceMappingURL=useSketchfabSearch.d.ts.map
@@ -1,16 +1,19 @@
1
- import { useCallback, useEffect, useRef, useState } from 'react';
2
- import { searchSketchfab } from './api';
3
- export function useSketchfabSearch({ apiKey, initialQuery = 'character humanoid avatar', debounceMs = 400, }) {
4
- const [query, setQueryRaw] = useState(initialQuery);
5
- const [debouncedQuery, setDebouncedQuery] = useState(initialQuery);
6
- const [cursorStack, setCursorStack] = useState([]);
7
- const [currentCursor, setCurrentCursor] = useState();
8
- const [models, setModels] = useState([]);
9
- const [isLoading, setIsLoading] = useState(false);
10
- const [error, setError] = useState(null);
11
- const [cursors, setCursors] = useState();
12
- const debounceTimer = useRef(null);
13
- const setQuery = useCallback((value) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useSketchfabSearch = useSketchfabSearch;
4
+ const react_1 = require("react");
5
+ const api_1 = require("./api");
6
+ function useSketchfabSearch({ apiKey, initialQuery = 'character humanoid avatar', debounceMs = 400, }) {
7
+ const [query, setQueryRaw] = (0, react_1.useState)(initialQuery);
8
+ const [debouncedQuery, setDebouncedQuery] = (0, react_1.useState)(initialQuery);
9
+ const [cursorStack, setCursorStack] = (0, react_1.useState)([]);
10
+ const [currentCursor, setCurrentCursor] = (0, react_1.useState)();
11
+ const [models, setModels] = (0, react_1.useState)([]);
12
+ const [isLoading, setIsLoading] = (0, react_1.useState)(false);
13
+ const [error, setError] = (0, react_1.useState)(null);
14
+ const [cursors, setCursors] = (0, react_1.useState)();
15
+ const debounceTimer = (0, react_1.useRef)(null);
16
+ const setQuery = (0, react_1.useCallback)((value) => {
14
17
  setQueryRaw(value);
15
18
  if (debounceTimer.current) {
16
19
  clearTimeout(debounceTimer.current);
@@ -21,11 +24,11 @@ export function useSketchfabSearch({ apiKey, initialQuery = 'character humanoid
21
24
  setCursorStack([]);
22
25
  }, debounceMs);
23
26
  }, [debounceMs]);
24
- useEffect(() => {
27
+ (0, react_1.useEffect)(() => {
25
28
  let cancelled = false;
26
29
  setIsLoading(true);
27
30
  setError(null);
28
- searchSketchfab({ apiKey, query: debouncedQuery, cursor: currentCursor })
31
+ (0, api_1.searchSketchfab)({ apiKey, query: debouncedQuery, cursor: currentCursor })
29
32
  .then((response) => {
30
33
  if (cancelled) {
31
34
  return;
@@ -48,7 +51,7 @@ export function useSketchfabSearch({ apiKey, initialQuery = 'character humanoid
48
51
  cancelled = true;
49
52
  };
50
53
  }, [apiKey, currentCursor, debouncedQuery]);
51
- const nextPage = useCallback(() => {
54
+ const nextPage = (0, react_1.useCallback)(() => {
52
55
  const nextCursor = cursors?.next ?? undefined;
53
56
  if (!nextCursor) {
54
57
  return;
@@ -56,7 +59,7 @@ export function useSketchfabSearch({ apiKey, initialQuery = 'character humanoid
56
59
  setCursorStack((current) => [...current, currentCursor ?? '']);
57
60
  setCurrentCursor(nextCursor);
58
61
  }, [currentCursor, cursors]);
59
- const prevPage = useCallback(() => {
62
+ const prevPage = (0, react_1.useCallback)(() => {
60
63
  setCursorStack((current) => {
61
64
  const next = [...current];
62
65
  const previousCursor = next.pop();
@@ -3,4 +3,3 @@
3
3
  * Handles WebM/opus output from MediaRecorder without requiring ffmpeg.
4
4
  */
5
5
  export declare function convertToWav(audioBlob: Blob): Promise<Blob>;
6
- //# sourceMappingURL=convertToWav.d.ts.map
@@ -1,8 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertToWav = convertToWav;
1
4
  /**
2
5
  * Convert any audio blob to WAV format using the Web Audio API.
3
6
  * Handles WebM/opus output from MediaRecorder without requiring ffmpeg.
4
7
  */
5
- export async function convertToWav(audioBlob) {
8
+ async function convertToWav(audioBlob) {
6
9
  // Already WAV — nothing to do.
7
10
  if (audioBlob.type === 'audio/wav')
8
11
  return audioBlob;
@@ -3,4 +3,3 @@ export type { UseAudioRecordingOptions, UseAudioRecordingReturn } from './useAud
3
3
  export { useAudioPlayer } from './useAudioPlayer';
4
4
  export type { UseAudioPlayerOptions, UseAudioPlayerReturn } from './useAudioPlayer';
5
5
  export { convertToWav } from './convertToWav';
6
- //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,9 @@
1
- export { useAudioRecording } from './useAudioRecording';
2
- export { useAudioPlayer } from './useAudioPlayer';
3
- export { convertToWav } from './convertToWav';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertToWav = exports.useAudioPlayer = exports.useAudioRecording = void 0;
4
+ var useAudioRecording_1 = require("./useAudioRecording");
5
+ Object.defineProperty(exports, "useAudioRecording", { enumerable: true, get: function () { return useAudioRecording_1.useAudioRecording; } });
6
+ var useAudioPlayer_1 = require("./useAudioPlayer");
7
+ Object.defineProperty(exports, "useAudioPlayer", { enumerable: true, get: function () { return useAudioPlayer_1.useAudioPlayer; } });
8
+ var convertToWav_1 = require("./convertToWav");
9
+ Object.defineProperty(exports, "convertToWav", { enumerable: true, get: function () { return convertToWav_1.convertToWav; } });
@@ -8,4 +8,3 @@ export interface UseAudioPlayerReturn {
8
8
  cleanup: () => void;
9
9
  }
10
10
  export declare function useAudioPlayer({ onError, }?: UseAudioPlayerOptions): UseAudioPlayerReturn;
11
- //# sourceMappingURL=useAudioPlayer.d.ts.map
@@ -1,7 +1,10 @@
1
- import { useRef, useState } from 'react';
2
- export function useAudioPlayer({ onError, } = {}) {
3
- const [isPlaying, setIsPlaying] = useState(false);
4
- const audioRef = useRef(null);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useAudioPlayer = useAudioPlayer;
4
+ const react_1 = require("react");
5
+ function useAudioPlayer({ onError, } = {}) {
6
+ const [isPlaying, setIsPlaying] = (0, react_1.useState)(false);
7
+ const audioRef = (0, react_1.useRef)(null);
5
8
  const playPause = (file) => {
6
9
  if (!file)
7
10
  return;