fix: TypeScript build errors in Docker
- useRef(null) initial values for Strict TS 6.0 - Removed deprecated transparent option in pixi v7 - Cast Live2DModel to any for addChild type compat - Cast coreModel for getTexture access - Fixed types/index.ts import path to scenes - Added vite-env.d.ts with CSS module declarations - Added null-coalesce for clearInterval calls
This commit is contained in:
@@ -13,7 +13,7 @@ export default function AnimatedAvatar({ isSpeaking, isListening, outfit, access
|
|||||||
const [wave, setWave] = useState(false);
|
const [wave, setWave] = useState(false);
|
||||||
const [lookX, setLookX] = useState(0);
|
const [lookX, setLookX] = useState(0);
|
||||||
const [lookY, setLookY] = useState(0);
|
const [lookY, setLookY] = useState(0);
|
||||||
const idleRef = useRef<ReturnType<typeof setInterval>>();
|
const idleRef = useRef<ReturnType<typeof setInterval> | null>(null);
|
||||||
|
|
||||||
// Blink cycle
|
// Blink cycle
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -31,7 +31,7 @@ export default function AnimatedAvatar({ isSpeaking, isListening, outfit, access
|
|||||||
setLookX(Math.sin(Date.now() / 3000) * 3);
|
setLookX(Math.sin(Date.now() / 3000) * 3);
|
||||||
setLookY(Math.sin(Date.now() / 4000) * 2);
|
setLookY(Math.sin(Date.now() / 4000) * 2);
|
||||||
}, 100);
|
}, 100);
|
||||||
return () => clearInterval(idleRef.current);
|
return () => clearInterval(idleRef.current ?? undefined);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// Wave gesture on toggle
|
// Wave gesture on toggle
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export default function KiraAvatar(props: Props) {
|
|||||||
const modelRef = useRef<any>(null);
|
const modelRef = useRef<any>(null);
|
||||||
const textureRef = useRef<any>(null);
|
const textureRef = useRef<any>(null);
|
||||||
const lipSyncRef = useRef<number>(0);
|
const lipSyncRef = useRef<number>(0);
|
||||||
const idleExprRef = useRef<ReturnType<typeof setInterval>>();
|
const idleExprRef = useRef<ReturnType<typeof setInterval> | null>(null);
|
||||||
const [live2dReady, setLive2dReady] = useState(false);
|
const [live2dReady, setLive2dReady] = useState(false);
|
||||||
const [loadError, setLoadError] = useState(false);
|
const [loadError, setLoadError] = useState(false);
|
||||||
const [currentExpression, setCurrentExpression] = useState<ExpressionName>('Normal');
|
const [currentExpression, setCurrentExpression] = useState<ExpressionName>('Normal');
|
||||||
@@ -56,7 +56,6 @@ export default function KiraAvatar(props: Props) {
|
|||||||
const app = new Application({
|
const app = new Application({
|
||||||
width: size,
|
width: size,
|
||||||
height: size * 1.25,
|
height: size * 1.25,
|
||||||
transparent: true,
|
|
||||||
antialias: true,
|
antialias: true,
|
||||||
resolution: Math.min(window.devicePixelRatio || 1, 2),
|
resolution: Math.min(window.devicePixelRatio || 1, 2),
|
||||||
backgroundAlpha: 0,
|
backgroundAlpha: 0,
|
||||||
@@ -80,13 +79,13 @@ export default function KiraAvatar(props: Props) {
|
|||||||
model.anchor.set(0.5, 0.5);
|
model.anchor.set(0.5, 0.5);
|
||||||
model.position.set(app.screen.width / 2, app.screen.height / 2 + 6);
|
model.position.set(app.screen.width / 2, app.screen.height / 2 + 6);
|
||||||
|
|
||||||
app.stage.addChild(model);
|
app.stage.addChild(model as any);
|
||||||
|
|
||||||
// Store reference to texture_02 for outfit swapping
|
// Store reference to texture_02 for outfit swapping
|
||||||
try {
|
try {
|
||||||
textureRef.current = {
|
textureRef.current = {
|
||||||
index: 2,
|
index: 2,
|
||||||
original: model.internalModel.coreModel.getTexture(2),
|
original: (model.internalModel.coreModel as any).getTexture(2),
|
||||||
};
|
};
|
||||||
} catch { /* ignore */ }
|
} catch { /* ignore */ }
|
||||||
|
|
||||||
@@ -113,7 +112,7 @@ export default function KiraAvatar(props: Props) {
|
|||||||
return () => {
|
return () => {
|
||||||
mounted = false;
|
mounted = false;
|
||||||
cancelAnimationFrame(lipSyncRef.current);
|
cancelAnimationFrame(lipSyncRef.current);
|
||||||
clearInterval(idleExprRef.current);
|
clearInterval(idleExprRef.current ?? undefined);
|
||||||
if (appRef.current) {
|
if (appRef.current) {
|
||||||
appRef.current.destroy(true, { children: true });
|
appRef.current.destroy(true, { children: true });
|
||||||
appRef.current = null;
|
appRef.current = null;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { SCENES, type Scene } from './scenes';
|
import { SCENES, type Scene } from '../components/scenes';
|
||||||
|
|
||||||
export interface KiraState {
|
export interface KiraState {
|
||||||
currentScene: Scene;
|
currentScene: Scene;
|
||||||
|
|||||||
Vendored
+11
@@ -0,0 +1,11 @@
|
|||||||
|
/// <reference types="vite/client" />
|
||||||
|
|
||||||
|
declare module '*.css' {
|
||||||
|
const content: Record<string, string>;
|
||||||
|
export default content;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module '*.module.css' {
|
||||||
|
const classes: { readonly [key: string]: string };
|
||||||
|
export default classes;
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"root":["./src/App.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/components/AnimatedAvatar.tsx","./src/components/BackgroundScene.tsx","./src/components/ChatBubble.tsx","./src/components/Clock.tsx","./src/components/KiraAvatar.tsx","./src/components/MusicPlayer.tsx","./src/components/Notes.tsx","./src/components/Particles.tsx","./src/components/PetZone.tsx","./src/components/Timer.tsx","./src/components/Toolbar.tsx","./src/components/Wardrobe.tsx","./src/components/WelcomeScreen.tsx","./src/components/scenes.ts","./src/hooks/useConversation.ts","./src/types/index.ts"],"version":"6.0.3"}
|
||||||
Reference in New Issue
Block a user