From 9d5078b1b0cb501eaaadf4f84d14a3a8992015bb Mon Sep 17 00:00:00 2001 From: egdev6 <18334564+egdev6@users.noreply.github.com> Date: Wed, 25 Nov 2026 12:27:55 +0100 Subject: [PATCH 1/4] feat(custom-overlays): settings fields with values delivered live Custom overlays can declare settings fields (text, number, toggle, select, color, list, media; up to 30) and store values validated per type in every write path (API, generic config and import). The page reads them as antena.settings / antena.on('settings'). Media values are file names that the shell turns into absolute /media URLs. Changing values does not version the overlay: the new customOverlaySettings event pushes them to open layers live. Changing the fields reloads the layer and keeps the values whose key still exists and fits. Fields and values never require approving the actions again, and they stay out of saved themes. MCP: campos and valores. Also fixes the shell not sending ready again after the frame reloads (saving the code or changing fields), so antena.ready never resolved in the reloaded page. --- README.es.md | 9 +- README.md | 9 +- public/custom/sdk.js | 15 +- src/custom-overlays.mjs | 149 ++++++++++++++++- src/events.mjs | 2 +- src/mcp.mjs | 22 ++- src/server.mjs | 4 + test/custom-overlay-settings-browser.test.mjs | 58 +++++++ test/custom-overlay-settings-sdk.test.mjs | 34 ++++ test/custom-overlay-settings.test.mjs | 156 ++++++++++++++++++ test/custom-overlays-sdk.test.mjs | 4 +- test/custom-overlays.test.mjs | 2 + test/groups.json | 3 + test/mcp-custom-overlays.test.mjs | 21 +++ test/saved-themes.test.mjs | 4 +- test/ws-stream.test.mjs | 23 +-- 16 files changed, 479 insertions(+), 36 deletions(-) create mode 100644 test/custom-overlay-settings-browser.test.mjs create mode 100644 test/custom-overlay-settings-sdk.test.mjs create mode 100644 test/custom-overlay-settings.test.mjs diff --git a/README.es.md b/README.es.md index 222cc3f..9e18a20 100644 --- a/README.es.md +++ b/README.es.md @@ -293,8 +293,9 @@ Una capa nueva para el programa de emisión hecha con HTML, CSS y JavaScript: un | API | Qué hace | |---|---| | `antena.on(evento, fn)` | Escucha un evento y devuelve la función para dejar de escuchar. Si ya hay un valor, `fn` se llama al momento con él | -| `antena.state` | Último valor de cada evento (`alert`, `chat`, `viewers`, `widgets`, `interactive`, `theme`, `scene`, `sceneSwitch`); empiezan en `null` | +| `antena.state` | Último valor de cada evento (`alert`, `chat`, `viewers`, `widgets`, `interactive`, `theme`, `scene`, `sceneSwitch`, `settings`); empiezan en `null` | | `antena.ready` | Promesa que se resuelve cuando ya hay datos: espera antes de leer `antena.state` | +| `antena.settings` | Los ajustes de este overlay (ver «Campos de ajustes» más abajo) | | `antena.run(tipo, params)` | Pide una acción aprobada: resuelve si se ejecutó y se rechaza con el error del servidor si no | | `antena.slots.place(huecos, opciones)` / `antena.slots.clear(nombre?)` | Coloca, mueve u oculta widgets reales; borra uno o todos al momento | @@ -343,6 +344,12 @@ El agente **pide** permisos al crear o editar; solo tú los **apruebas** en el p **Seguridad.** El código corre en un `