article-voice 0.0.0-stage → 0.2.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Moises Baldenegro Melendez
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 CHANGED
@@ -1,3 +1,105 @@
1
- # Temporary Holding Version
1
+ # article-voice
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **Que cualquier artículo se pueda escuchar.** Un componente web (`<article-voice>`) que detecta el
4
+ artículo de la página y lo lee en voz alta. Funciona con cualquier framework o sin ninguno.
5
+
6
+ > Consulta la [versión disponible en npm](https://www.npmjs.com/package/article-voice) y las
7
+ > [novedades de cada versión](CHANGELOG.md).
8
+
9
+ ## Motores de voz
10
+
11
+ | Motor (`engine`) | Estado | Qué hace |
12
+ | --- | --- | --- |
13
+ | `moss-server` | **Recomendado** | Voz neuronal [MOSS-TTS-Nano](https://github.com/OpenMOSS/MOSS-TTS-Nano) generada por **tu propio servidor**, compatible con OpenAI `/v1/audio/speech`. El visitante no descarga nada. Requiere `server-url`. Guía: [levantar tu servidor](docs/07-operacion/moss-server.md) y [ejemplo](examples/moss-server). |
14
+ | `web-speech` | Respaldo | Voces locales del sistema (`speechSynthesis`). La calidad y los idiomas dependen del dispositivo. |
15
+ | `moss-browser` | **Experimental, solo en el spike** | El runtime de MOSS en el navegador está en [`spikes/t000-moss-browser`](spikes/t000-moss-browser) y queda fuera del paquete distribuido. |
16
+
17
+ Con `engine="auto"` (por defecto) se usa `moss-server` si hay `server-url` y responde; si no, se
18
+ usa la voz del sistema y el componente lo indica (evento `article-voice:fallback`). Con
19
+ `moss-server`, el texto va al servidor que configuras. Con `web-speech`, el texto se procesa
20
+ en el dispositivo con las voces locales disponibles.
21
+
22
+ Si solicitas `engine="moss-browser"` en `<article-voice>`, con el respaldo permitido y una voz
23
+ local disponible el elemento usa `web-speech`, reporta `activeEngine` como
24
+ `{ kind: 'web-speech', fallback: true }` y muestra «Se usa la voz del sistema». También emite
25
+ `article-voice:fallback` con el motivo `moss-browser-unavailable`. Con `fallback="none"` emite
26
+ `AV_ENGINE_UNAVAILABLE`, deja `activeEngine` en `null` y no sintetiza.
27
+
28
+ ## Instalar y usar
29
+
30
+ Con npm:
31
+
32
+ ```sh
33
+ npm install article-voice
34
+ ```
35
+
36
+ ```js
37
+ import 'article-voice'; // registra <article-voice>
38
+ ```
39
+
40
+ ```html
41
+ <article-voice server-url="https://tts.example.com"></article-voice>
42
+ ```
43
+
44
+ Sin bundler, usa el módulo ES desde el CDN:
45
+
46
+ ```html
47
+ <script type="module" src="https://cdn.jsdelivr.net/npm/article-voice@0.1.0/dist/index.js"></script>
48
+ <article-voice server-url="https://tts.example.com"></article-voice>
49
+ ```
50
+
51
+ Sin `server-url` el componente lee con la voz del sistema. Un artículo concreto se indica con
52
+ `for="id"` o `target="selector"`.
53
+
54
+ En la versión 0.2.0, pendiente de publicación en npm, `web-speech` ofrece las voces locales que el
55
+ navegador tenga disponibles y prioriza las del idioma del artículo. Por defecto elige una variante
56
+ identificada como Premium, Enhanced, Natural o Neural
57
+ cuando existe. Si no hay una variante mejorada, prioriza la voz predeterminada del navegador entre
58
+ las voces disponibles. Una selección guardada o un atributo `voice` válido puede cambiar esa elección.
59
+
60
+ ### Atributos principales
61
+
62
+ | Atributo | Valores | Por defecto | Descripción |
63
+ | --- | --- | --- | --- |
64
+ | `server-url` | URL https | — | Servidor para `moss-server` |
65
+ | `engine` | `auto` \| `moss-server` \| `web-speech` \| `moss-browser` | `auto` | Motor preferido |
66
+ | `fallback` | `web-speech` \| `none` | `web-speech` | Respaldo si falla el motor |
67
+ | `for` / `target` | id / selector CSS | — | Artículo explícito |
68
+ | `lang` | BCP 47 | del artículo | Fuerza el idioma |
69
+ | `voice` | id de voz | la primera disponible en el motor | Voz del navegador o de `moss-server`. La 0.2.0 descubre voces del servidor en `GET /v1/audio/voices`. |
70
+ | `rate` | 0.75–2.0 | 1 | Velocidad |
71
+ | `min-words` | entero | 120 | Mínimo de palabras para ofrecer el botón |
72
+
73
+ Un valor inválido emite `AV_INVALID_OPTION` y se usa el valor por defecto. Lista completa,
74
+ propiedades, métodos, eventos y estilos en el
75
+ [contrato de la API](docs/04-diseno/contrato-api-publica.md); errores en el
76
+ [catálogo](docs/04-diseno/catalogo-de-errores.md). Algunos atributos del contrato (resaltado de la
77
+ frase) aún están en el backlog.
78
+
79
+ ## Documentación
80
+
81
+ - **Por qué existe y para quién:** [visión](docs/01-producto/vision.md), [PRD](docs/01-producto/prd.md)
82
+ - **Qué debe hacer:** [requisitos](docs/02-requisitos/srs.md), [historias](docs/02-requisitos/historias-de-usuario.md)
83
+ - **Cómo está hecho y por qué:** [SAD](docs/03-arquitectura/sad.md) y [ADRs](docs/03-arquitectura/adr/README.md)
84
+ - **Qué se está haciendo:** [backlog](docs/08-tareas/backlog.md)
85
+ - **Contribuir:** [CONTRIBUTING.md](CONTRIBUTING.md) · **Seguridad:** [SECURITY.md](SECURITY.md)
86
+
87
+ ## Desarrollo
88
+
89
+ Requisitos: Node >= 22 y [pnpm](https://pnpm.io).
90
+
91
+ ```sh
92
+ pnpm install # instala dependencias
93
+ pnpm verify # typecheck + lint + prettier + tests: antes de abrir un PR
94
+ pnpm build # genera dist/ (ESM + tipos)
95
+ pnpm test:package # build + prueba en Chromium de dist/ (requiere `pnpm exec playwright install chromium`)
96
+ ```
97
+
98
+ Otros: `pnpm test`, `pnpm lint`, `pnpm api:check`, `pnpm package:lint`, `pnpm size`,
99
+ `pnpm test:a11y`, `pnpm test:audio`, `pnpm test:landing`.
100
+
101
+ ## Licencia y atribución
102
+
103
+ [MIT](LICENSE). Usa el modelo MOSS-TTS-Nano de OpenMOSS Team (Fudan University, SII y MOSI),
104
+ publicado bajo Apache-2.0; los pesos no se redistribuyen en este paquete. `article-voice` no es un
105
+ proyecto oficial de OpenMOSS.