@ysolve/ocity-heritage-visualizer 1.0.0
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/LICENSE +21 -0
- package/README.md +308 -0
- package/dist/mespeak-core.js +140 -0
- package/dist/mespeak.js +167 -0
- package/dist/mespeak__standard_config.json +7 -0
- package/dist/ocity-heritage-visualizer.css +1 -0
- package/dist/ocity-heritage-visualizer.es.js +2455 -0
- package/dist/ocity-heritage-visualizer.es.js.map +1 -0
- package/dist/ocity-heritage-visualizer.umd.js +7 -0
- package/dist/ocity-heritage-visualizer.umd.js.map +1 -0
- package/dist/vite.svg +1 -0
- package/dist/voices/ca.json +6 -0
- package/dist/voices/cs.json +6 -0
- package/dist/voices/de.json +6 -0
- package/dist/voices/el.json +6 -0
- package/dist/voices/en/en-n.json +6 -0
- package/dist/voices/en/en-rp.json +6 -0
- package/dist/voices/en/en-sc.json +6 -0
- package/dist/voices/en/en-us.json +6 -0
- package/dist/voices/en/en-wm.json +6 -0
- package/dist/voices/en/en.json +6 -0
- package/dist/voices/eo.json +6 -0
- package/dist/voices/es-la.json +6 -0
- package/dist/voices/es.json +6 -0
- package/dist/voices/fi.json +6 -0
- package/dist/voices/fr.json +6 -0
- package/dist/voices/hu.json +6 -0
- package/dist/voices/it.json +6 -0
- package/dist/voices/kn.json +6 -0
- package/dist/voices/la.json +6 -0
- package/dist/voices/lv.json +6 -0
- package/dist/voices/nl.json +6 -0
- package/dist/voices/pl.json +6 -0
- package/dist/voices/pt-pt.json +6 -0
- package/dist/voices/pt.json +6 -0
- package/dist/voices/ro.json +6 -0
- package/dist/voices/sk.json +6 -0
- package/dist/voices/sv.json +6 -0
- package/dist/voices/tr.json +6 -0
- package/dist/voices/zh-yue.json +6 -0
- package/dist/voices/zh.json +6 -0
- package/package.json +86 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Ysolve
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
# O-CITY Heritage Visualizer
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
**Componente React para visualizar patrimonio cultural con texto a voz y avatares animados**
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@ysolve/ocity-heritage-visualizer)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
|
+
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
## 📖 Descripción
|
|
13
|
+
|
|
14
|
+
`ocity-heritage-visualizer` es un componente React que transforma la información de **patrimonio cultural** de la plataforma [O-CITY](https://o-city.org/) en una **experiencia audiovisual interactiva**.
|
|
15
|
+
|
|
16
|
+
En lugar de mostrar texto plano e imágenes, genera una **"simulación de video"** que incluye:
|
|
17
|
+
|
|
18
|
+
- 🎤 **Narración por voz** usando [ElevenLabs TTS](https://elevenlabs.io/)
|
|
19
|
+
- 🌍 **Traducción automática** con Google Translate
|
|
20
|
+
- 📝 **Subtítulos sincronizados**
|
|
21
|
+
- 🎭 **Avatar animado** (PNGTuber) que acompaña la narración
|
|
22
|
+
- ⏯️ **Controles de reproducción** completos (play, pause, stop)
|
|
23
|
+
- 🔄 **Navegación entre patrimonios** con autoavance opcional
|
|
24
|
+
|
|
25
|
+
## ✨ Características
|
|
26
|
+
|
|
27
|
+
- ✅ Soporte multiidioma (Español, Inglés, Francés)
|
|
28
|
+
- ✅ Reproducción de audio con Text-to-Speech
|
|
29
|
+
- ✅ Animación de avatares sincronizada con el audio
|
|
30
|
+
- ✅ Sistema de caché de audio para mejorar el rendimiento
|
|
31
|
+
- ✅ Completamente tipado con TypeScript
|
|
32
|
+
- ✅ Responsive y accesible
|
|
33
|
+
|
|
34
|
+
## 📦 Instalación
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install @ysolve/ocity-heritage-visualizer
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
O con yarn:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
yarn add @ysolve/ocity-heritage-visualizer
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
O con pnpm:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pnpm add @ysolve/ocity-heritage-visualizer
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## 🚀 Uso Básico
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
import { StoryVisualizer } from '@ysolve/ocity-heritage-visualizer';
|
|
56
|
+
import '@ysolve/ocity-heritage-visualizer/dist/style.css';
|
|
57
|
+
|
|
58
|
+
// Importa tus avatares
|
|
59
|
+
import avatarImage1 from './assets/avatar1.webp';
|
|
60
|
+
import avatarImage2 from './assets/avatar2.webp';
|
|
61
|
+
|
|
62
|
+
function App() {
|
|
63
|
+
const heritageItems = [
|
|
64
|
+
{
|
|
65
|
+
id: "1",
|
|
66
|
+
name: "Castillo de Buñol",
|
|
67
|
+
description: {
|
|
68
|
+
local: {
|
|
69
|
+
short: "Castillo medieval del siglo XI",
|
|
70
|
+
extended: "El castillo de Buñol es una fortaleza cristiana construida sobre un asentamiento islámico..."
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
imageUrl: "https://example.com/castle.jpg"
|
|
74
|
+
},
|
|
75
|
+
// Más patrimonios...
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<StoryVisualizer
|
|
80
|
+
heritageItems={heritageItems}
|
|
81
|
+
targetLanguage="es"
|
|
82
|
+
descriptionLength="extended"
|
|
83
|
+
autoAdvance={false}
|
|
84
|
+
voiceIds={["21m00Tcm4TlvDq8ikWAM"]} // IDs de voces de ElevenLabs
|
|
85
|
+
avatars={[avatarImage1, avatarImage2]}
|
|
86
|
+
/>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export default App;
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## 🔧 Props
|
|
94
|
+
|
|
95
|
+
### `StoryVisualizerProps`
|
|
96
|
+
|
|
97
|
+
| Prop | Tipo | Requerido | Descripción |
|
|
98
|
+
|------|------|-----------|-------------|
|
|
99
|
+
| `heritageItems` | `HeritageItem[]` | ✅ | Array de objetos de patrimonio |
|
|
100
|
+
| `targetLanguage` | `"es" \| "en" \| "fr"` | ✅ | Idioma de narración |
|
|
101
|
+
| `descriptionLength` | `"short" \| "extended"` | ✅ | Longitud de la descripción |
|
|
102
|
+
| `autoAdvance` | `boolean` | ❌ | Autoavance al siguiente patrimonio |
|
|
103
|
+
| `voiceIds` | `string[]` | ✅ | IDs de voces de ElevenLabs |
|
|
104
|
+
| `avatars` | `string[]` | ✅ | URLs de imágenes de avatares |
|
|
105
|
+
|
|
106
|
+
### Tipo `HeritageItem`
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
interface HeritageItem {
|
|
110
|
+
id: string;
|
|
111
|
+
name: string;
|
|
112
|
+
description: {
|
|
113
|
+
local: {
|
|
114
|
+
short: string;
|
|
115
|
+
extended: string;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
imageUrl: string;
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## 🎨 Personalización de Estilos
|
|
123
|
+
|
|
124
|
+
Los estilos se incluyen en el archivo CSS de la librería. Puedes sobrescribirlos en tu aplicación:
|
|
125
|
+
|
|
126
|
+
```css
|
|
127
|
+
/* En tu archivo CSS */
|
|
128
|
+
.viewer {
|
|
129
|
+
max-width: 1200px;
|
|
130
|
+
/* Tus estilos personalizados */
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## 🔑 Configuración de Variables de Entorno
|
|
135
|
+
|
|
136
|
+
El componente requiere ciertas variables de entorno para funcionar correctamente:
|
|
137
|
+
|
|
138
|
+
```env
|
|
139
|
+
# ElevenLabs API
|
|
140
|
+
VITE_ELEVENLABS_API_BASE=https://api.elevenlabs.io/v1
|
|
141
|
+
VITE_ELEVENLABS_API_KEY=tu_api_key_aqui
|
|
142
|
+
|
|
143
|
+
# Google Translate API
|
|
144
|
+
VITE_GOOGLE_TRANSLATE_BASE=https://translate.googleapis.com
|
|
145
|
+
|
|
146
|
+
# URLs de imágenes
|
|
147
|
+
VITE_IMAGE_BASE_URL=https://tu-cdn.com/images/
|
|
148
|
+
VITE_DEFAULT_IMAGE_URL=https://tu-cdn.com/default.jpg
|
|
149
|
+
|
|
150
|
+
# Modo debug (opcional)
|
|
151
|
+
VITE_DEBUG_MODE=false
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## 🎤 Obtener IDs de Voces de ElevenLabs
|
|
155
|
+
|
|
156
|
+
1. Inicia sesión en [ElevenLabs](https://elevenlabs.io/)
|
|
157
|
+
2. Ve a "Voice Library" o "My Voices"
|
|
158
|
+
3. Copia el "Voice ID" de la voz deseada
|
|
159
|
+
|
|
160
|
+
Ejemplo de voces disponibles:
|
|
161
|
+
|
|
162
|
+
```typescript
|
|
163
|
+
const voices = [
|
|
164
|
+
{ id: "21m00Tcm4TlvDq8ikWAM", name: "Rachel - Voz Femenina" },
|
|
165
|
+
{ id: "Nh2zY9kknu6z4pZy6FhD", name: "Adam - Voz Masculina" },
|
|
166
|
+
];
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## 📋 Requisitos
|
|
170
|
+
|
|
171
|
+
- React 18.0.0 o superior
|
|
172
|
+
- Node.js 16.0.0 o superior
|
|
173
|
+
|
|
174
|
+
## 🛠️ Tecnologías Utilizadas
|
|
175
|
+
|
|
176
|
+
- **React 19** - Framework de UI
|
|
177
|
+
- **TypeScript** - Tipado estático
|
|
178
|
+
- **Vite** - Build tool y bundler
|
|
179
|
+
- **ElevenLabs API** - Síntesis de voz (TTS)
|
|
180
|
+
- **Google Translate API** - Traducción automática
|
|
181
|
+
- **TensorFlow.js** - Procesamiento de texto
|
|
182
|
+
- **IndexedDB** - Caché de audio
|
|
183
|
+
|
|
184
|
+
## 📚 Ejemplos Avanzados
|
|
185
|
+
|
|
186
|
+
### Ejemplo con múltiples voces y avatares
|
|
187
|
+
|
|
188
|
+
```tsx
|
|
189
|
+
import { StoryVisualizer, voices } from '@ysolve/ocity-heritage-visualizer';
|
|
190
|
+
import avatar1 from './avatars/narrator1.webp';
|
|
191
|
+
import avatar2 from './avatars/narrator2.webp';
|
|
192
|
+
|
|
193
|
+
function AdvancedExample() {
|
|
194
|
+
return (
|
|
195
|
+
<StoryVisualizer
|
|
196
|
+
heritageItems={heritageData}
|
|
197
|
+
targetLanguage="es"
|
|
198
|
+
descriptionLength="extended"
|
|
199
|
+
autoAdvance={true}
|
|
200
|
+
voiceIds={[
|
|
201
|
+
voices[0].id, // Alterna entre diferentes voces
|
|
202
|
+
voices[1].id,
|
|
203
|
+
]}
|
|
204
|
+
avatars={[avatar1, avatar2]}
|
|
205
|
+
/>
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Uso con datos dinámicos
|
|
211
|
+
|
|
212
|
+
```tsx
|
|
213
|
+
import { StoryVisualizer } from '@ysolve/ocity-heritage-visualizer';
|
|
214
|
+
import { useEffect, useState } from 'react';
|
|
215
|
+
|
|
216
|
+
function DynamicExample() {
|
|
217
|
+
const [heritages, setHeritages] = useState([]);
|
|
218
|
+
|
|
219
|
+
useEffect(() => {
|
|
220
|
+
fetch('https://api.o-city.org/heritages')
|
|
221
|
+
.then(res => res.json())
|
|
222
|
+
.then(data => setHeritages(data));
|
|
223
|
+
}, []);
|
|
224
|
+
|
|
225
|
+
if (heritages.length === 0) {
|
|
226
|
+
return <div>Cargando...</div>;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
return (
|
|
230
|
+
<StoryVisualizer
|
|
231
|
+
heritageItems={heritages}
|
|
232
|
+
targetLanguage="es"
|
|
233
|
+
descriptionLength="extended"
|
|
234
|
+
voiceIds={["21m00Tcm4TlvDq8ikWAM"]}
|
|
235
|
+
avatars={["./avatar.webp"]}
|
|
236
|
+
/>
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## 🔄 Desarrollo Local
|
|
242
|
+
|
|
243
|
+
Si deseas contribuir o desarrollar localmente:
|
|
244
|
+
|
|
245
|
+
1. Clona el repositorio:
|
|
246
|
+
```bash
|
|
247
|
+
git clone https://github.com/tu-usuario/ocity_history_visualizer.git
|
|
248
|
+
cd ocity_history_visualizer
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
2. Instala las dependencias:
|
|
252
|
+
```bash
|
|
253
|
+
npm install
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
3. Inicia el servidor de desarrollo:
|
|
257
|
+
```bash
|
|
258
|
+
npm run dev
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
4. Construye la librería:
|
|
262
|
+
```bash
|
|
263
|
+
npm run build:lib
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
## 📝 Scripts Disponibles
|
|
267
|
+
|
|
268
|
+
- `npm run dev` - Inicia el servidor de desarrollo
|
|
269
|
+
- `npm run build:lib` - Construye la librería para producción
|
|
270
|
+
- `npm run lint` - Ejecuta el linter
|
|
271
|
+
- `npm run preview` - Previsualiza la build de producción
|
|
272
|
+
|
|
273
|
+
## 📄 Licencia
|
|
274
|
+
|
|
275
|
+
Este proyecto está bajo la licencia MIT. Ver el archivo [LICENSE](LICENSE) para más detalles.
|
|
276
|
+
|
|
277
|
+
## 🤝 Contribuciones
|
|
278
|
+
|
|
279
|
+
Las contribuciones son bienvenidas. Por favor:
|
|
280
|
+
|
|
281
|
+
1. Haz un fork del proyecto
|
|
282
|
+
2. Crea una rama para tu feature (`git checkout -b feature/AmazingFeature`)
|
|
283
|
+
3. Commit tus cambios (`git commit -m 'Add: amazing feature'`)
|
|
284
|
+
4. Push a la rama (`git push origin feature/AmazingFeature`)
|
|
285
|
+
5. Abre un Pull Request
|
|
286
|
+
|
|
287
|
+
## 📧 Contacto
|
|
288
|
+
|
|
289
|
+
Para preguntas o sugerencias, contacta con el equipo de O-CITY.
|
|
290
|
+
|
|
291
|
+
## 🗺️ Roadmap
|
|
292
|
+
|
|
293
|
+
- [x] Componente base con TTS
|
|
294
|
+
- [x] Traducción automática
|
|
295
|
+
- [x] Sistema de avatares
|
|
296
|
+
- [x] Publicación en npm
|
|
297
|
+
- [ ] Soporte para más idiomas
|
|
298
|
+
- [ ] Personalización avanzada de avatares
|
|
299
|
+
- [ ] Temas personalizables
|
|
300
|
+
- [ ] Integración con más proveedores de TTS
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
<div align="center">
|
|
305
|
+
|
|
306
|
+
**Hecho con ❤️ por el equipo de [O-CITY](https://o-city.org/)**
|
|
307
|
+
|
|
308
|
+
</div>
|