feat: soundboard, toast notifications, robust JSON parsing

Soundboard (Web Audio API):
- 8 ambient loops: rain, wind, fire, ocean, forest, tavern, thunder, cave
- 8 one-shot SFX: sword, bow, spell, door, coins, horn, dice, footsteps
- Brown noise generation for ambient textures
- Oscillator-based SFX with frequency sweeps
- Volume slider, active state indicators with pulsing dot
- Stop All button when ambients are playing
- Toast notifications on SFX trigger

Toast notification system:
- Zustand-based store with auto-dismiss (4s)
- 4 types: success, error, info, warning
- Slide-in animation from top-right
- Dismissible with × button
- Integrated into App shell

JSON parsing (all AI components):
- Shared lib/llm-parse.ts with extractJson, parseLlmJson, flattenValue, ensureArray
- Strips markdown code fences before parsing
- Handles nested objects where strings expected
- All 5 AI components use parseLlmJson instead of raw regex
- All prompts explicitly request raw JSON with no fences
- ItemForge shows raw response in <details> on parse failure

Full production build passing
This commit is contained in:
itsamejms
2026-06-28 23:08:15 +01:00
parent b23ab61841
commit a9cdd10806
7 changed files with 480 additions and 18 deletions
+33 -3
View File
@@ -13,7 +13,8 @@
"framer-motion": "^12",
"lucide-react": "^0.525",
"react": "^19.2.7",
"react-dom": "^19.2.7"
"react-dom": "^19.2.7",
"zustand": "^5.0.14"
},
"devDependencies": {
"@tailwindcss/vite": "^4",
@@ -1330,7 +1331,7 @@
"version": "19.2.17",
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.17.tgz",
"integrity": "sha512-MXfmqaVPEVgkBT/aY0aGCkRWWtByiYQXo3xdQ8r5RzuFrPiRn8Gar2tQdXSUQ2GKV3bkXckek89V8wQBY2Q/Aw==",
"dev": true,
"devOptional": true,
"license": "MIT",
"dependencies": {
"csstype": "^3.2.2"
@@ -1376,7 +1377,7 @@
"version": "3.2.3",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
"integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",
"dev": true,
"devOptional": true,
"license": "MIT"
},
"node_modules/detect-libc": {
@@ -2117,6 +2118,35 @@
"optional": true
}
}
},
"node_modules/zustand": {
"version": "5.0.14",
"resolved": "https://registry.npmjs.org/zustand/-/zustand-5.0.14.tgz",
"integrity": "sha512-/8tAspM5LMPr28b3fwLYrtdj77ECpfZviaP75CMTnwO8ISyaE4GDIG/9rDDYq/cH9D2Xw2A2RXglLInmVBQB/g==",
"license": "MIT",
"engines": {
"node": ">=12.20.0"
},
"peerDependencies": {
"@types/react": ">=18.0.0",
"immer": ">=9.0.6",
"react": ">=18.0.0",
"use-sync-external-store": ">=1.2.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"immer": {
"optional": true
},
"react": {
"optional": true
},
"use-sync-external-store": {
"optional": true
}
}
}
}
}