article-voice 0.0.0-stage → 0.1.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 +94 -3
- package/dist/index.d.ts +589 -0
- package/dist/index.js +3195 -0
- package/dist/index.js.map +1 -0
- package/package.json +85 -4
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,94 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# article-voice
|
|
2
|
+
|
|
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
|
+
> **Estado: 0.1.0 (pre-lanzamiento).** El paquete aún no se ha publicado en npm: la publicación la
|
|
7
|
+
> hace el dueño del repositorio (ver [CONTRIBUTING.md](CONTRIBUTING.md)). Mientras tanto se puede
|
|
8
|
+
> construir desde el código fuente (ver [Desarrollo](#desarrollo)). Ver
|
|
9
|
+
> [docs/README.md](docs/README.md) y el [backlog](docs/08-tareas/backlog.md).
|
|
10
|
+
|
|
11
|
+
## Motores de voz
|
|
12
|
+
|
|
13
|
+
| Motor (`engine`) | Estado | Qué hace |
|
|
14
|
+
| --- | --- | --- |
|
|
15
|
+
| `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). |
|
|
16
|
+
| `web-speech` | Respaldo | La voz del sistema (`speechSynthesis`). Sin servidor ni descargas; la calidad y los idiomas dependen del dispositivo. |
|
|
17
|
+
| `moss-browser` | **Experimental, opt-in** | MOSS en el navegador del visitante. Hoy no llega a tiempo real (RTF 1,93 en WASM; ver ADR-0018) y descarga cientos de MiB. Solo se usa si lo pides con `engine="moss-browser"`; `auto` nunca lo elige. |
|
|
18
|
+
|
|
19
|
+
Con `engine="auto"` (por defecto) se usa `moss-server` si hay `server-url` y responde; si no, se
|
|
20
|
+
usa la voz del sistema y el componente lo indica (evento `article-voice:fallback`). El texto solo
|
|
21
|
+
va al servidor que tú configuras, o se queda en el dispositivo; nunca a un tercero.
|
|
22
|
+
|
|
23
|
+
## Instalar y usar
|
|
24
|
+
|
|
25
|
+
Con npm:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
npm install article-voice
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
import 'article-voice'; // registra <article-voice>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
```html
|
|
36
|
+
<article-voice server-url="https://tts.example.com"></article-voice>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Sin bundler (módulo ES desde un CDN, una vez publicado el paquete):
|
|
40
|
+
|
|
41
|
+
```html
|
|
42
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/article-voice@0.1/dist/index.js"></script>
|
|
43
|
+
<article-voice server-url="https://tts.example.com"></article-voice>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Sin `server-url` el componente lee con la voz del sistema. Un artículo concreto se indica con
|
|
47
|
+
`for="id"` o `target="selector"`.
|
|
48
|
+
|
|
49
|
+
### Atributos principales
|
|
50
|
+
|
|
51
|
+
| Atributo | Valores | Por defecto | Descripción |
|
|
52
|
+
| --- | --- | --- | --- |
|
|
53
|
+
| `server-url` | URL https | — | Servidor para `moss-server` |
|
|
54
|
+
| `engine` | `auto` \| `moss-server` \| `web-speech` \| `moss-browser` | `auto` | Motor preferido |
|
|
55
|
+
| `fallback` | `web-speech` \| `none` | `web-speech` | Respaldo si falla el motor |
|
|
56
|
+
| `for` / `target` | id / selector CSS | — | Artículo explícito |
|
|
57
|
+
| `lang` | BCP 47 | del artículo | Fuerza el idioma |
|
|
58
|
+
| `voice` | id de voz | la primera del idioma | Voz |
|
|
59
|
+
| `rate` | 0.75–2.0 | 1 | Velocidad |
|
|
60
|
+
| `min-words` | entero | 120 | Mínimo de palabras para ofrecer el botón |
|
|
61
|
+
|
|
62
|
+
Un valor inválido emite `AV_INVALID_OPTION` y se usa el valor por defecto. Lista completa,
|
|
63
|
+
propiedades, métodos, eventos y estilos en el
|
|
64
|
+
[contrato de la API](docs/04-diseno/contrato-api-publica.md); errores en el
|
|
65
|
+
[catálogo](docs/04-diseno/catalogo-de-errores.md). Algunos atributos del contrato (resaltado de la
|
|
66
|
+
frase) aún están en el backlog.
|
|
67
|
+
|
|
68
|
+
## Documentación
|
|
69
|
+
|
|
70
|
+
- **Por qué existe y para quién:** [visión](docs/01-producto/vision.md), [PRD](docs/01-producto/prd.md)
|
|
71
|
+
- **Qué debe hacer:** [requisitos](docs/02-requisitos/srs.md), [historias](docs/02-requisitos/historias-de-usuario.md)
|
|
72
|
+
- **Cómo está hecho y por qué:** [SAD](docs/03-arquitectura/sad.md) y [ADRs](docs/03-arquitectura/adr/README.md)
|
|
73
|
+
- **Qué se está haciendo:** [backlog](docs/08-tareas/backlog.md)
|
|
74
|
+
- **Contribuir:** [CONTRIBUTING.md](CONTRIBUTING.md) · **Seguridad:** [SECURITY.md](SECURITY.md)
|
|
75
|
+
|
|
76
|
+
## Desarrollo
|
|
77
|
+
|
|
78
|
+
Requisitos: Node >= 22 y [pnpm](https://pnpm.io).
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
pnpm install # instala dependencias
|
|
82
|
+
pnpm verify # typecheck + lint + prettier + tests: antes de abrir un PR
|
|
83
|
+
pnpm build # genera dist/ (ESM + tipos)
|
|
84
|
+
pnpm test:package # build + prueba en Chromium de dist/ (requiere `pnpm exec playwright install chromium`)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Otros: `pnpm test`, `pnpm lint`, `pnpm api:check`, `pnpm package:lint`, `pnpm size`,
|
|
88
|
+
`pnpm test:a11y`, `pnpm test:audio`, `pnpm test:landing`.
|
|
89
|
+
|
|
90
|
+
## Licencia y atribución
|
|
91
|
+
|
|
92
|
+
[MIT](LICENSE). Usa el modelo MOSS-TTS-Nano de OpenMOSS Team (Fudan University, SII y MOSI),
|
|
93
|
+
publicado bajo Apache-2.0; los pesos no se redistribuyen en este paquete. `article-voice` no es un
|
|
94
|
+
proyecto oficial de OpenMOSS.
|