Skip to content

feat(themes): saved themes - #319

Merged
egdev6 merged 14 commits into
mainfrom
feat/saved-themes
Nov 23, 2026
Merged

egdev6 merged 14 commits into
mainfrom
feat/saved-themes

Conversation

@egdev6

@egdev6 egdev6 commented Nov 23, 2026

Copy link
Copy Markdown
Owner

Closes #313. Integration branch with the five reviewed phases of saved themes (each merged into feat/saved-themes after its own CI and independent verification).

What streamers get

  • Save up to 10 themes: each is a full copy of every element's look (Apariencia, alerts and variations, overlay, widgets incl. goals and chat variants, interactive look, commands, timers, custom CSS, per-custom-overlay theme CSS). Switch the whole stream look in one click; alerts on screen finish with their previous look.
  • Apariencia › Temas (artboard 03 «Detalle con vista previa»): select to preview without activating, real overlay/goal/chat renderers, Activar/Duplicar/Editar/Borrar, «Nuevo tema» from a theme or from «Color de cada plataforma» (now the only preset and the default for new installs; existing installs keep their look).
  • Avatar per theme (uploaded PNG/JPG/WebP/GIF or colour, with a ring), shown in every theme list.
  • Active-theme switcher in the sidebar footer and the dock (header + «Tema» tab); Stream Deck /sd/tema/<id>.
  • Draft safety: edits made against a theme that stopped being active are refused (409), kept visible and discardable.
  • data-tema on overlay, widgets and custom overlays; custom overlay SDK gets the theme { id, name } and its theme CSS live.
  • Export/import a single theme as a ZIP with its media (new inactive theme, unique name, all-or-nothing, hostile ZIPs refused). Full config backup now carries the .css media themes reference.
  • MCP: listar/activar/duplicar/renombrar/borrar/crear/exportar/importar temas; optional tema on theme-owned tools edits a saved theme without activating it; prompt disenar_tema guides an agent through designing one.

Phases: #314 data + switch · #315 UI, preview, fence, avatar · #316 marker, per-overlay CSS, SDK · #317 export/import · #318 MCP authoring + CSS in full backup.

Compatibility: migration v3 creates «Normal» freezing the effective look (byte-identical rendering verified on v0/v1/v2 configs); live stream events and initial frames unchanged (new events opt-in); MCP tools and panel routes without the new parameters unchanged (differentials per phase).

Local on the integrated branch: unit, browser, platform groups and typecheck green.

egdev6 and others added 14 commits November 22, 2026 23:57
A theme is a full copy of the element configuration: appearance, alerts,
overlay, widgets (incl. chat variants and goals), interactive config,
commands and timers, plus a reserved per-custom-overlay CSS map. One theme
is active; its sections stay in place, so every existing reader and writer
keeps working and edits go to the active theme.

- Config migration v3 creates «Normal» from the current config and freezes
  its effective look (resolved defaults, variation conditions, sparse
  commands/timers), so later default changes do not alter an install.
  The previous file is backed up byte for byte.
- /api/themes: list, duplicate (max 10), rename, delete (not the active
  one), activate and create from the default look. Activation is one save
  with a backup and pushes theme, alerts, widgets and custom overlays live.
  Generic config writes cannot touch themes.
- MCP: listar_temas, activar_tema, duplicar_tema, renombrar_tema,
  borrar_tema (activation and deletion require confirmation).
- The alert overlay applies a new theme after the alert on screen ends.

Refs #313
feat(themes): saved themes with an atomic switch (data and API)
…l preview

Implements the chosen artboard design/saved-themes/03-detalle-con-vista-previa:
- Apariencia gets a «Temas» tab: saved themes (n/10), select to preview
  without activating, a large preview rendered by the real overlay, goal and
  chat renderers with the selected theme's own look (read-only projection),
  and Activar / Duplicar / Renombrar / Borrar (disabled on the active theme).
  «Nuevo tema» duplicates a theme or starts from «Color de cada plataforma».
- The panel sidebar footer shows the active theme with a quick switcher;
  the dock shows it in its header and adds a «Tema» tab (narrow and wide).
- Stream Deck action to activate a theme; all surfaces follow a switch live.
- Presets are reduced to «Color de cada plataforma», now the look of new
  installs and of themes created from the default; migrated installs keep
  their previous default look.
- Theme-owned panel writes carry the theme they were edited against: if the
  active theme changed meanwhile the server answers 409 and writes nothing
  (mixed overlay + themed writes are atomic); stale drafts stay visible,
  cannot be saved and can be discarded. API/MCP writes without the header
  keep writing the active theme.

Refs #313
Dark grid stage with a dashed safe area and compact height so the goal and
chat previews and the action row fit at 1440x900; each theme's dot shows its
accent or the multicolour platform dot; the selected theme shows «Vista
previa seleccionada».

Refs #313
Each saved theme can carry an avatar (theme metadata, outside the copied
look): an uploaded image cropped to a circle and/or a colour drawn as its
ring; without one, the theme's dot shows inside the same ring. It is set in
«Nuevo tema» and in «Editar» (formerly «Renombrar») and shown in every theme
list: Apariencia (list, detail header, «Nuevo tema» origins), the sidebar
switcher and the dock header and «Tema» tab. MCP renombrar_tema accepts
optional color and imagen.

Images must be PNG, JPG, WebP or GIF regular files in the media folder (SVG
and symlinks are refused); removing an avatar or deleting a theme never
deletes media. Duplicating a theme does not copy its avatar; activation
keeps both themes' avatars.

Refs #313
.d-btn, declared later with the same specificity, forced a column layout on
the theme choices; the artboard shows avatar, name and action in one row.

Refs #313
feat(themes): Apariencia › Temas, sidebar and dock selectors, faithful preview
- Overlay, widgets, interview, teleprompter and custom overlay frames carry
  data-tema="<theme id>" on <html>, updated live. The alert overlay switches
  its marker together with the deferred look when the visible alert exits;
  an idle overlay and the other pages switch immediately.
- Each custom overlay gets a theme-owned «CSS de este tema» (stored in the
  theme look, copied on duplicate, swapped on activate). It is injected live
  into the sandboxed frame through the trusted shell without reloading it;
  the overlay's own code and approval never change. The editor honours the
  theme fence.
- The custom overlay SDK exposes the theme { id, name } and receives
  identity, look and theme CSS as one atomic snapshot.
- Still previews of every alert type use the previewed theme read-only.
- Stream contract unchanged: existing events and initial frames are
  byte-identical; activeTheme (themeInfo=1) and customOverlayTheme
  (customTheme=1) are opt-in events sent after them. /api/state shape is
  unchanged.

Refs #313
feat(themes): theme marker, per-overlay theme CSS and SDK theme identity
- GET /api/themes/:id/export downloads a ZIP (config.json manifest with
  kind theme + media/) holding the theme name, avatar, full look (live
  sections for the active theme) and every media file it references:
  alert/variation/command/timer media and sounds, fonts, icons, the avatar
  and CSS url()/@import/@font-face references per rendering surface.
  Never secrets, connections, sessions or other system sections, nor custom
  overlay code (only its theme CSS).
- POST /api/themes/import/preview shows name, media, conflicts and
  warnings without side effects; POST /api/themes/import creates a NEW
  inactive theme (unique name on clash, 10-theme limit). Colliding media get
  free names and the references are rewritten preserving their quoting;
  identical files are reused; theme CSS for missing overlays is dropped with
  a warning. All-or-nothing: any failure leaves config and media unchanged.
- Reuses the config-transfer ZIP reader, streamed upload, limits,
  fingerprint and scratch handling; full configuration export/import is
  unchanged.
- Apariencia › Temas gets «Exportar» and «Importar tema» (preview dialog);
  MCP gains exportar_tema and importar_tema_guardado.

Refs #313
feat(themes): export and import a single theme with its media
- crear_tema creates an inactive theme from «Color de cada plataforma» or
  as a copy, with name and avatar.
- Theme-owned MCP write and read tools accept an optional `tema`: the
  existing handler runs against a request-isolated copy of that saved look
  and the result is committed atomically with the usual conflict check. It
  never activates the theme, never touches the live config and sends nothing
  to overlays; the full look is validated before saving (400, nothing
  written); targeted writes create no backups so restore points survive an
  authoring session. Without `tema` every tool behaves exactly as before.
  Live counters stay on the current session.
- MCP prompt «disenar_tema» guides the agent through what to ask, one topic
  at a time, shows the preview URLs and activates only on explicit request.
- The full configuration backup now carries the media `.css` files that
  the active or saved looks reference; unreferenced CSS is still skipped and
  refused, and the historical error order of the import is kept.

Refs #313
…s symlinks

The two new referenced-CSS symlink tests skipped on every Windows run with a
reason the CI baseline does not allow. They now try to create the symlink
and skip with the allowed reason only on EPERM/ENOTSUP, like the other
symlink tests.

Refs #313
feat(themes): create and edit saved themes from an agent over MCP
@egdev6
egdev6 merged commit c84420a into main Nov 23, 2026
5 checks passed
@egdev6
egdev6 deleted the feat/saved-themes branch November 23, 2026 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Temas guardados: varios aspectos completos y cambio de tema en directo

1 participant