talking-head-studio 0.4.10 → 0.4.12
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 +299 -337
- package/dist/TalkingHead.d.ts +44 -28
- package/dist/TalkingHead.js +21 -2
- package/dist/TalkingHead.web.d.ts +37 -4
- package/dist/TalkingHead.web.js +28 -8
- package/dist/TalkingHeadVisualization.d.ts +22 -0
- package/dist/TalkingHeadVisualization.js +30 -10
- package/dist/api/studioApi.d.ts +12 -1
- package/dist/api/studioApi.js +41 -28
- package/dist/appearance/apply.js +2 -3
- package/dist/appearance/matchers.js +1 -2
- package/dist/appearance/schema.js +1 -2
- package/dist/contract.d.ts +14 -0
- package/dist/contract.js +30 -0
- package/dist/core/avatar/avatarCapabilities.d.ts +60 -0
- package/dist/core/avatar/avatarCapabilities.js +100 -0
- package/dist/core/avatar/backend.d.ts +130 -0
- package/dist/core/avatar/backend.js +4 -0
- package/dist/core/avatar/backends/gaussian.d.ts +49 -0
- package/dist/core/avatar/backends/gaussian.js +293 -0
- package/dist/core/avatar/backends/index.d.ts +3 -0
- package/dist/core/avatar/backends/index.js +7 -0
- package/dist/core/avatar/backends/morphTarget.d.ts +39 -0
- package/dist/core/avatar/backends/morphTarget.js +179 -0
- package/dist/core/avatar/faceControls.d.ts +40 -0
- package/dist/core/avatar/faceControls.js +138 -0
- package/dist/core/avatar/motion.d.ts +1713 -0
- package/dist/core/avatar/motion.js +550 -0
- package/dist/core/avatar/motionRuntime.d.ts +46 -0
- package/dist/core/avatar/motionRuntime.js +84 -0
- package/dist/core/avatar/schema.d.ts +78 -0
- package/dist/core/avatar/schema.js +134 -0
- package/dist/core/avatar/visemes.d.ts +47 -1
- package/dist/core/avatar/visemes.js +114 -1
- package/dist/editor/AvatarCanvas.js +93 -3
- package/dist/editor/AvatarEditor.native.js +19 -9
- package/dist/editor/AvatarModel.js +2 -2
- package/dist/editor/FaceSqueezeEditor.d.ts +3 -1
- package/dist/editor/FaceSqueezeEditor.js +195 -121
- package/dist/editor/FaceSqueezeEditor.web.d.ts +3 -1
- package/dist/editor/FaceSqueezeEditor.web.js +32 -30
- package/dist/editor/RigidAccessory.js +18 -4
- package/dist/editor/SkinnedClothing.js +19 -9
- package/dist/editor/boneLockedDrag.d.ts +11 -0
- package/dist/editor/boneLockedDrag.js +68 -0
- package/dist/editor/boneSnap.js +22 -12
- package/dist/editor/boneSnap.web.d.ts +27 -0
- package/dist/editor/boneSnap.web.js +99 -0
- package/dist/editor/index.web.d.ts +10 -0
- package/dist/editor/index.web.js +26 -0
- package/dist/editor/sounds/haha.wav +0 -0
- package/dist/editor/sounds/owie.wav +0 -0
- package/dist/editor/sounds/stop.wav +0 -0
- package/dist/editor/studioTheme.d.ts +14 -14
- package/dist/editor/studioTheme.js +19 -16
- package/dist/editor/types.d.ts +1 -0
- package/dist/html/accessories.d.ts +7 -0
- package/dist/html/accessories.js +149 -0
- package/dist/html/motion.d.ts +1 -0
- package/dist/html/motion.js +189 -0
- package/dist/html/visemes.d.ts +7 -0
- package/dist/html/visemes.js +348 -0
- package/dist/html.d.ts +1 -1
- package/dist/html.js +56 -734
- package/dist/index.d.ts +19 -1
- package/dist/index.js +44 -5
- package/dist/index.web.d.ts +18 -1
- package/dist/index.web.js +36 -3
- package/dist/platform/api/types.d.ts +10 -0
- package/dist/platform/api/types.js +2 -0
- package/dist/platform/marketplace/types.d.ts +32 -0
- package/dist/platform/marketplace/types.js +2 -0
- package/dist/platform/sdk/unity.d.ts +27 -0
- package/dist/platform/sdk/unity.js +2 -0
- package/dist/platform/sdk/unreal.d.ts +23 -0
- package/dist/platform/sdk/unreal.js +2 -0
- package/dist/platform/sdk/web.d.ts +16 -0
- package/dist/platform/sdk/web.js +2 -0
- package/dist/sketchfab/api.js +5 -5
- package/dist/sketchfab/glbInspect.d.ts +22 -0
- package/dist/sketchfab/glbInspect.js +58 -0
- package/dist/sketchfab/index.d.ts +3 -0
- package/dist/sketchfab/index.js +8 -1
- package/dist/sketchfab/inspectRemote.d.ts +13 -0
- package/dist/sketchfab/inspectRemote.js +77 -0
- package/dist/sketchfab/types.d.ts +10 -0
- package/dist/sketchfab/useSketchfabSearch.js +1 -2
- package/dist/studio/AccessoryBrowserScreen.d.ts +6 -0
- package/dist/studio/AccessoryBrowserScreen.js +626 -0
- package/dist/studio/AccessoryPanel.d.ts +10 -0
- package/dist/studio/AccessoryPanel.js +396 -0
- package/dist/studio/AppearancePanel.d.ts +9 -0
- package/dist/studio/AppearancePanel.js +77 -0
- package/dist/studio/AvatarCreatorScreen.d.ts +5 -0
- package/dist/studio/AvatarCreatorScreen.js +806 -0
- package/dist/studio/AvatarEditorScreen.d.ts +14 -0
- package/dist/studio/AvatarEditorScreen.js +510 -0
- package/dist/studio/AvatarGrid.d.ts +23 -0
- package/dist/studio/AvatarGrid.js +257 -0
- package/dist/studio/ColorSwatch.d.ts +8 -0
- package/dist/studio/ColorSwatch.js +100 -0
- package/dist/studio/CreateVoiceProfileSheet.d.ts +8 -0
- package/dist/studio/CreateVoiceProfileSheet.js +242 -0
- package/dist/studio/DetailsPanel.d.ts +15 -0
- package/dist/studio/DetailsPanel.js +239 -0
- package/dist/studio/FilamentEditor.d.ts +2 -0
- package/dist/studio/FilamentEditor.js +6 -0
- package/dist/studio/PrecisionPanel.d.ts +2 -0
- package/dist/studio/PrecisionPanel.js +7 -0
- package/dist/studio/PublicGalleryScreen.d.ts +5 -0
- package/dist/studio/PublicGalleryScreen.js +358 -0
- package/dist/studio/SketchfabModelCard.d.ts +20 -0
- package/dist/studio/SketchfabModelCard.js +104 -0
- package/dist/studio/StudioBrowseHeader.d.ts +9 -0
- package/dist/studio/StudioBrowseHeader.js +28 -0
- package/dist/studio/StudioEmptyState.d.ts +8 -0
- package/dist/studio/StudioEmptyState.js +29 -0
- package/dist/studio/StudioFloatingAction.d.ts +13 -0
- package/dist/studio/StudioFloatingAction.js +42 -0
- package/dist/studio/StudioSectionHeader.d.ts +7 -0
- package/dist/studio/StudioSectionHeader.js +27 -0
- package/dist/studio/StudioSurfaceCard.d.ts +8 -0
- package/dist/studio/StudioSurfaceCard.js +20 -0
- package/dist/studio/VoicePanel.d.ts +15 -0
- package/dist/studio/VoicePanel.js +305 -0
- package/dist/studio/constants.d.ts +3 -0
- package/dist/studio/constants.js +6 -0
- package/dist/studio/index.d.ts +29 -0
- package/dist/studio/index.js +54 -0
- package/dist/studio/useSketchfabCapabilities.d.ts +31 -0
- package/dist/studio/useSketchfabCapabilities.js +82 -0
- package/dist/tts/useDirectVisemeStream.d.ts +2 -6
- package/dist/tts/useDirectVisemeStream.js +16 -12
- package/dist/tts/useMotionMarkers.d.ts +0 -1
- package/dist/tts/useMotionMarkers.js +1 -2
- package/dist/utils/avatarUtils.js +94 -8
- package/dist/utils/faceLandmarkerToShapeWeights.js +21 -14
- package/dist/voice/convertToWav.js +1 -2
- package/dist/voice/index.d.ts +3 -0
- package/dist/voice/index.js +6 -1
- package/dist/voice/useAudioPlayer.js +18 -6
- package/dist/voice/useAudioRecording.js +1 -2
- package/dist/voice/useFaceControls.d.ts +14 -0
- package/dist/voice/useFaceControls.js +81 -0
- package/dist/voice/useVoicePreview.d.ts +7 -0
- package/dist/voice/useVoicePreview.js +83 -0
- package/dist/wardrobe/index.d.ts +3 -0
- package/dist/wardrobe/index.js +8 -1
- package/dist/wardrobe/useAccessoryGestures.d.ts +20 -0
- package/dist/wardrobe/useAccessoryGestures.js +94 -0
- package/dist/wardrobe/useAvatarWardrobeHydration.js +9 -4
- package/dist/wardrobe/useStudioAvatar.d.ts +29 -0
- package/dist/wardrobe/useStudioAvatar.js +186 -0
- package/dist/wardrobe/wardrobeStore.d.ts +2 -0
- package/dist/wardrobe/wardrobeStore.js +12 -2
- package/dist/wgpu/R3FWebGpuCanvas.d.ts +15 -0
- package/dist/wgpu/R3FWebGpuCanvas.js +176 -0
- package/dist/wgpu/WgpuAvatar.d.ts +26 -2
- package/dist/wgpu/WgpuAvatar.js +313 -46
- package/dist/wgpu/accessoryDefaults.d.ts +12 -0
- package/dist/wgpu/accessoryDefaults.js +19 -0
- package/dist/wgpu/blobShim.d.ts +2 -0
- package/dist/wgpu/blobShim.js +191 -0
- package/dist/wgpu/index.d.ts +1 -0
- package/dist/wgpu/index.js +4 -1
- package/dist/wgpu/loadGLTFFromUri.d.ts +2 -0
- package/dist/wgpu/loadGLTFFromUri.js +75 -0
- package/dist/wgpu/morphTables.js +21 -10
- package/dist/wgpu/motionState.d.ts +20 -0
- package/dist/wgpu/motionState.js +31 -0
- package/dist/wgpu/patchThreeForRN.d.ts +28 -0
- package/dist/wgpu/patchThreeForRN.js +292 -0
- package/dist/wgpu/scenePlacement.d.ts +5 -0
- package/dist/wgpu/scenePlacement.js +50 -0
- package/dist/wgpu/useAuthedModelUri.js +22 -11
- package/dist/wgpu/useNativeGLTF.d.ts +7 -0
- package/dist/wgpu/useNativeGLTF.js +36 -0
- package/package.json +102 -32
|
@@ -0,0 +1,396 @@
|
|
|
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.default = AccessoryPanel;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const vector_icons_1 = require("@expo/vector-icons");
|
|
39
|
+
const Haptics = __importStar(require("expo-haptics"));
|
|
40
|
+
const moti_1 = require("moti");
|
|
41
|
+
const react_1 = require("react");
|
|
42
|
+
const react_native_1 = require("react-native");
|
|
43
|
+
const react_native_reanimated_1 = __importStar(require("react-native-reanimated"));
|
|
44
|
+
const api_1 = require("../api");
|
|
45
|
+
const wardrobe_1 = require("../wardrobe");
|
|
46
|
+
const editor_1 = require("../editor");
|
|
47
|
+
const accessoryDefaults_1 = require("../wgpu/accessoryDefaults");
|
|
48
|
+
const COLORS = {
|
|
49
|
+
bg: editor_1.studioTheme.colors.background,
|
|
50
|
+
surface: editor_1.studioTheme.colors.surface,
|
|
51
|
+
card: editor_1.studioTheme.colors.surfaceRaised,
|
|
52
|
+
border: editor_1.studioTheme.colors.border,
|
|
53
|
+
accent: editor_1.studioTheme.colors.accent,
|
|
54
|
+
textPrimary: editor_1.studioTheme.colors.textPrimary,
|
|
55
|
+
textSecondary: editor_1.studioTheme.colors.textSecondary,
|
|
56
|
+
error: editor_1.studioTheme.colors.danger,
|
|
57
|
+
};
|
|
58
|
+
function AccessoryPanel({ avatarId, onPositionAsset, onBrowseAccessories, avatarRef }) {
|
|
59
|
+
const [assets, setAssets] = (0, react_1.useState)([]);
|
|
60
|
+
const [isLoading, setIsLoading] = (0, react_1.useState)(true);
|
|
61
|
+
const [error, setError] = (0, react_1.useState)(null);
|
|
62
|
+
const [activeCategory, setActiveCategory] = (0, react_1.useState)(null);
|
|
63
|
+
const [placingIds, setPlacingIds] = (0, react_1.useState)(new Set());
|
|
64
|
+
const equipped = (0, wardrobe_1.useWardrobeStore)((s) => s.equipped);
|
|
65
|
+
const placements = (0, wardrobe_1.useWardrobeStore)((s) => s.placements);
|
|
66
|
+
const equip = (0, wardrobe_1.useWardrobeStore)((s) => s.equip);
|
|
67
|
+
const unequip = (0, wardrobe_1.useWardrobeStore)((s) => s.unequip);
|
|
68
|
+
const setPlacement = (0, wardrobe_1.useWardrobeStore)((s) => s.setPlacement);
|
|
69
|
+
const activeAssetId = (0, wardrobe_1.useWardrobeStore)((s) => s.activeAssetId);
|
|
70
|
+
// Breathing border opacity
|
|
71
|
+
const borderOpacity = (0, react_native_reanimated_1.useSharedValue)(0.5);
|
|
72
|
+
(0, react_1.useEffect)(() => {
|
|
73
|
+
borderOpacity.value = (0, react_native_reanimated_1.withRepeat)((0, react_native_reanimated_1.withSequence)((0, react_native_reanimated_1.withTiming)(1, { duration: 1000 }), (0, react_native_reanimated_1.withTiming)(0.4, { duration: 1000 })), -1, true);
|
|
74
|
+
}, [borderOpacity]);
|
|
75
|
+
const activeBorderStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => ({
|
|
76
|
+
borderColor: `rgba(255, 122, 89, ${borderOpacity.value})`,
|
|
77
|
+
}));
|
|
78
|
+
(0, react_1.useEffect)(() => {
|
|
79
|
+
void fetchAssets();
|
|
80
|
+
}, []);
|
|
81
|
+
const fetchAssets = async () => {
|
|
82
|
+
try {
|
|
83
|
+
setIsLoading(true);
|
|
84
|
+
setError(null);
|
|
85
|
+
const data = await (0, api_1.listAssets)();
|
|
86
|
+
setAssets(data || []);
|
|
87
|
+
}
|
|
88
|
+
catch (err) {
|
|
89
|
+
setError(err instanceof Error ? err.message : 'Failed to load assets');
|
|
90
|
+
}
|
|
91
|
+
finally {
|
|
92
|
+
setIsLoading(false);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
const categories = Array.from(new Set(assets.map((a) => a.category))).sort();
|
|
96
|
+
const filteredAssets = activeCategory
|
|
97
|
+
? assets.filter((a) => a.category === activeCategory)
|
|
98
|
+
: assets;
|
|
99
|
+
const toggleEquip = (asset) => {
|
|
100
|
+
void Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
|
|
101
|
+
const isEquipped = equipped[asset.slot]?.id === asset.id;
|
|
102
|
+
if (isEquipped) {
|
|
103
|
+
unequip(asset.slot);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
equip(asset.slot, asset);
|
|
107
|
+
// Apply snap default if no placement has been saved yet
|
|
108
|
+
if (!setPlacement || placements[asset.id])
|
|
109
|
+
return;
|
|
110
|
+
const snap = (0, accessoryDefaults_1.snapDefaultForCategory)(asset.category);
|
|
111
|
+
if (snap) {
|
|
112
|
+
setPlacement(asset.id, snap);
|
|
113
|
+
// Blink reaction — avatar acknowledges the item snapping on
|
|
114
|
+
avatarRef?.current?.triggerBlink();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
const handleAutoPlace = async (asset) => {
|
|
119
|
+
void Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium);
|
|
120
|
+
try {
|
|
121
|
+
setPlacingIds((prev) => new Set(prev).add(asset.id));
|
|
122
|
+
const suggestion = await (0, api_1.suggestPlacement)(asset.id, avatarId);
|
|
123
|
+
setPlacement(asset.id, {
|
|
124
|
+
bone: suggestion.bone,
|
|
125
|
+
position: suggestion.position,
|
|
126
|
+
rotation: suggestion.rotation,
|
|
127
|
+
scale: 1,
|
|
128
|
+
});
|
|
129
|
+
// Ensure it is equipped
|
|
130
|
+
if (equipped[asset.slot]?.id !== asset.id) {
|
|
131
|
+
equip(asset.slot, asset);
|
|
132
|
+
}
|
|
133
|
+
void Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success);
|
|
134
|
+
}
|
|
135
|
+
catch (err) {
|
|
136
|
+
console.error('Auto-place failed', err);
|
|
137
|
+
void Haptics.notificationAsync(Haptics.NotificationFeedbackType.Error);
|
|
138
|
+
}
|
|
139
|
+
finally {
|
|
140
|
+
setPlacingIds((prev) => {
|
|
141
|
+
const next = new Set(prev);
|
|
142
|
+
next.delete(asset.id);
|
|
143
|
+
return next;
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
const handlePosition = (asset) => {
|
|
148
|
+
void Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
|
|
149
|
+
// Ensure it's equipped before entering position mode
|
|
150
|
+
if (equipped[asset.slot]?.id !== asset.id) {
|
|
151
|
+
equip(asset.slot, asset);
|
|
152
|
+
}
|
|
153
|
+
onPositionAsset(asset.id);
|
|
154
|
+
};
|
|
155
|
+
const handleDeleteAsset = (asset) => {
|
|
156
|
+
react_native_1.Alert.alert("Delete Accessory", `Are you sure you want to delete "${asset.name}"? This action cannot be undone.`, [
|
|
157
|
+
{ text: "Cancel", style: "cancel" },
|
|
158
|
+
{
|
|
159
|
+
text: "Delete",
|
|
160
|
+
style: "destructive",
|
|
161
|
+
onPress: () => {
|
|
162
|
+
void (async () => {
|
|
163
|
+
try {
|
|
164
|
+
setIsLoading(true);
|
|
165
|
+
await (0, api_1.deleteAsset)(asset.id);
|
|
166
|
+
void Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success);
|
|
167
|
+
// Un-equip if currently equipped
|
|
168
|
+
if (equipped[asset.slot]?.id === asset.id) {
|
|
169
|
+
unequip(asset.slot);
|
|
170
|
+
}
|
|
171
|
+
setAssets((prev) => prev.filter(a => a.id !== asset.id));
|
|
172
|
+
}
|
|
173
|
+
catch (err) {
|
|
174
|
+
void Haptics.notificationAsync(Haptics.NotificationFeedbackType.Error);
|
|
175
|
+
react_native_1.Alert.alert("Error", err instanceof Error ? err.message : "Failed to delete accessory");
|
|
176
|
+
}
|
|
177
|
+
finally {
|
|
178
|
+
setIsLoading(false);
|
|
179
|
+
}
|
|
180
|
+
})();
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
]);
|
|
184
|
+
};
|
|
185
|
+
if (isLoading) {
|
|
186
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.centerContainer, children: [(0, jsx_runtime_1.jsx)(react_native_1.ActivityIndicator, { size: "large", color: COLORS.accent }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.loadingText, children: "Loading wardrobe..." })] }));
|
|
187
|
+
}
|
|
188
|
+
if (error) {
|
|
189
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.centerContainer, children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.errorText, children: error }), (0, jsx_runtime_1.jsx)(react_native_1.Pressable, { style: styles.retryButton, onPress: fetchAssets, children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.retryButtonText, children: "Retry" }) })] }));
|
|
190
|
+
}
|
|
191
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.container, children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.sectionTitle, children: "YOUR WARDROBE" }), categories.length > 0 && ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.categoriesWrapper, children: (0, jsx_runtime_1.jsxs)(react_native_1.ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, contentContainerStyle: styles.categoriesContent, children: [(0, jsx_runtime_1.jsx)(react_native_1.Pressable, { onPress: () => {
|
|
192
|
+
void Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
|
|
193
|
+
setActiveCategory(null);
|
|
194
|
+
}, style: [styles.categoryChip, !activeCategory && styles.categoryChipActive], children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [styles.categoryText, !activeCategory && styles.categoryTextActive], children: "All" }) }), categories.map((cat) => ((0, jsx_runtime_1.jsx)(react_native_1.Pressable, { onPress: () => {
|
|
195
|
+
void Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
|
|
196
|
+
setActiveCategory(cat);
|
|
197
|
+
}, style: [styles.categoryChip, activeCategory === cat && styles.categoryChipActive], children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [styles.categoryText, activeCategory === cat && styles.categoryTextActive], children: cat.toUpperCase() }) }, cat)))] }) })), (0, jsx_runtime_1.jsxs)(react_native_1.Pressable, { style: styles.browseButton, onPress: () => onBrowseAccessories?.(), children: [(0, jsx_runtime_1.jsx)(vector_icons_1.Ionicons, { name: "search", size: 16, color: COLORS.accent, style: styles.actionIcon }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.browseButtonText, children: "Browse Sketchfab" })] }), assets.length === 0 ? ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.emptyStateText, children: "You don't have any accessories yet. Upload some in the studio!" })) : ((0, jsx_runtime_1.jsx)(react_native_1.FlatList, { data: filteredAssets, keyExtractor: (item) => item.id, contentContainerStyle: styles.listContent, showsVerticalScrollIndicator: false, renderItem: ({ item, index }) => {
|
|
198
|
+
const isEquipped = equipped[item.slot]?.id === item.id;
|
|
199
|
+
const isPlacing = placingIds.has(item.id);
|
|
200
|
+
return ((0, jsx_runtime_1.jsx)(moti_1.MotiView, { from: { opacity: 0, translateY: 20 }, animate: { opacity: 1, translateY: 0 }, transition: { type: 'spring', damping: 16, stiffness: 180, delay: index * 60 }, children: (0, jsx_runtime_1.jsxs)(react_native_reanimated_1.default.View, { style: [
|
|
201
|
+
styles.card,
|
|
202
|
+
isEquipped && styles.cardActive,
|
|
203
|
+
item.id === activeAssetId && activeBorderStyle,
|
|
204
|
+
], children: [(0, jsx_runtime_1.jsxs)(react_native_1.Pressable, { style: styles.cardHeader, onPress: () => toggleEquip(item), children: [(0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.cardInfo, children: [(0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.cardTitleRow, children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.name, numberOfLines: 1, children: item.name }), (0, jsx_runtime_1.jsx)(react_native_1.Pressable, { style: styles.deleteButton, onPress: (e) => {
|
|
205
|
+
e.stopPropagation();
|
|
206
|
+
handleDeleteAsset(item);
|
|
207
|
+
}, hitSlop: 10, children: (0, jsx_runtime_1.jsx)(vector_icons_1.Ionicons, { name: "trash", size: 16, color: COLORS.error }) })] }), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.badge, children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.badgeText, children: item.category.toUpperCase() }) })] }), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.equipToggle, children: (0, jsx_runtime_1.jsx)(vector_icons_1.Ionicons, { name: isEquipped ? 'checkmark-circle' : 'ellipse-outline', size: 24, color: isEquipped ? COLORS.accent : COLORS.border }) })] }), isEquipped && ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.actionsRow, children: [(0, jsx_runtime_1.jsxs)(react_native_1.Pressable, { style: styles.actionButton, onPress: () => handlePosition(item), children: [(0, jsx_runtime_1.jsx)(vector_icons_1.Ionicons, { name: "move", size: 16, color: COLORS.textPrimary, style: styles.actionIcon }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.actionText, children: "Position" })] }), (0, jsx_runtime_1.jsx)(react_native_1.Pressable, { style: [styles.actionButton, styles.autoPlaceButton], onPress: () => handleAutoPlace(item), disabled: isPlacing, children: isPlacing ? ((0, jsx_runtime_1.jsx)(react_native_1.ActivityIndicator, { size: "small", color: COLORS.accent })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(vector_icons_1.Ionicons, { name: "color-wand", size: 16, color: COLORS.accent, style: styles.actionIcon }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.autoPlaceText, children: "Auto-place" })] })) })] }))] }) }));
|
|
208
|
+
} }))] }));
|
|
209
|
+
}
|
|
210
|
+
const styles = react_native_1.StyleSheet.create({
|
|
211
|
+
container: {
|
|
212
|
+
flex: 1,
|
|
213
|
+
paddingVertical: 16,
|
|
214
|
+
},
|
|
215
|
+
centerContainer: {
|
|
216
|
+
flex: 1,
|
|
217
|
+
justifyContent: 'center',
|
|
218
|
+
alignItems: 'center',
|
|
219
|
+
padding: 24,
|
|
220
|
+
},
|
|
221
|
+
sectionTitle: {
|
|
222
|
+
color: COLORS.textSecondary,
|
|
223
|
+
fontSize: 12,
|
|
224
|
+
fontWeight: '700',
|
|
225
|
+
letterSpacing: 1.2,
|
|
226
|
+
textTransform: 'uppercase',
|
|
227
|
+
paddingHorizontal: 16,
|
|
228
|
+
marginBottom: 12,
|
|
229
|
+
},
|
|
230
|
+
categoriesWrapper: {
|
|
231
|
+
marginBottom: 16,
|
|
232
|
+
},
|
|
233
|
+
categoriesContent: {
|
|
234
|
+
paddingHorizontal: 16,
|
|
235
|
+
gap: 8,
|
|
236
|
+
},
|
|
237
|
+
categoryChip: {
|
|
238
|
+
backgroundColor: COLORS.card,
|
|
239
|
+
paddingHorizontal: 12,
|
|
240
|
+
paddingVertical: 6,
|
|
241
|
+
borderRadius: 16,
|
|
242
|
+
borderWidth: 1,
|
|
243
|
+
borderColor: COLORS.border,
|
|
244
|
+
},
|
|
245
|
+
categoryChipActive: {
|
|
246
|
+
backgroundColor: editor_1.studioTheme.colors.accentMuted,
|
|
247
|
+
borderColor: COLORS.accent,
|
|
248
|
+
},
|
|
249
|
+
categoryText: {
|
|
250
|
+
color: COLORS.textSecondary,
|
|
251
|
+
fontSize: 12,
|
|
252
|
+
fontWeight: '600',
|
|
253
|
+
},
|
|
254
|
+
categoryTextActive: {
|
|
255
|
+
color: COLORS.accent,
|
|
256
|
+
},
|
|
257
|
+
emptyStateText: {
|
|
258
|
+
paddingHorizontal: 16,
|
|
259
|
+
paddingTop: 8,
|
|
260
|
+
color: COLORS.textSecondary,
|
|
261
|
+
fontSize: 14,
|
|
262
|
+
fontStyle: 'italic',
|
|
263
|
+
},
|
|
264
|
+
listContent: {
|
|
265
|
+
paddingHorizontal: 16,
|
|
266
|
+
paddingBottom: 24,
|
|
267
|
+
gap: 12,
|
|
268
|
+
},
|
|
269
|
+
card: {
|
|
270
|
+
backgroundColor: COLORS.card,
|
|
271
|
+
borderRadius: 18,
|
|
272
|
+
borderWidth: 1,
|
|
273
|
+
borderColor: COLORS.border,
|
|
274
|
+
padding: 16,
|
|
275
|
+
overflow: 'hidden',
|
|
276
|
+
},
|
|
277
|
+
cardActive: {
|
|
278
|
+
borderColor: COLORS.accent,
|
|
279
|
+
backgroundColor: editor_1.studioTheme.colors.accentMuted,
|
|
280
|
+
},
|
|
281
|
+
cardHeader: {
|
|
282
|
+
flexDirection: 'row',
|
|
283
|
+
justifyContent: 'space-between',
|
|
284
|
+
alignItems: 'center',
|
|
285
|
+
},
|
|
286
|
+
cardInfo: {
|
|
287
|
+
flex: 1,
|
|
288
|
+
marginRight: 16,
|
|
289
|
+
},
|
|
290
|
+
cardTitleRow: {
|
|
291
|
+
flexDirection: 'row',
|
|
292
|
+
alignItems: 'center',
|
|
293
|
+
justifyContent: 'space-between',
|
|
294
|
+
marginBottom: 6,
|
|
295
|
+
},
|
|
296
|
+
name: {
|
|
297
|
+
color: COLORS.textPrimary,
|
|
298
|
+
fontSize: 16,
|
|
299
|
+
fontWeight: '600',
|
|
300
|
+
flex: 1,
|
|
301
|
+
marginRight: 8,
|
|
302
|
+
},
|
|
303
|
+
deleteButton: {
|
|
304
|
+
padding: 4,
|
|
305
|
+
},
|
|
306
|
+
badge: {
|
|
307
|
+
alignSelf: 'flex-start',
|
|
308
|
+
backgroundColor: COLORS.border,
|
|
309
|
+
paddingHorizontal: 8,
|
|
310
|
+
paddingVertical: 4,
|
|
311
|
+
borderRadius: 6,
|
|
312
|
+
},
|
|
313
|
+
badgeText: {
|
|
314
|
+
color: COLORS.textSecondary,
|
|
315
|
+
fontSize: 10,
|
|
316
|
+
fontWeight: '700',
|
|
317
|
+
letterSpacing: 0.5,
|
|
318
|
+
},
|
|
319
|
+
equipToggle: {
|
|
320
|
+
padding: 4,
|
|
321
|
+
},
|
|
322
|
+
actionsRow: {
|
|
323
|
+
flexDirection: 'row',
|
|
324
|
+
marginTop: 16,
|
|
325
|
+
gap: 8,
|
|
326
|
+
},
|
|
327
|
+
actionButton: {
|
|
328
|
+
flex: 1,
|
|
329
|
+
flexDirection: 'row',
|
|
330
|
+
alignItems: 'center',
|
|
331
|
+
justifyContent: 'center',
|
|
332
|
+
backgroundColor: COLORS.border,
|
|
333
|
+
paddingVertical: 10,
|
|
334
|
+
borderRadius: 8,
|
|
335
|
+
},
|
|
336
|
+
autoPlaceButton: {
|
|
337
|
+
backgroundColor: editor_1.studioTheme.colors.accentMuted,
|
|
338
|
+
borderWidth: 1,
|
|
339
|
+
borderColor: `${editor_1.studioTheme.colors.accent}55`,
|
|
340
|
+
},
|
|
341
|
+
actionIcon: {
|
|
342
|
+
marginRight: 6,
|
|
343
|
+
},
|
|
344
|
+
actionText: {
|
|
345
|
+
color: COLORS.textPrimary,
|
|
346
|
+
fontSize: 14,
|
|
347
|
+
fontWeight: '600',
|
|
348
|
+
},
|
|
349
|
+
autoPlaceText: {
|
|
350
|
+
color: COLORS.accent,
|
|
351
|
+
fontSize: 14,
|
|
352
|
+
fontWeight: '600',
|
|
353
|
+
},
|
|
354
|
+
loadingText: {
|
|
355
|
+
marginTop: 16,
|
|
356
|
+
color: COLORS.textSecondary,
|
|
357
|
+
fontSize: 15,
|
|
358
|
+
fontWeight: '500',
|
|
359
|
+
letterSpacing: 0.5,
|
|
360
|
+
},
|
|
361
|
+
errorText: {
|
|
362
|
+
color: COLORS.error,
|
|
363
|
+
fontSize: 15,
|
|
364
|
+
textAlign: 'center',
|
|
365
|
+
marginBottom: 20,
|
|
366
|
+
lineHeight: 22,
|
|
367
|
+
},
|
|
368
|
+
retryButton: {
|
|
369
|
+
backgroundColor: COLORS.border,
|
|
370
|
+
paddingHorizontal: 24,
|
|
371
|
+
paddingVertical: 12,
|
|
372
|
+
borderRadius: 999,
|
|
373
|
+
},
|
|
374
|
+
retryButtonText: {
|
|
375
|
+
color: COLORS.textPrimary,
|
|
376
|
+
fontWeight: '600',
|
|
377
|
+
fontSize: 14,
|
|
378
|
+
},
|
|
379
|
+
browseButton: {
|
|
380
|
+
flexDirection: 'row',
|
|
381
|
+
alignItems: 'center',
|
|
382
|
+
justifyContent: 'center',
|
|
383
|
+
marginHorizontal: 16,
|
|
384
|
+
marginBottom: 16,
|
|
385
|
+
paddingVertical: 12,
|
|
386
|
+
borderRadius: 18,
|
|
387
|
+
backgroundColor: editor_1.studioTheme.colors.accentMuted,
|
|
388
|
+
borderWidth: 1,
|
|
389
|
+
borderColor: `${editor_1.studioTheme.colors.accent}55`,
|
|
390
|
+
},
|
|
391
|
+
browseButtonText: {
|
|
392
|
+
color: COLORS.accent,
|
|
393
|
+
fontSize: 15,
|
|
394
|
+
fontWeight: '600',
|
|
395
|
+
},
|
|
396
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface AppearancePanelProps {
|
|
2
|
+
hairColor: string;
|
|
3
|
+
setHairColor: (color: string) => void;
|
|
4
|
+
skinColor: string;
|
|
5
|
+
setSkinColor: (color: string) => void;
|
|
6
|
+
eyeColor: string;
|
|
7
|
+
setEyeColor: (color: string) => void;
|
|
8
|
+
}
|
|
9
|
+
export default function AppearancePanel({ hairColor, setHairColor, skinColor, setSkinColor, eyeColor, setEyeColor, }: AppearancePanelProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = AppearancePanel;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_native_1 = require("react-native");
|
|
9
|
+
const ColorSwatch_1 = __importDefault(require("./ColorSwatch"));
|
|
10
|
+
const StudioSurfaceCard_1 = require("./StudioSurfaceCard");
|
|
11
|
+
const editor_1 = require("../editor");
|
|
12
|
+
const HAIR_PALETTE = [
|
|
13
|
+
{ name: 'Raven', hex: '#090806' },
|
|
14
|
+
{ name: 'Chestnut', hex: '#2C1B18' },
|
|
15
|
+
{ name: 'Auburn', hex: '#4A2711' },
|
|
16
|
+
{ name: 'Copper', hex: '#8D2E14' },
|
|
17
|
+
{ name: 'Strawberry', hex: '#A33318' },
|
|
18
|
+
{ name: 'Honey', hex: '#B36D4B' },
|
|
19
|
+
{ name: 'Blonde', hex: '#DCB378' },
|
|
20
|
+
{ name: 'Platinum', hex: '#F0E2C8' },
|
|
21
|
+
{ name: 'Silver', hex: '#E5E6E6' },
|
|
22
|
+
];
|
|
23
|
+
const EYE_PALETTE = [
|
|
24
|
+
{ name: 'Onyx', hex: '#1A1A1A' },
|
|
25
|
+
{ name: 'Espresso', hex: '#3B2715' },
|
|
26
|
+
{ name: 'Amber', hex: '#5A3821' },
|
|
27
|
+
{ name: 'Hazel', hex: '#8A6A40' },
|
|
28
|
+
{ name: 'Emerald', hex: '#766B42' },
|
|
29
|
+
{ name: 'Olive', hex: '#526943' },
|
|
30
|
+
{ name: 'Forest', hex: '#3B593C' },
|
|
31
|
+
{ name: 'Ocean', hex: '#2E536F' },
|
|
32
|
+
{ name: 'Sky', hex: '#5586B2' },
|
|
33
|
+
{ name: 'Ice', hex: '#8BB2D2' },
|
|
34
|
+
{ name: 'Violet', hex: '#5D4E8C' },
|
|
35
|
+
];
|
|
36
|
+
const SKIN_PALETTE = [
|
|
37
|
+
{ name: 'Espresso', hex: '#3A2318' },
|
|
38
|
+
{ name: 'Mocha', hex: '#4A2E20' },
|
|
39
|
+
{ name: 'Cocoa', hex: '#5C3A21' },
|
|
40
|
+
{ name: 'Chestnut', hex: '#7A4B3A' },
|
|
41
|
+
{ name: 'Bronze', hex: '#96684C' },
|
|
42
|
+
{ name: 'Caramel', hex: '#B48A66' },
|
|
43
|
+
{ name: 'Almond', hex: '#D2A884' },
|
|
44
|
+
{ name: 'Sand', hex: '#EAC099' },
|
|
45
|
+
{ name: 'Ivory', hex: '#F5D0B5' },
|
|
46
|
+
{ name: 'Porcelain', hex: '#FCE0C6' },
|
|
47
|
+
{ name: 'Pale', hex: '#FFF0E0' },
|
|
48
|
+
];
|
|
49
|
+
function ColorRow({ title, currentColor, onChangeColor, palette, }) {
|
|
50
|
+
const normalizedCurrent = currentColor.toUpperCase();
|
|
51
|
+
const isCustomColor = !palette.some((c) => c.hex.toUpperCase() === normalizedCurrent);
|
|
52
|
+
return ((0, jsx_runtime_1.jsxs)(StudioSurfaceCard_1.StudioSurfaceCard, { style: styles.section, children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.sectionTitle, children: title }), (0, jsx_runtime_1.jsxs)(react_native_1.ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, contentContainerStyle: styles.scrollContent, children: [isCustomColor && currentColor && ((0, jsx_runtime_1.jsx)(ColorSwatch_1.default, { color: currentColor, selected: true, onPress: () => onChangeColor(currentColor), label: "Custom" })), palette.map((item) => ((0, jsx_runtime_1.jsx)(ColorSwatch_1.default, { color: item.hex, selected: item.hex.toUpperCase() === normalizedCurrent, onPress: () => onChangeColor(item.hex), label: item.name }, item.hex)))] })] }));
|
|
53
|
+
}
|
|
54
|
+
function AppearancePanel({ hairColor, setHairColor, skinColor, setSkinColor, eyeColor, setEyeColor, }) {
|
|
55
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.container, children: [(0, jsx_runtime_1.jsx)(ColorRow, { title: "SKIN TONE", currentColor: skinColor, onChangeColor: setSkinColor, palette: SKIN_PALETTE }), (0, jsx_runtime_1.jsx)(ColorRow, { title: "HAIR COLOR", currentColor: hairColor, onChangeColor: setHairColor, palette: HAIR_PALETTE }), (0, jsx_runtime_1.jsx)(ColorRow, { title: "EYE COLOR", currentColor: eyeColor, onChangeColor: setEyeColor, palette: EYE_PALETTE })] }));
|
|
56
|
+
}
|
|
57
|
+
const styles = react_native_1.StyleSheet.create({
|
|
58
|
+
container: {
|
|
59
|
+
paddingVertical: 18,
|
|
60
|
+
paddingHorizontal: 16,
|
|
61
|
+
gap: 24,
|
|
62
|
+
},
|
|
63
|
+
section: {
|
|
64
|
+
gap: 14,
|
|
65
|
+
padding: 0,
|
|
66
|
+
},
|
|
67
|
+
sectionTitle: {
|
|
68
|
+
color: editor_1.studioTheme.colors.textSecondary,
|
|
69
|
+
fontSize: 12,
|
|
70
|
+
fontWeight: '700',
|
|
71
|
+
letterSpacing: 1.2,
|
|
72
|
+
textTransform: 'uppercase',
|
|
73
|
+
},
|
|
74
|
+
scrollContent: {
|
|
75
|
+
gap: 12,
|
|
76
|
+
},
|
|
77
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export interface AvatarCreatorScreenProps {
|
|
2
|
+
sketchfabApiKey: string;
|
|
3
|
+
onAvatarCreated?: (avatarId: string) => void;
|
|
4
|
+
}
|
|
5
|
+
export declare function AvatarCreatorScreen({ sketchfabApiKey, onAvatarCreated, }: AvatarCreatorScreenProps): import("react/jsx-runtime").JSX.Element;
|